AndroidFridaManager 1.9.1__py3-none-any.whl → 1.9.2__py3-none-any.whl
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.
- AndroidFridaManager/FridaManager.py +63 -10
- AndroidFridaManager/about.py +1 -1
- {androidfridamanager-1.9.1.dist-info → androidfridamanager-1.9.2.dist-info}/METADATA +2 -2
- androidfridamanager-1.9.2.dist-info/RECORD +11 -0
- androidfridamanager-1.9.1.dist-info/RECORD +0 -11
- {androidfridamanager-1.9.1.dist-info → androidfridamanager-1.9.2.dist-info}/WHEEL +0 -0
- {androidfridamanager-1.9.1.dist-info → androidfridamanager-1.9.2.dist-info}/entry_points.txt +0 -0
- {androidfridamanager-1.9.1.dist-info → androidfridamanager-1.9.2.dist-info}/licenses/LICENSE +0 -0
- {androidfridamanager-1.9.1.dist-info → androidfridamanager-1.9.2.dist-info}/top_level.txt +0 -0
|
@@ -41,6 +41,7 @@ class FridaManager():
|
|
|
41
41
|
self.device_socket = socket
|
|
42
42
|
self.verbose = verbose
|
|
43
43
|
self.is_magisk_mode = False
|
|
44
|
+
self.is_adb_root_mode = False # LineageOS adb root mode (adbd runs as root)
|
|
44
45
|
self.frida_install_dst = frida_install_dst
|
|
45
46
|
self._setup_logging()
|
|
46
47
|
self.logger = logging.getLogger(__name__)
|
|
@@ -73,7 +74,10 @@ class FridaManager():
|
|
|
73
74
|
"""Set the target device serial."""
|
|
74
75
|
self._validate_device(serial)
|
|
75
76
|
self._device_serial = serial
|
|
76
|
-
|
|
77
|
+
# Reset cached root status and mode flags for new device
|
|
78
|
+
self._is_rooted = None
|
|
79
|
+
self.is_magisk_mode = False
|
|
80
|
+
self.is_adb_root_mode = False
|
|
77
81
|
|
|
78
82
|
def _setup_logging(self):
|
|
79
83
|
"""
|
|
@@ -308,15 +312,26 @@ class FridaManager():
|
|
|
308
312
|
self.logger.info("[*] frida-server is already running, skipping start")
|
|
309
313
|
return True
|
|
310
314
|
|
|
315
|
+
# Ensure root access is available
|
|
316
|
+
if not self.is_device_rooted():
|
|
317
|
+
self.logger.error("Cannot start frida-server: device is not rooted")
|
|
318
|
+
return False
|
|
319
|
+
|
|
311
320
|
if frida_server_path is self.run_frida_server.__defaults__[0]:
|
|
312
|
-
|
|
321
|
+
frida_bin = self.frida_install_dst + "frida-server"
|
|
313
322
|
else:
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
323
|
+
frida_bin = frida_server_path + "frida-server"
|
|
324
|
+
|
|
325
|
+
# Build the command based on root mode
|
|
326
|
+
if self.is_adb_root_mode:
|
|
327
|
+
# ADB root mode (LineageOS): run directly, adbd is already root
|
|
328
|
+
shell_cmd = f"{frida_bin} &"
|
|
329
|
+
elif self.is_magisk_mode:
|
|
330
|
+
# Magisk mode
|
|
331
|
+
shell_cmd = f"""su -c 'sh -c "{frida_bin} &"'"""
|
|
318
332
|
else:
|
|
319
|
-
|
|
333
|
+
# Traditional su mode
|
|
334
|
+
shell_cmd = f"""su 0 sh -c "{frida_bin} &" """
|
|
320
335
|
|
|
321
336
|
try:
|
|
322
337
|
adb_cmd = self._build_adb_command(['shell', shell_cmd])
|
|
@@ -574,17 +589,27 @@ class FridaManager():
|
|
|
574
589
|
"""
|
|
575
590
|
Run an ADB command as root on the target device.
|
|
576
591
|
|
|
592
|
+
Supports three root modes:
|
|
593
|
+
1. ADB root mode (LineageOS): Commands run directly (adbd is root)
|
|
594
|
+
2. Magisk mode: Uses 'su -c command'
|
|
595
|
+
3. Traditional su: Uses 'su 0 command'
|
|
596
|
+
|
|
577
597
|
:param command: Command to run as root
|
|
578
598
|
:return: subprocess.CompletedProcess with stdout/stderr
|
|
579
599
|
:raises RuntimeError: If device is not rooted
|
|
580
600
|
"""
|
|
581
601
|
if not self.is_device_rooted():
|
|
582
|
-
self.logger.error("Device is not rooted. Please root it before using FridaAndroidManager and ensure that you are able to run commands with the su-binary.")
|
|
602
|
+
self.logger.error("Device is not rooted. Please root it before using FridaAndroidManager and ensure that you are able to run commands with the su-binary or enable ADB root mode.")
|
|
583
603
|
raise RuntimeError("Device not rooted or su binary not accessible")
|
|
584
604
|
|
|
585
|
-
if self.
|
|
605
|
+
if self.is_adb_root_mode:
|
|
606
|
+
# ADB root mode (LineageOS): adbd runs as root, no su needed
|
|
607
|
+
adb_cmd = self._build_adb_command(['shell', command])
|
|
608
|
+
elif self.is_magisk_mode:
|
|
609
|
+
# Magisk mode: use su -c
|
|
586
610
|
adb_cmd = self._build_adb_command(['shell', f'su -c {command}'])
|
|
587
611
|
else:
|
|
612
|
+
# Traditional su mode
|
|
588
613
|
adb_cmd = self._build_adb_command(['shell', f'su 0 {command}'])
|
|
589
614
|
|
|
590
615
|
return subprocess.run(adb_cmd, capture_output=True, text=True)
|
|
@@ -653,11 +678,32 @@ class FridaManager():
|
|
|
653
678
|
|
|
654
679
|
def adb_check_root(self) -> bool:
|
|
655
680
|
"""
|
|
656
|
-
Check if the device has root access
|
|
681
|
+
Check if the device has root access.
|
|
682
|
+
|
|
683
|
+
Supports three root modes:
|
|
684
|
+
1. ADB root mode (LineageOS): adbd runs as root, no su needed
|
|
685
|
+
2. Magisk mode: su -c command
|
|
686
|
+
3. Traditional su: su 0 command
|
|
657
687
|
|
|
658
688
|
:return: True if root is available, False otherwise
|
|
659
689
|
"""
|
|
660
690
|
try:
|
|
691
|
+
# First, check for ADB root mode (LineageOS with "adb root" enabled)
|
|
692
|
+
# In this mode, adbd runs as root and all shell commands are root
|
|
693
|
+
result = subprocess.run(
|
|
694
|
+
self._build_adb_command(['shell', 'id', '-u']),
|
|
695
|
+
capture_output=True,
|
|
696
|
+
text=True,
|
|
697
|
+
timeout=5
|
|
698
|
+
)
|
|
699
|
+
if result.stdout.strip() == "0":
|
|
700
|
+
# Shell is already running as root (adb root mode)
|
|
701
|
+
self.is_adb_root_mode = True
|
|
702
|
+
self.is_magisk_mode = False
|
|
703
|
+
if self.verbose:
|
|
704
|
+
self.logger.info("[*] Detected ADB root mode (adbd running as root)")
|
|
705
|
+
return True
|
|
706
|
+
|
|
661
707
|
# Try Magisk-style su
|
|
662
708
|
result = subprocess.run(
|
|
663
709
|
self._build_adb_command(['shell', 'su -v']),
|
|
@@ -667,6 +713,9 @@ class FridaManager():
|
|
|
667
713
|
)
|
|
668
714
|
if result.stdout.strip():
|
|
669
715
|
self.is_magisk_mode = True
|
|
716
|
+
self.is_adb_root_mode = False
|
|
717
|
+
if self.verbose:
|
|
718
|
+
self.logger.info("[*] Detected Magisk root mode")
|
|
670
719
|
return True
|
|
671
720
|
|
|
672
721
|
# Try traditional su
|
|
@@ -677,6 +726,10 @@ class FridaManager():
|
|
|
677
726
|
timeout=5
|
|
678
727
|
)
|
|
679
728
|
if result.stdout.strip() == "0":
|
|
729
|
+
self.is_magisk_mode = False
|
|
730
|
+
self.is_adb_root_mode = False
|
|
731
|
+
if self.verbose:
|
|
732
|
+
self.logger.info("[*] Detected traditional su root mode")
|
|
680
733
|
return True
|
|
681
734
|
|
|
682
735
|
return False
|
AndroidFridaManager/about.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AndroidFridaManager
|
|
3
|
-
Version: 1.9.
|
|
3
|
+
Version: 1.9.2
|
|
4
4
|
Summary: A python API in order to install and run the frida-server on an Android device.
|
|
5
5
|
Home-page: https://github.com/fkie-cad/AndroidFridaManager
|
|
6
6
|
Author: Daniel Baier
|
|
@@ -33,7 +33,7 @@ Dynamic: requires-dist
|
|
|
33
33
|
Dynamic: requires-python
|
|
34
34
|
Dynamic: summary
|
|
35
35
|
|
|
36
|
-
 [](https://badge.fury.io/py/AndroidFridaManager) [](https://github.com/fkie-cad/AndroidFridaManager/actions/workflows/publish-to-pypi.yml)
|
|
37
37
|
|
|
38
38
|
# AndroidFridaManager
|
|
39
39
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
AndroidFridaManager/FridaManager.py,sha256=QonEFHpI5YTWWmHPrHGiUNuF-V0V_5qUC1GQ1yMx_Gg,31522
|
|
2
|
+
AndroidFridaManager/__init__.py,sha256=T6AKtrGSLQ9M5bJoWDQcsRTJbSEbksdgrx3AAAdozRI,171
|
|
3
|
+
AndroidFridaManager/about.py,sha256=eT4HT7KJGOEnLNu9eam06-A_1n_ZVYAexp02TRRRW6o,98
|
|
4
|
+
AndroidFridaManager/job.py,sha256=1NNcfCjkyUtwUkMXSgT4uswA8UStHo3jxbeJwJoWhc8,3352
|
|
5
|
+
AndroidFridaManager/job_manager.py,sha256=S3biHhYrk-DUUfrHA-g8vbOqwgl4FnWELrUjMxsFyG8,15983
|
|
6
|
+
androidfridamanager-1.9.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
7
|
+
androidfridamanager-1.9.2.dist-info/METADATA,sha256=P8k6Nsb_aqnsh_cqzFixy2HiIpbs5tQ5LxmkzCfQvFQ,5141
|
|
8
|
+
androidfridamanager-1.9.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
androidfridamanager-1.9.2.dist-info/entry_points.txt,sha256=GmNngu2fDNCxUcquFRegBa7GWknPKG1jsM4lvWeyKnY,64
|
|
10
|
+
androidfridamanager-1.9.2.dist-info/top_level.txt,sha256=oH2lVMSRlghmt-_tVrOEUqvY462P9hd5Ktgp5-1qF3o,20
|
|
11
|
+
androidfridamanager-1.9.2.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
AndroidFridaManager/FridaManager.py,sha256=kdA79LW0idbJnch6HzXt_J115HysG9zVZS_WZQnIutk,29143
|
|
2
|
-
AndroidFridaManager/__init__.py,sha256=T6AKtrGSLQ9M5bJoWDQcsRTJbSEbksdgrx3AAAdozRI,171
|
|
3
|
-
AndroidFridaManager/about.py,sha256=DNJPRvDT-qbeIc-pXeyCemp2PRRwpIdaG2Du3iDNigk,98
|
|
4
|
-
AndroidFridaManager/job.py,sha256=1NNcfCjkyUtwUkMXSgT4uswA8UStHo3jxbeJwJoWhc8,3352
|
|
5
|
-
AndroidFridaManager/job_manager.py,sha256=S3biHhYrk-DUUfrHA-g8vbOqwgl4FnWELrUjMxsFyG8,15983
|
|
6
|
-
androidfridamanager-1.9.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
7
|
-
androidfridamanager-1.9.1.dist-info/METADATA,sha256=rvJB9NrUBVxqx7_j6cQyfE1jHtyx4wyqvA3PEgglOfE,5141
|
|
8
|
-
androidfridamanager-1.9.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
androidfridamanager-1.9.1.dist-info/entry_points.txt,sha256=GmNngu2fDNCxUcquFRegBa7GWknPKG1jsM4lvWeyKnY,64
|
|
10
|
-
androidfridamanager-1.9.1.dist-info/top_level.txt,sha256=oH2lVMSRlghmt-_tVrOEUqvY462P9hd5Ktgp5-1qF3o,20
|
|
11
|
-
androidfridamanager-1.9.1.dist-info/RECORD,,
|
|
File without changes
|
{androidfridamanager-1.9.1.dist-info → androidfridamanager-1.9.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{androidfridamanager-1.9.1.dist-info → androidfridamanager-1.9.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|