Skip to content

maierfelix/Iroh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Iroh

Website | Examples | API

NPM Version NPM Downloads

☕ Dynamic code analysis for JavaScript


Description

Iroh is a dynamic code analysis tool for JavaScript. Iroh allows to record your code flow in realtime, intercept runtime informations and manipulate program behaviour on the fly.

What is Dynamic analysis?

Dynamic analysis is in contrast to static analysis (e.g. used in Babel and ESlint). It allows to collect data which is only available at runtime. Iroh makes it possible to collect type informations of your running program, analyze it's behaviour, capture and manipulate runtime values like parameters or variables - and all this while your code is actually running!

Getting started

You can learn how to use Iroh here.

A summary of Iroh's API can be found here.

Installation

npm install iroh

or alternatively the browser distribution from here.

Examples

You can play with some live examples here and you can clone them from here.

Below you can see an example of visualizing captured runtime data. While the code below is running, Iroh feeds us a stream of runtime informations, which we can then visualize within any kind of model. In this case we are using a simple textual model to visualize all Iroh.CALLS (function calls) and Iroh.IF (if statements) of the input code. The code indentation in the output is automatically generated by Iroh too.

Input

function factorial(n) {
  if (n === 0) return 1;
  return n * factorial(n - 1);
};
factorial(3);

Output

call factorial ( [3] )
  call factorial ( [2] )
    call factorial ( [1] )
      call factorial ( [0] )
        if
        if end
      call factorial end -> [1]
    call factorial end -> [1]
  call factorial end -> [2]
call factorial end -> [6]

About

Dynamic code analysis tool - Exploit, record and analyze running JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published