Skip to content

Commit ef12a9f

Browse files
authored
Merge pull request #2 from chame1eon/feature/typescript-upgrade
Feature/typescript upgrade
2 parents f6619b5 + 8c90328 commit ef12a9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+6993
-1821
lines changed

.eslintrc.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"parserOptions": {
3+
"project": "./tsconfig.json"
4+
},
5+
"parser": "@typescript-eslint/parser",
6+
"plugins": [
7+
"@typescript-eslint"
8+
],
9+
"extends": [
10+
"plugin:@typescript-eslint/all"
11+
],
12+
"rules": {
13+
"@typescript-eslint/no-this-alias": [
14+
"error",
15+
{
16+
"allowDestructuring": true,
17+
"allowedNames": ["self"]
18+
}
19+
]
20+
}
21+
}

.travis.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,14 @@ install:
77
- pip install -r requirements.txt
88
- pip install .
99
- nvm install 12.7.0
10-
- npm install -g [email protected]
10+
- npm install
1111

1212
before_script:
13-
- cd jnitrace
14-
- mkdir build
15-
- touch build/__init__.py
13+
- touch jnitrace/build/__init__.py
1614

1715
script:
18-
- pylint jnitrace.py
19-
- cd src && frida-compile main.js -o ../build/jnitrace.js
20-
21-
after_success:
22-
- cd ../../
16+
- pylint jnitrace/jnitrace.py
17+
- npm run lint
2318

2419
deploy:
2520
provider: pypi

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# jnitrace Change Log
22

3+
## 2.0.0
4+
- General code refactoring, including upgrading codebase to TypeScript
5+
- Added tracing of the JavaVM struct by default
6+
- Added method filters to include or exclude certain methods from the trace
7+
- Added options to allow custom Frida scripts to be loaded before and after jnitrace is loaded
8+
- Added option to export all traced data to a json formatted file
9+
- Added options to switch off tracking of the whole JavaVM or JNIEnv
10+
- Application is now killed when the tracer is finished to prevent crashes
11+
- Log messages have been added to show when a tracked library is loaded
12+
- Added support to capture floating point return values on X86 devices
13+
- jnitrace now also displays the values of jvalue* and va_list for method calls
14+
- Bugfix for crashes on arm 32 bit devices
15+
16+
317
## 1.3.5
418
- Bug fix - Backtraces are now printed correctly for variadic functions
519
- jboolean values now print true/false as well as the integer value

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manual reverse engineering can be a slow and painful process. `jnitrace` works
88
as a dynamic analysis tracing tool similar to frida-trace or strace but for
99
the JNI.
1010

11-
![JNITrace Output](https://i.ibb.co/w4YpQ4y/jnitrace-1.png)
11+
![JNITrace Output](https://i.ibb.co/Q9YzZYp/jnitrace-1.png)
1212

1313
## Installation:
1414

@@ -26,20 +26,25 @@ The easiest way to get running with `jnitrace` is to install using pip:
2626

2727
After a pip install it is easy to run `jnitrace`:
2828

29-
`jnitrace -l libnative-lib.so -b accurate -d -p com.example.myapplication`
29+
`jnitrace -l libnative-lib.so com.example.myapplication`
3030

3131
`jnitrace` requires a minimum of two parameters to run a trace:
32-
* `-l` - is used to specify the libraries to trace. This can be a list of libraries or `*` if you want to trace all libraries.
33-
* `-p` - is used to specify the process to trace. It needs to be given in the form of an Android package.
32+
* `-l libnative-lib.so` - is used to specify the libraries to trace. This argument can be used multiple times or `*` can be used to track all libraries.
33+
* `com.example.myapplication` - is the Android package to trace. This package must already be installed on the device.
3434

3535
Optional arguments are listed below:
36-
* `-i <spawn|attach>` - is used to specify the Frida attach mechanism to use. It can either be spawn or attach. Spawn is the default option.
37-
* `-b <fuzzy|accurate>` - is used to control backtrace output. Fuzzy will use
36+
* `-m <spawn|attach>` - is used to specify the Frida attach mechanism to use. It can either be spawn or attach. Spawn is the default option.
37+
* `-b <fuzzy|accurate|none>` - is used to control backtrace output. Fuzzy will use
3838
the Frida FUZZY Backtracer, whereas accurate will use the Frida ACCURATE
39-
Backtracer.
40-
* `-d` - is used to control whether the trace output should show any
41-
additional data for the method arguments. This will include buffers passed to
42-
a function or strings.
39+
Backtracer. None will prevent the backtracer from running.
40+
* `-i <regex>` - is used to specify the method names that should be traced. This can be helpful for reducing the noise in particularly noisy JNI apps. The option can be supplied multiple time.
41+
* `-e <regex>` - is used to specify the method names that should be ignored in the trace. This can be helpful for reducing the noise in particularly noisy JNI apps. The option can be supplied multiple time.
42+
* `-o path/output.json` - is used to specify an output path where `jnitrace` will store all traced data. The information is stored in JSON format to allow later post-processing of the trace data.
43+
* `-p path/to/script.js` - the path provided is used to load a Frida script into the target process before the `jnitrace` script has loaded. This can be used for defeating anti-frida or anti-debugging code before `jnitrace` starts.
44+
* `-a path/to/script.js` - the path provided is used to load Frida script into the target process after `jnitrace` has been loaded.
45+
* `--hide-data` - used to reduce the quantity of output displayed in the console. This option will hide additional data that is displayed as hexdumps or as string de-references.
46+
* `--ignore-env` - using this option will hide all calls the app is making using the JNIEnv struct.
47+
* `--ignore-vm` - using this option will hide all calls the app is making using the JavaVM struct.
4348

4449
***Note***
4550

@@ -54,18 +59,15 @@ instructions for installing frida have been followed, the following command will
5459
Building `jnitrace` from source requires that `node` first be installed.
5560
After installing `node`, the following commands need to be run:
5661

57-
* `npm install frida-compile`
58-
* `cd /path/to/jnitrace/src`
59-
* `frida-compile main.js -o ../build/jnitrace.js -w`
62+
* `npm install`
63+
* `npm run watch`
6064

61-
`frida-compile` will run in the background compiling the source to the output
62-
file, `jnitrace.js`. By using the `-w` command with `frida-compile`, any
63-
changes to the source file trigger `frida-compile` to update the output.
64-
`jnitrace.py` loads from build/jnitrace.js by default, so no other
65+
`npm run watch` will run `frida-compile` in the background compiling the source to the output
66+
file, `build/jnitrace.js`. `jnitrace.py` loads from `build/jnitrace.js` by default, so no other
6567
changes are required to run the updates.
6668

6769
## Output:
68-
![JNITrace Output](https://i.ibb.co/TYT3mGK/jnitrace-2.png)
70+
![JNITrace Output](https://i.ibb.co/2K7gRbP/jnitrace-2.png)
6971

7072
Like frida-trace, output is colored based on the API call thread.
7173

0 commit comments

Comments
 (0)