Skip to content

Commit e10c248

Browse files
committed
update readme
1 parent e13ae5b commit e10c248

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# JS Analyzer
22

3-
This is a project to analyze obfuscated JS code using abstract interpretation.
3+
This is a project to analyze obfuscated JS code using abstract interpretation and optimizations similar to compiler optimizations
44

55
It requires `python3` or `pypy3` with module `esprima`. The usage of `pypy3` is
66
recommended for performance reasons.
@@ -11,6 +11,7 @@ essential things are missing, including but not limited to:
1111
* OOP stuff (classes, etc)
1212
* async functions
1313
* a lot of operators and built-in functions are not handled correctly, or not handled at all...
14+
* Analysis speed could be a lot better
1415

1516
## Setup
1617

@@ -24,7 +25,16 @@ Before use, you must type `make` in the project directory in order to compile js
2425

2526
It will produce a `yourfile-out.js`
2627

27-
## How it works
28+
## How it works ?
29+
30+
The obfuscated JS is processed in 4 steps
31+
32+
* Parsing the JS into an Abstract Syntax Tree (AST) (this is done by the esprima module)
33+
* Abstract Interpretation on the AST to find out constant expressions (done by analyze.py)
34+
* Code Transformations on the AST, this is similar to compiler optimizations (done by transform.py)
35+
* Transformed JS output (done by prettyprint.js using the escodegen module)
36+
37+
## Abstract interpretation
2838

2939
### The general idea
3040

@@ -114,3 +124,6 @@ The project is organized in several files:
114124
* `output.py`: defines the pretty-printer / output generator. It is executed after the interpreter, and outputs the result JS, where each constant expression is replaced with its value.
115125

116126

127+
## Code Transforms
128+
129+
The used optimizations are common, and found in any good compilation book (dead code/variable elimination, unrolling, etc)

0 commit comments

Comments
 (0)