frida-fusion 0.1.7__tar.gz → 0.1.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of frida-fusion might be problematic. Click here for more details.
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/PKG-INFO +41 -3
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/README.md +40 -2
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/__meta__.py +2 -2
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/fusion.py +27 -14
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/libs/helpers.js +65 -86
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/libs/logger.py +2 -2
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/modules/crypto/crypto.js +99 -100
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion.egg-info/PKG-INFO +41 -3
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/LICENSE +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/__init__.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/__main__.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/args.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/config.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/libs/__init__.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/libs/color.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/libs/database.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/libs/scriptlocation.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/module.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/modules/__init__.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/modules/crypto/__init__.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/modules/crypto/crypto.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/modules/tls_unpinning/__init__.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion/modules/tls_unpinning/frida_multiple_unpinning.py +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion.egg-info/SOURCES.txt +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion.egg-info/dependency_links.txt +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion.egg-info/entry_points.txt +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion.egg-info/requires.txt +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/frida_fusion.egg-info/top_level.txt +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/pyproject.toml +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/setup.cfg +0 -0
- {frida_fusion-0.1.7 → frida_fusion-0.1.9}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: frida-fusion
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: Hook your mobile tests with Frida
|
|
5
5
|
Author-email: "Helvio Junior (M4v3r1ck)" <helvio_junior@hotmail.com>
|
|
6
6
|
Maintainer-email: "Helvio Junior (M4v3r1ck)" <helvio_junior@hotmail.com>
|
|
@@ -73,6 +73,43 @@ Modules:
|
|
|
73
73
|
pip3 install frida-fusion
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
## Custom Frida script
|
|
77
|
+
|
|
78
|
+
You must provide a custom Frida script as usual. To do this you must provide `-s/--script-path` parameter.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Just one file
|
|
82
|
+
frida-fusion -f [app_id] -U --script-path mytest.js
|
|
83
|
+
|
|
84
|
+
# A entire directory
|
|
85
|
+
frida-fusion -f [app_id] -U --script-path /tmp/scripts
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Exposed JavaScript (frida) functions
|
|
89
|
+
|
|
90
|
+
The Frida Fusion define/expose several functions to be used at frida scripts. Follows the typedef of these functions.
|
|
91
|
+
|
|
92
|
+
```java
|
|
93
|
+
# Send message/data to Frida-Fusion
|
|
94
|
+
void fusion_sendMessage(String level, String message);
|
|
95
|
+
void fusion_sendMessageWithTrace(String level, String message);
|
|
96
|
+
void fusion_sendKeyValueData(String module, Object items);
|
|
97
|
+
|
|
98
|
+
# Print StackTrace
|
|
99
|
+
void fusion_printStackTrace();
|
|
100
|
+
|
|
101
|
+
# Print all methods of class 'name'
|
|
102
|
+
void fusion_printMethods(String name);
|
|
103
|
+
|
|
104
|
+
# Wait until the class 'name' exists in memory to execute the callback function
|
|
105
|
+
void fusion_waitForClass(String name, CallbackFunction onReady)
|
|
106
|
+
|
|
107
|
+
# Conversions
|
|
108
|
+
byte[] fusion_stringToBase64(String message);
|
|
109
|
+
String fusion_bytesToBase64(byte[] byteArray);
|
|
110
|
+
String fusion_encodeHex(byte[] byteArray);
|
|
111
|
+
```
|
|
112
|
+
|
|
76
113
|
## Module engine
|
|
77
114
|
|
|
78
115
|
You can check available modules with `frida-fusion --list-modules` command.
|
|
@@ -104,7 +141,7 @@ export FUSION_MODULES=/tmp/modules
|
|
|
104
141
|
frida-fusion --list-modules
|
|
105
142
|
|
|
106
143
|
# Using available module
|
|
107
|
-
frida-fusion -f [app_id] -U --script-path . -m [module_name]
|
|
144
|
+
frida-fusion -f [app_id] -U --script-path mytest.js -m [module_name]
|
|
108
145
|
```
|
|
109
146
|
|
|
110
147
|
At windows:
|
|
@@ -116,7 +153,7 @@ $env:FUSION_MODULES = "C:\extra_mods"
|
|
|
116
153
|
frida-fusion --list-modules
|
|
117
154
|
|
|
118
155
|
# Using available module
|
|
119
|
-
frida-fusion -f [app_id] -U --script-path . -m [module_name]
|
|
156
|
+
frida-fusion -f [app_id] -U --script-path mytest.js -m [module_name]
|
|
120
157
|
```
|
|
121
158
|
|
|
122
159
|
### Community modules
|
|
@@ -131,3 +168,4 @@ export FUSION_MODULES=/tmp/frida-fusion-community-modules
|
|
|
131
168
|
# List all modules
|
|
132
169
|
frida-fusion --list-modules
|
|
133
170
|
```
|
|
171
|
+
|
|
@@ -38,6 +38,43 @@ Modules:
|
|
|
38
38
|
pip3 install frida-fusion
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
## Custom Frida script
|
|
42
|
+
|
|
43
|
+
You must provide a custom Frida script as usual. To do this you must provide `-s/--script-path` parameter.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Just one file
|
|
47
|
+
frida-fusion -f [app_id] -U --script-path mytest.js
|
|
48
|
+
|
|
49
|
+
# A entire directory
|
|
50
|
+
frida-fusion -f [app_id] -U --script-path /tmp/scripts
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Exposed JavaScript (frida) functions
|
|
54
|
+
|
|
55
|
+
The Frida Fusion define/expose several functions to be used at frida scripts. Follows the typedef of these functions.
|
|
56
|
+
|
|
57
|
+
```java
|
|
58
|
+
# Send message/data to Frida-Fusion
|
|
59
|
+
void fusion_sendMessage(String level, String message);
|
|
60
|
+
void fusion_sendMessageWithTrace(String level, String message);
|
|
61
|
+
void fusion_sendKeyValueData(String module, Object items);
|
|
62
|
+
|
|
63
|
+
# Print StackTrace
|
|
64
|
+
void fusion_printStackTrace();
|
|
65
|
+
|
|
66
|
+
# Print all methods of class 'name'
|
|
67
|
+
void fusion_printMethods(String name);
|
|
68
|
+
|
|
69
|
+
# Wait until the class 'name' exists in memory to execute the callback function
|
|
70
|
+
void fusion_waitForClass(String name, CallbackFunction onReady)
|
|
71
|
+
|
|
72
|
+
# Conversions
|
|
73
|
+
byte[] fusion_stringToBase64(String message);
|
|
74
|
+
String fusion_bytesToBase64(byte[] byteArray);
|
|
75
|
+
String fusion_encodeHex(byte[] byteArray);
|
|
76
|
+
```
|
|
77
|
+
|
|
41
78
|
## Module engine
|
|
42
79
|
|
|
43
80
|
You can check available modules with `frida-fusion --list-modules` command.
|
|
@@ -69,7 +106,7 @@ export FUSION_MODULES=/tmp/modules
|
|
|
69
106
|
frida-fusion --list-modules
|
|
70
107
|
|
|
71
108
|
# Using available module
|
|
72
|
-
frida-fusion -f [app_id] -U --script-path . -m [module_name]
|
|
109
|
+
frida-fusion -f [app_id] -U --script-path mytest.js -m [module_name]
|
|
73
110
|
```
|
|
74
111
|
|
|
75
112
|
At windows:
|
|
@@ -81,7 +118,7 @@ $env:FUSION_MODULES = "C:\extra_mods"
|
|
|
81
118
|
frida-fusion --list-modules
|
|
82
119
|
|
|
83
120
|
# Using available module
|
|
84
|
-
frida-fusion -f [app_id] -U --script-path . -m [module_name]
|
|
121
|
+
frida-fusion -f [app_id] -U --script-path mytest.js -m [module_name]
|
|
85
122
|
```
|
|
86
123
|
|
|
87
124
|
### Community modules
|
|
@@ -96,3 +133,4 @@ export FUSION_MODULES=/tmp/frida-fusion-community-modules
|
|
|
96
133
|
# List all modules
|
|
97
134
|
frida-fusion --list-modules
|
|
98
135
|
```
|
|
136
|
+
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
__version__ = '0.1.
|
|
1
|
+
__version__ = '0.1.9'
|
|
2
2
|
__title__ = "Frida Fusion"
|
|
3
3
|
__description__ = "📱 frida-fusion - runtime mobile exploration"
|
|
4
4
|
__url__ = "https://github.com/helviojunior/frida-fusion"
|
|
5
|
-
__build__ =
|
|
5
|
+
__build__ = 0x2c0d061
|
|
6
6
|
__author__ = "Helvio Junior (M4v3r1ck)"
|
|
7
7
|
__author_email__ = "helvio_junior@hotmail.com"
|
|
8
8
|
__license__ = "GPL-3.0"
|
|
@@ -167,14 +167,14 @@ class Fusion(object):
|
|
|
167
167
|
else:
|
|
168
168
|
Logger.pl("{*} Loading script file " + file_name)
|
|
169
169
|
for r in ["*", "-", "+", "!"]:
|
|
170
|
-
file_data = file_data.replace(f"console.log('[{r}] ", f"
|
|
171
|
-
file_data = file_data.replace(f'console.log("[{r}] ', f'
|
|
172
|
-
file_data = file_data.replace(f"console.log('[{r}]", f"
|
|
173
|
-
file_data = file_data.replace(f'console.log("[{r}]', f'
|
|
170
|
+
file_data = file_data.replace(f"console.log('[{r}] ", f"fusion_sendMessage('{r}', '")
|
|
171
|
+
file_data = file_data.replace(f'console.log("[{r}] ', f'fusion_sendMessage("{r}", "')
|
|
172
|
+
file_data = file_data.replace(f"console.log('[{r}]", f"fusion_sendMessage('{r}', '")
|
|
173
|
+
file_data = file_data.replace(f'console.log("[{r}]', f'fusion_sendMessage("{r}", "')
|
|
174
174
|
|
|
175
|
-
file_data = re.sub(r'(?<!\w)send\(', '
|
|
175
|
+
file_data = re.sub(r'(?<!\w)send\(', 'fusion_Send(', file_data)
|
|
176
176
|
|
|
177
|
-
file_data = file_data.replace(f'console.log(', f'
|
|
177
|
+
file_data = file_data.replace(f'console.log(', f'fusion_sendMessage("I", ')
|
|
178
178
|
file_data += "\n\n"
|
|
179
179
|
|
|
180
180
|
line_cnt = len(file_data.split("\n")) - 1
|
|
@@ -371,7 +371,11 @@ class Fusion(object):
|
|
|
371
371
|
for m in matches:
|
|
372
372
|
stack = stack.replace(m[0], f"{m[1].file_name}:{m[1].line}")
|
|
373
373
|
|
|
374
|
-
if script_location.file_name == "
|
|
374
|
+
if script_location.file_name == "fusion_bundle.js" and len(matches) >= 1:
|
|
375
|
+
script_location.file_name = matches[0][1].file_name
|
|
376
|
+
script_location.line = matches[0][1].line
|
|
377
|
+
|
|
378
|
+
elif script_location.file_name == "class-factory.js" and len(matches) == 1:
|
|
375
379
|
script_location.file_name = matches[0][1].file_name
|
|
376
380
|
script_location.line = matches[0][1].line
|
|
377
381
|
|
|
@@ -423,7 +427,10 @@ class Fusion(object):
|
|
|
423
427
|
received_data=received_data
|
|
424
428
|
)
|
|
425
429
|
except Exception as e:
|
|
426
|
-
|
|
430
|
+
if Configuration.debug_level >= 2:
|
|
431
|
+
self.print_message("E", f"Error resizing event to module {m.name}: {str(e)}")
|
|
432
|
+
else:
|
|
433
|
+
self.print_exception(e)
|
|
427
434
|
|
|
428
435
|
def _raise_data_event(self,
|
|
429
436
|
script_location: ScriptLocation = None,
|
|
@@ -437,7 +444,10 @@ class Fusion(object):
|
|
|
437
444
|
received_data=received_data
|
|
438
445
|
)
|
|
439
446
|
except Exception as e:
|
|
440
|
-
|
|
447
|
+
if Configuration.debug_level >= 2:
|
|
448
|
+
self.print_message("E", f"Error resizing event to module {m.name}: {str(e)}")
|
|
449
|
+
else:
|
|
450
|
+
self.print_exception(e)
|
|
441
451
|
|
|
442
452
|
@classmethod
|
|
443
453
|
def insert_history(cls, source: str, data: str, stack_trace: str = ''):
|
|
@@ -458,16 +468,19 @@ class Fusion(object):
|
|
|
458
468
|
@classmethod
|
|
459
469
|
def print_exception(cls, err):
|
|
460
470
|
from traceback import format_exc
|
|
461
|
-
err_txt = '
|
|
462
|
-
err_txt += '{O}Full stack trace below'
|
|
471
|
+
err_txt = 'Error:{O} %s{W}' % str(err)
|
|
472
|
+
err_txt += '\n{O}Full stack trace below\n'
|
|
463
473
|
err_txt += format_exc().strip()
|
|
464
474
|
|
|
465
|
-
err_txt = err_txt.replace('\n', '\n{W}
|
|
475
|
+
err_txt = err_txt.replace('\n', '\n{W} ')
|
|
466
476
|
err_txt = err_txt.replace(' File', '{W}{D}File')
|
|
467
477
|
err_txt = err_txt.replace(' Exception: ', '{R}Exception: {O}')
|
|
468
|
-
|
|
478
|
+
|
|
479
|
+
Logger.print_message(
|
|
469
480
|
level="E",
|
|
470
|
-
message=Color.s(
|
|
481
|
+
message=Color.s(err_txt),
|
|
482
|
+
filename_col_len=Fusion.max_filename,
|
|
483
|
+
script_location=Logger.get_caller_info(stack_index=2)
|
|
471
484
|
)
|
|
472
485
|
|
|
473
486
|
@classmethod
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Author:
|
|
1
|
+
/* Frida Fusion helper functions
|
|
2
|
+
Author: Helvio Junior - M4v3r1ck
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
function fusion_Send(payload1, payload2){
|
|
6
|
+
const info = fusion_getCallerInfo();
|
|
7
|
+
send({
|
|
8
|
+
payload: payload1,
|
|
9
|
+
location: info
|
|
10
|
+
}, payload2);
|
|
11
|
+
}
|
|
5
12
|
|
|
6
|
-
function
|
|
13
|
+
function fusion_waitForClass(name, onReady) {
|
|
7
14
|
var intv = setInterval(function () {
|
|
8
15
|
try {
|
|
9
16
|
var C = Java.use(name);
|
|
@@ -13,24 +20,24 @@ function waitForClass(name, onReady) {
|
|
|
13
20
|
}, 100);
|
|
14
21
|
}
|
|
15
22
|
|
|
16
|
-
function
|
|
23
|
+
function fusion_printStackTrace(){
|
|
17
24
|
var trace = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new());
|
|
18
25
|
trace = trace.replace("java.lang.Exception\n", "Stack trace:\n");
|
|
19
|
-
|
|
26
|
+
fusion_sendMessage("I", trace);
|
|
20
27
|
}
|
|
21
28
|
|
|
22
|
-
function
|
|
29
|
+
function fusion_toBytes(message){
|
|
23
30
|
try{
|
|
24
31
|
const StringClass = Java.use('java.lang.String');
|
|
25
32
|
var bTxt = StringClass.$new(message).getBytes('utf-8');
|
|
26
33
|
|
|
27
34
|
return bTxt;
|
|
28
35
|
} catch (err) {
|
|
29
|
-
|
|
36
|
+
fusion_sendMessage("W", err)
|
|
30
37
|
}
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
function
|
|
40
|
+
function fusion_stringToBase64(message){
|
|
34
41
|
try{
|
|
35
42
|
const StringClass = Java.use('java.lang.String');
|
|
36
43
|
const Base64Class = Java.use('android.util.Base64');
|
|
@@ -39,19 +46,19 @@ function toBase64(message){
|
|
|
39
46
|
|
|
40
47
|
return b64Msg;
|
|
41
48
|
} catch (err) {
|
|
42
|
-
|
|
49
|
+
fusion_sendMessage("W", err)
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
function
|
|
53
|
+
function fusion_bytesToBase64(byteArray){
|
|
47
54
|
|
|
48
|
-
if (
|
|
55
|
+
if (byteArray === null || byteArray === undefined) return "IA==";
|
|
49
56
|
try {
|
|
50
57
|
// 1) Confirma tipo byte[], se não tenta converter em string
|
|
51
|
-
|
|
58
|
+
byteArray = Java.array('byte', byteArray);
|
|
52
59
|
|
|
53
60
|
// 2) Tem 'length' numérico
|
|
54
|
-
const len =
|
|
61
|
+
const len = byteArray.length;
|
|
55
62
|
if (typeof len !== "number") return "IA==";
|
|
56
63
|
|
|
57
64
|
// 3) (opcional) Exigir conteúdo
|
|
@@ -64,16 +71,16 @@ function bytesToBase64(message){
|
|
|
64
71
|
try{
|
|
65
72
|
|
|
66
73
|
const Base64Class = Java.use('android.util.Base64');
|
|
67
|
-
var b64Msg = Base64Class.encodeToString(
|
|
74
|
+
var b64Msg = Base64Class.encodeToString(byteArray, 0x00000002); //Base64Class.NO_WRAP = 0x00000002
|
|
68
75
|
|
|
69
76
|
return b64Msg;
|
|
70
77
|
} catch (err) {
|
|
71
|
-
|
|
78
|
+
fusion_sendMessage("W", err)
|
|
72
79
|
return "IA==";
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
|
|
76
|
-
function
|
|
83
|
+
function fusion_getCallerInfo() {
|
|
77
84
|
try{
|
|
78
85
|
const stack = new Error().stack.split("\n");
|
|
79
86
|
|
|
@@ -89,9 +96,9 @@ function getCallerInfo() {
|
|
|
89
96
|
const file = m[2];
|
|
90
97
|
const ln = parseInt(m[3], 10);
|
|
91
98
|
|
|
92
|
-
//
|
|
99
|
+
// Ignore helper functions (with name "send")
|
|
93
100
|
if (/^send/i.test(func)) continue;
|
|
94
|
-
if (/^
|
|
101
|
+
if (/^fusion_Send/i.test(func)) continue;
|
|
95
102
|
|
|
96
103
|
return { file_name: file, function_name: func, line: ln };
|
|
97
104
|
}
|
|
@@ -102,29 +109,8 @@ function getCallerInfo() {
|
|
|
102
109
|
return null;
|
|
103
110
|
}
|
|
104
111
|
|
|
105
|
-
function
|
|
106
|
-
|
|
107
|
-
const info = getCallerInfo();
|
|
108
|
-
send({
|
|
109
|
-
payload: payload1,
|
|
110
|
-
location: info
|
|
111
|
-
}, payload2);
|
|
112
|
-
} catch (err) {
|
|
113
|
-
//sendMessage("*", err)
|
|
114
|
-
console.log(`Error: ${err}`)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function sendData(mType, jData, bData){
|
|
119
|
-
//iSend('{"type" : "'+ mType +'", "jdata" : "'+ jData +'"}', bData);
|
|
120
|
-
iSend({
|
|
121
|
-
type: mType,
|
|
122
|
-
jdata: jData
|
|
123
|
-
}, bData)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function sendKeyValueData(module, items) {
|
|
127
|
-
var st = getB64StackTrace();
|
|
112
|
+
function fusion_sendKeyValueData(module, items) {
|
|
113
|
+
var st = fusion_getB64StackTrace();
|
|
128
114
|
|
|
129
115
|
var data = [];
|
|
130
116
|
|
|
@@ -133,67 +119,75 @@ function sendKeyValueData(module, items) {
|
|
|
133
119
|
data = data.concat([{key: `${items[i].key}`, value:`${items[i].value}`}]);
|
|
134
120
|
}
|
|
135
121
|
|
|
136
|
-
|
|
122
|
+
fusion_Send({
|
|
137
123
|
type: "key_value_data",
|
|
138
124
|
module: module,
|
|
139
125
|
data: data,
|
|
140
126
|
stack_trace: st
|
|
141
127
|
}, null);
|
|
142
128
|
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function fusion_sendMessage(level, message){
|
|
132
|
+
try{
|
|
133
|
+
const StringClass = Java.use('java.lang.String');
|
|
134
|
+
const Base64Class = Java.use('android.util.Base64');
|
|
135
|
+
var bTxt = StringClass.$new(message).getBytes('utf-8');
|
|
136
|
+
var b64Msg = Base64Class.encodeToString(bTxt, 0x00000002); //Base64Class.NO_WRAP = 0x00000002
|
|
143
137
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
138
|
+
//send('{"type" : "message", "level" : "'+ level +'", "message" : "'+ b64Msg +'"}');
|
|
139
|
+
fusion_Send({
|
|
140
|
+
type: "message",
|
|
141
|
+
level: level,
|
|
142
|
+
message: b64Msg
|
|
143
|
+
}, null)
|
|
144
|
+
} catch (err) {
|
|
145
|
+
fusion_sendMessage("W", err)
|
|
151
146
|
}
|
|
152
|
-
jData += `], "stack_trace": "${st}"}`;
|
|
153
|
-
iSend(jData, "");
|
|
154
|
-
*/
|
|
155
147
|
}
|
|
156
148
|
|
|
157
|
-
function
|
|
149
|
+
function fusion_sendMessageWithTrace(level, message){
|
|
158
150
|
try{
|
|
159
151
|
const StringClass = Java.use('java.lang.String');
|
|
160
152
|
const Base64Class = Java.use('android.util.Base64');
|
|
153
|
+
|
|
154
|
+
var trace = Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new());
|
|
155
|
+
trace = trace.replace("java.lang.Exception\n", "Stack trace:\n");
|
|
156
|
+
message += "\n"
|
|
157
|
+
message += trace
|
|
158
|
+
|
|
161
159
|
var bTxt = StringClass.$new(message).getBytes('utf-8');
|
|
162
160
|
var b64Msg = Base64Class.encodeToString(bTxt, 0x00000002); //Base64Class.NO_WRAP = 0x00000002
|
|
163
161
|
|
|
164
162
|
//send('{"type" : "message", "level" : "'+ level +'", "message" : "'+ b64Msg +'"}');
|
|
165
|
-
|
|
163
|
+
fusion_Send({
|
|
166
164
|
type: "message",
|
|
167
165
|
level: level,
|
|
168
166
|
message: b64Msg
|
|
169
167
|
}, null)
|
|
170
168
|
} catch (err) {
|
|
171
|
-
|
|
172
|
-
//sendMessage('-', 'secret_key_spec.$init.overload error: ' + err + '\n' + err.stack);
|
|
169
|
+
fusion_sendMessage("W", err)
|
|
173
170
|
}
|
|
174
171
|
}
|
|
175
172
|
|
|
176
|
-
function
|
|
173
|
+
function fusion_sendError(error) {
|
|
177
174
|
try{
|
|
178
|
-
|
|
175
|
+
fusion_sendMessage("E", error + '\n' + error.stack);
|
|
179
176
|
} catch (err) {
|
|
180
|
-
|
|
177
|
+
fusion_sendMessage("W", err)
|
|
181
178
|
}
|
|
182
179
|
}
|
|
183
180
|
|
|
184
|
-
function
|
|
181
|
+
function fusion_encodeHex(byteArray) {
|
|
185
182
|
|
|
186
183
|
const HexClass = Java.use('org.apache.commons.codec.binary.Hex');
|
|
187
184
|
const StringClass = Java.use('java.lang.String');
|
|
188
185
|
const hexChars = HexClass.encodeHex(byteArray);
|
|
189
|
-
//sendMessage("*", StringClass.$new(hexChars).toString());
|
|
190
|
-
//Buffer.from(bufStr, 'utf8');
|
|
191
|
-
//sendMessage("*", new Uint8Array(byteArray));
|
|
192
186
|
return StringClass.$new(hexChars).toString();
|
|
193
187
|
|
|
194
188
|
}
|
|
195
189
|
|
|
196
|
-
function
|
|
190
|
+
function fusion_getB64StackTrace(){
|
|
197
191
|
|
|
198
192
|
try{
|
|
199
193
|
const StringClass = Java.use('java.lang.String');
|
|
@@ -206,33 +200,18 @@ function getB64StackTrace(){
|
|
|
206
200
|
return b64Msg
|
|
207
201
|
|
|
208
202
|
} catch (err) {
|
|
209
|
-
|
|
203
|
+
fusion_sendMessage("W", err);
|
|
210
204
|
return '';
|
|
211
205
|
}
|
|
212
206
|
}
|
|
213
207
|
|
|
214
|
-
function
|
|
208
|
+
function fusion_printMethods(targetClass)
|
|
215
209
|
{
|
|
216
210
|
var hook = Java.use(targetClass);
|
|
217
211
|
var ownMethods = hook.class.getDeclaredMethods();
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
return ownMethods;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function printMethods(hook)
|
|
224
|
-
{
|
|
225
|
-
var ownMethods = hook.class.getDeclaredMethods();
|
|
226
|
-
ownMethods.forEach(function(s) {
|
|
227
|
-
//sendMessage(s);
|
|
228
|
-
sendMessage('*', s);
|
|
212
|
+
ownMethods.forEach(function(s) {
|
|
213
|
+
fusion_sendMessage('I', s);
|
|
229
214
|
});
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function intToHex(intVal)
|
|
234
|
-
{
|
|
235
|
-
return intVal.toString(16);
|
|
236
215
|
}
|
|
237
216
|
|
|
238
217
|
|
|
@@ -263,7 +242,7 @@ Java.perform(function () {
|
|
|
263
242
|
Thread.setDefaultUncaughtExceptionHandler(UEH.$new());
|
|
264
243
|
});
|
|
265
244
|
|
|
266
|
-
function
|
|
245
|
+
function fusion_formatBacktrace(frames) {
|
|
267
246
|
return frames.map((addr, i) => {
|
|
268
247
|
const sym = DebugSymbol.fromAddress(addr);
|
|
269
248
|
const mod = Process.findModuleByAddress(addr);
|
|
@@ -282,7 +261,7 @@ Process.setExceptionHandler(function (details) {
|
|
|
282
261
|
frames = Thread.backtrace(details.context, Backtracer.FUZZY);
|
|
283
262
|
}
|
|
284
263
|
|
|
285
|
-
const pretty =
|
|
264
|
+
const pretty = fusion_formatBacktrace(frames);
|
|
286
265
|
|
|
287
266
|
send({
|
|
288
267
|
type: "native-exception",
|
|
@@ -302,4 +281,4 @@ Process.setExceptionHandler(function (details) {
|
|
|
302
281
|
return false;
|
|
303
282
|
});
|
|
304
283
|
|
|
305
|
-
|
|
284
|
+
fusion_sendMessage("W", "Helper functions have been successfully initialized.")
|
|
@@ -59,7 +59,7 @@ class Logger(object):
|
|
|
59
59
|
Color.pl(text)
|
|
60
60
|
|
|
61
61
|
@classmethod
|
|
62
|
-
def
|
|
62
|
+
def get_caller_info(cls, stack_index: int = 1) -> ScriptLocation:
|
|
63
63
|
"""Retrieves information about the calling script, function, and line number."""
|
|
64
64
|
# inspect.stack() returns a list of frame records.
|
|
65
65
|
# Each frame record is a tuple containing:
|
|
@@ -133,7 +133,7 @@ class Logger(object):
|
|
|
133
133
|
tag_color = Color.color_tags[dbg_idx]
|
|
134
134
|
|
|
135
135
|
if script_location is None:
|
|
136
|
-
script_location = cls.
|
|
136
|
+
script_location = cls.get_caller_info(stack_index=2)
|
|
137
137
|
|
|
138
138
|
if script_location.file_name == "frida/node_modules/frida-java-bridge/lib/class-factory.js":
|
|
139
139
|
file_name = "frida/.../class-factory.js"
|