frida-fusion 0.1.15__tar.gz → 0.1.16__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.

Files changed (37) hide show
  1. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/PKG-INFO +4 -1
  2. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/README.md +3 -0
  3. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/__meta__.py +2 -2
  4. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/libs/helpers.js +41 -17
  5. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/crypto/crypto.js +136 -14
  6. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/crypto/crypto.py +30 -0
  7. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion.egg-info/PKG-INFO +4 -1
  8. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/LICENSE +0 -0
  9. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/__init__.py +0 -0
  10. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/__main__.py +0 -0
  11. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/args.py +0 -0
  12. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/config.py +0 -0
  13. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/exceptions.py +0 -0
  14. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/fusion.py +0 -0
  15. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/libs/__init__.py +0 -0
  16. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/libs/color.py +0 -0
  17. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/libs/database.py +0 -0
  18. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/libs/logger.py +0 -0
  19. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/libs/scriptlocation.py +0 -0
  20. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/module.py +0 -0
  21. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/__init__.py +0 -0
  22. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/android_setings/__init__.py +0 -0
  23. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/android_setings/settings.js +0 -0
  24. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/android_setings/settings.py +0 -0
  25. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/crypto/__init__.py +0 -0
  26. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/reflection/reflection-stalker.js +0 -0
  27. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/reflection/reflection-stalker.py +0 -0
  28. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/tls_unpinning/__init__.py +0 -0
  29. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion/modules/tls_unpinning/frida_multiple_unpinning.py +0 -0
  30. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion.egg-info/SOURCES.txt +0 -0
  31. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion.egg-info/dependency_links.txt +0 -0
  32. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion.egg-info/entry_points.txt +0 -0
  33. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion.egg-info/requires.txt +0 -0
  34. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/frida_fusion.egg-info/top_level.txt +0 -0
  35. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/pyproject.toml +0 -0
  36. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/setup.cfg +0 -0
  37. {frida_fusion-0.1.15 → frida_fusion-0.1.16}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frida-fusion
3
- Version: 0.1.15
3
+ Version: 0.1.16
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>
@@ -101,6 +101,9 @@ void fusion_printStackTrace();
101
101
  # Print all methods of class 'name'
102
102
  void fusion_printMethods(String name);
103
103
 
104
+ # Get value of a field inside an class instance
105
+ Object fusion_getFieldValue(Object obj, String fieldName);
106
+
104
107
  # Wait until the class 'name' exists in memory to execute the callback function
105
108
  void fusion_waitForClass(String name, CallbackFunction onReady)
106
109
 
@@ -66,6 +66,9 @@ void fusion_printStackTrace();
66
66
  # Print all methods of class 'name'
67
67
  void fusion_printMethods(String name);
68
68
 
69
+ # Get value of a field inside an class instance
70
+ Object fusion_getFieldValue(Object obj, String fieldName);
71
+
69
72
  # Wait until the class 'name' exists in memory to execute the callback function
70
73
  void fusion_waitForClass(String name, CallbackFunction onReady)
71
74
 
@@ -1,8 +1,8 @@
1
- __version__ = '0.1.15'
1
+ __version__ = '0.1.16'
2
2
  __title__ = "Frida Fusion"
3
3
  __description__ = "📱 frida-fusion - runtime mobile exploration"
4
4
  __url__ = "https://github.com/helviojunior/frida-fusion"
5
- __build__ = 0xef43fce
5
+ __build__ = 0xfe136e5
6
6
  __author__ = "Helvio Junior (M4v3r1ck)"
7
7
  __author_email__ = "helvio_junior@hotmail.com"
8
8
  __license__ = "GPL-3.0"
@@ -128,22 +128,26 @@ function fusion_getCallerInfo() {
128
128
  }
129
129
 
130
130
  function fusion_sendKeyValueData(module, items) {
131
- var st = fusion_getB64StackTrace();
132
-
133
- var data = [];
131
+ try{
132
+ var st = fusion_getB64StackTrace();
134
133
 
135
- // Force as String
136
- for (let i = 0; i < items.length; i++) {
137
- data = data.concat([{key: `${items[i].key}`, value:`${items[i].value}`}]);
138
- }
134
+ var data = [];
139
135
 
140
- fusion_Send({
141
- type: "key_value_data",
142
- module: module,
143
- data: data,
144
- stack_trace: st
145
- }, null);
136
+ // Force as String
137
+ for (let i = 0; i < items.length; i++) {
138
+ data = data.concat([{key: `${items[i].key}`, value:`${items[i].value}`}]);
139
+ }
146
140
 
141
+ fusion_Send({
142
+ type: "key_value_data",
143
+ module: module,
144
+ data: data,
145
+ stack_trace: st
146
+ }, null);
147
+ } catch (err) {
148
+ fusion_sendMessage("W", `Error: ${err}`)
149
+ }
150
+ return null;
147
151
  }
148
152
 
149
153
  function fusion_sendMessage(level, message){
@@ -160,7 +164,7 @@ function fusion_sendMessage(level, message){
160
164
  message: b64Msg
161
165
  }, null)
162
166
  } catch (err) {
163
- fusion_sendMessage("W", err)
167
+ fusion_sendMessage("W", `Error: ${err}`)
164
168
  }
165
169
  }
166
170
 
@@ -184,7 +188,7 @@ function fusion_sendMessageWithTrace(level, message){
184
188
  message: b64Msg
185
189
  }, null)
186
190
  } catch (err) {
187
- fusion_sendMessage("W", err)
191
+ fusion_sendMessage("W", `Error: ${err}`)
188
192
  }
189
193
  }
190
194
 
@@ -218,7 +222,7 @@ function fusion_getB64StackTrace(){
218
222
  return b64Msg
219
223
 
220
224
  } catch (err) {
221
- fusion_sendMessage("W", err);
225
+ fusion_sendMessage("W", `Error: ${err}`)
222
226
  return '';
223
227
  }
224
228
  }
@@ -256,12 +260,32 @@ function fusion_getClassName(obj)
256
260
  // Se for algo não Java, apenas retorna tipo do JS
257
261
  return typeof obj;
258
262
  } catch (err) {
259
- fusion_sendMessage("W", err);
263
+ fusion_sendMessage("W", `Error: ${err}`)
260
264
  return '';
261
265
  }
262
266
 
263
267
  }
264
268
 
269
+ function fusion_getFieldValue(obj, fieldName) {
270
+ if (obj === null || obj === undefined) return "";
271
+ try {
272
+ var cls = obj.getClass();
273
+ while (cls != null) {
274
+ try {
275
+ var f = cls.getDeclaredField(fieldName);
276
+ f.setAccessible(true);
277
+ return f.get(obj);
278
+ } catch (e) {
279
+ cls = cls.getSuperclass();
280
+ }
281
+ }
282
+ } catch (err) {
283
+ fusion_sendMessage("W", `Error: ${err}`)
284
+ return '';
285
+ }
286
+ }
287
+
288
+
265
289
  function fusion_getReadableRange(p) {
266
290
  try { p = ptr(p); } catch (_) { return null; }
267
291
  const range = Process.findRangeByAddress(p); // não lança exceção
@@ -3,7 +3,8 @@ const CRYPTO_MODULES = {
3
3
  KeyGenerator: true,
4
4
  KeyPairGenerator: true,
5
5
  SecretKeySpec: true,
6
- MessageDigest: true,
6
+ MessageDigest: false,
7
+ KeyFactory: true,
7
8
  SecretKeyFactory: true,
8
9
  Signature: true,
9
10
  Cipher: true,
@@ -12,7 +13,7 @@ const CRYPTO_MODULES = {
12
13
  IvParameterSpec: true,
13
14
  GCMParameterSpec: true,
14
15
  PBEParameterSpec: true,
15
- X509EncodedKeySpec: true
16
+ X509EncodedKeySpec: true,
16
17
  };
17
18
 
18
19
  setTimeout(function() {
@@ -144,6 +145,53 @@ setTimeout(function() {
144
145
 
145
146
  }
146
147
 
148
+ if (CRYPTO_MODULES.KeyFactory) {
149
+ fusion_sendMessage('*', "Module attached: java.security.KeyFactory");
150
+ const keyFactory = Java.use("java.security.KeyFactory");
151
+ keyFactory.getInstance.overload("java.lang.String").implementation = function (arg0) {
152
+ fusion_sendKeyValueData("KeyFactory.getInstance", [
153
+ {key: "Algorithm", value: arg0}
154
+ ]);
155
+ return this.getInstance(arg0);
156
+ };
157
+
158
+ keyFactory.getInstance.overload("java.lang.String", "java.lang.String").implementation = function (arg0, arg1) {
159
+ fusion_sendKeyValueData("KeyFactory.getInstance", [
160
+ {key: "Algorithm", value: arg0},
161
+ {key: "Provider", value: arg1}
162
+ ]);
163
+ return this.getInstance(arg0, arg1);
164
+ };
165
+
166
+ keyFactory.getInstance.overload("java.lang.String", "java.security.Provider").implementation = function (arg0, arg1) {
167
+ fusion_sendKeyValueData("KeyFactory.getInstance", [
168
+ {key: "Algorithm", value: arg0},
169
+ {key: "Provider", value: arg1}
170
+ ]);
171
+ return this.getInstance(arg0, arg1);
172
+ };
173
+
174
+
175
+ keyFactory.generatePrivate.overload('java.security.spec.KeySpec').implementation = function (keySpec) {
176
+ fusion_sendKeyValueData("KeyFactory.generatePrivate", [
177
+ {key: "ClassType", value: fusion_getClassName(this)},
178
+ {key: "KeySpecClassType", value: fusion_getClassName(keySpec)},
179
+ {key: "Algorithm", value: this.getAlgorithm()},
180
+ {key: "Key", value: fusion_keyToBase64(keySpec)},
181
+ ]);
182
+ return this.generatePrivate(keySpec);
183
+ };
184
+
185
+ keyFactory.generatePublic.overload('java.security.spec.KeySpec').implementation = function (keySpec) {
186
+ fusion_sendKeyValueData("KeyFactory.generatePublic", [
187
+ {key: "ClassType", value: fusion_getClassName(this)},
188
+ {key: "KeySpecClassType", value: fusion_getClassName(keySpec)},
189
+ {key: "Algorithm", value: this.getAlgorithm()},
190
+ ]);
191
+ return this.generatePublic(keySpec);
192
+ };
193
+ }
194
+
147
195
  if (CRYPTO_MODULES.SecretKeyFactory) {
148
196
  fusion_sendMessage('*', "Module attached: javax.crypto.SecretKeyFactory");
149
197
  const secretKeyFactory = Java.use("javax.crypto.SecretKeyFactory");
@@ -281,26 +329,73 @@ setTimeout(function() {
281
329
  }
282
330
 
283
331
  cipher.getInstance.overload("java.lang.String").implementation = function (arg0) {
284
- fusion_sendKeyValueData("cipher.getInstance", [
332
+
333
+ var data = [
285
334
  {key: "Algorithm", value: arg0}
286
- ]);
287
- return this.getInstance(arg0);
335
+ ];
336
+
337
+ var instance = this.getInstance(arg0);
338
+ try{
339
+ data = data.concat([
340
+ {key: "HashCode", value: instance.hashCode().toString()},
341
+ ]);
342
+ data = data.concat([
343
+ {key: "Algorithm", value: instance.getAlgorithm()}
344
+ ]);
345
+ } catch (err1) {
346
+ fusion_sendError(err1)
347
+ }
348
+
349
+ fusion_sendKeyValueData("cipher.getInstance", data);
350
+ return instance;
288
351
  };
289
352
 
290
353
  cipher.getInstance.overload("java.lang.String", "java.lang.String").implementation = function (arg0, arg1) {
291
- fusion_sendKeyValueData("cipher.getInstance", [
354
+
355
+ var data = [
292
356
  {key: "Algorithm", value: arg0},
293
357
  {key: "Provider", value: arg1}
294
- ]);
295
- return this.getInstance(arg0, arg1);
358
+ ];
359
+
360
+ var instance = this.getInstance(arg0, arg1);
361
+ try{
362
+ data = data.concat([
363
+ {key: "HashCode", value: instance.hashCode().toString()},
364
+ ]);
365
+ data = data.concat([
366
+ {key: "Algorithm", value: instance.getAlgorithm()}
367
+ ]);
368
+ } catch (err1) {
369
+ fusion_sendError(err1)
370
+ }
371
+
372
+ fusion_sendKeyValueData("cipher.getInstance", data);
373
+ return instance;
374
+
296
375
  };
297
376
 
298
377
  cipher.getInstance.overload("java.lang.String", "java.security.Provider").implementation = function (arg0, arg1) {
299
- fusion_sendKeyValueData("cipher.getInstance", [
378
+
379
+ var data = [
300
380
  {key: "Algorithm", value: arg0},
301
381
  {key: "Provider", value: arg1}
302
- ]);
303
- return this.getInstance(arg0, arg1);
382
+ ];
383
+
384
+ var instance = this.getInstance(arg0, arg1);
385
+ try{
386
+ data = data.concat([
387
+ {key: "HashCode", value: instance.hashCode().toString()},
388
+ ]);
389
+ data = data.concat([
390
+ {key: "Algorithm", value: instance.getAlgorithm()}
391
+ ]);
392
+ } catch (err1) {
393
+ fusion_sendError(err1)
394
+ }
395
+
396
+ fusion_sendKeyValueData("cipher.getInstance", data);
397
+ return instance;
398
+
304
399
  };
305
400
 
306
401
  cipher.doFinal.overload("[B").implementation = function (arg0) {
@@ -568,12 +663,39 @@ setTimeout(function() {
568
663
 
569
664
  function fusion_keyToBase64(key){
570
665
  if (key === null || key === undefined) return "IA==";
666
+ const cName = fusion_getClassName(key);
571
667
  try{
668
+
669
+ try{
670
+ if (cName == "java.security.spec.RSAPrivateKeySpec" || (cName == "javax.crypto.spec.SecretKeySpec" && key.getAlgorithm() == "RSA")){
671
+ return {
672
+ classType: cName,
673
+ modulus: key.getModulus(),
674
+ privateExponent: key.getPrivateExponent(),
675
+ }
676
+ }
677
+ } catch (e1) {}
678
+
679
+ /*
680
+ const cName = fusion_getClassName(key);
681
+
682
+ if ("com.android.org.conscrypt.OpenSSLRSAPrivateKey" == cName) return "IA==";
683
+
684
+ fusion_sendMessageWithTrace("W", "fusion_keyToBase64\n" + fusion_getClassName(key));
685
+
686
+ if ("javax.crypto.spec.SecretKeySpec" == cName) {
687
+ var algo = key.getAlgorithm();
688
+ if (algo == "AES") return "IA==";
689
+ }
690
+
691
+ var tst = key.getEncoded();
692
+ fusion_sendMessageWithTrace("W", "fusion_keyToBase64\n" + fusion_getClassName(tst));
693
+ */
572
694
 
573
- return fusion_bytesToBase64(key.getEncoded())
695
+ return fusion_bytesToBase64(key.getEncoded());
574
696
 
575
697
  } catch (err) {
576
- fusion_sendMessage("W", err);
577
- return "IA==";
698
+ //fusion_sendMessage("W", `Error: ${err}`)
699
+ return fusion_stringToBase64(`Error getting key from class (${cName}): ${err}`);
578
700
  }
579
701
  }
@@ -457,6 +457,24 @@ class Crypto(ModuleBase):
457
457
  message=f"Cipher init received\nHashcode: {hashcode}\nOpmode: {opmode}\nKeytype: {key_class}",
458
458
  script_location=script_location
459
459
  )
460
+
461
+ elif module == "cipher.getInstance":
462
+ hashcode = received_data.get('hashcode', None)
463
+ algorithm = received_data.get('algorithm', None)
464
+
465
+ self._crypto_db.insert_crypto(
466
+ package=self._package,
467
+ hashcode=hashcode,
468
+ algorithm=algorithm,
469
+ init_key=None
470
+ )
471
+
472
+ if not self._suppress_messages:
473
+ Logger.print_message(
474
+ level="D",
475
+ message=f"Cipher getInstance received\n{stack_trace}",
476
+ script_location=script_location
477
+ )
460
478
 
461
479
  elif module == "cipher.doFinal":
462
480
  hashcode = received_data.get('hashcode', None)
@@ -516,6 +534,18 @@ class Crypto(ModuleBase):
516
534
  script_location=script_location
517
535
  )
518
536
 
537
+ elif module == "KeyFactory.generatePrivate":
538
+ #print(received_data)
539
+ pass
540
+
541
+ elif module == "KeyFactory.generatePublic":
542
+ #print(received_data)
543
+ pass
544
+
545
+ elif module == "org.bouncycastle.asn1!init":
546
+ #print(received_data)
547
+ pass
548
+
519
549
  return True
520
550
 
521
551
  def data_event(self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frida-fusion
3
- Version: 0.1.15
3
+ Version: 0.1.16
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>
@@ -101,6 +101,9 @@ void fusion_printStackTrace();
101
101
  # Print all methods of class 'name'
102
102
  void fusion_printMethods(String name);
103
103
 
104
+ # Get value of a field inside an class instance
105
+ Object fusion_getFieldValue(Object obj, String fieldName);
106
+
104
107
  # Wait until the class 'name' exists in memory to execute the callback function
105
108
  void fusion_waitForClass(String name, CallbackFunction onReady)
106
109
 
File without changes
File without changes
File without changes