AndroidFridaManager 1.7.8__py3-none-any.whl → 1.8.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 +38 -30
- AndroidFridaManager/about.py +1 -1
- AndroidFridaManager/job.py +1 -1
- AndroidFridaManager/job_manager.py +5 -3
- {AndroidFridaManager-1.7.8.dist-info → androidfridamanager-1.8.2.dist-info}/METADATA +15 -3
- androidfridamanager-1.8.2.dist-info/RECORD +11 -0
- {AndroidFridaManager-1.7.8.dist-info → androidfridamanager-1.8.2.dist-info}/WHEEL +1 -1
- AndroidFridaManager-1.7.8.dist-info/RECORD +0 -11
- {AndroidFridaManager-1.7.8.dist-info → androidfridamanager-1.8.2.dist-info}/entry_points.txt +0 -0
- {AndroidFridaManager-1.7.8.dist-info → androidfridamanager-1.8.2.dist-info/licenses}/LICENSE +0 -0
- {AndroidFridaManager-1.7.8.dist-info → androidfridamanager-1.8.2.dist-info}/top_level.txt +0 -0
|
@@ -15,8 +15,6 @@ from shutil import copyfile
|
|
|
15
15
|
import tempfile
|
|
16
16
|
import argparse
|
|
17
17
|
|
|
18
|
-
warnings.filterwarnings("error")
|
|
19
|
-
|
|
20
18
|
# some parts are taken from ttps://github.com/Mind0xP/Frida-Python-Binding/
|
|
21
19
|
|
|
22
20
|
class FridaManager():
|
|
@@ -44,37 +42,45 @@ class FridaManager():
|
|
|
44
42
|
self.logger = logging.getLogger(__name__)
|
|
45
43
|
|
|
46
44
|
if self.is_remote:
|
|
47
|
-
frida.get_device_manager().add_remote_device(self.
|
|
45
|
+
frida.get_device_manager().add_remote_device(self.device_socket)
|
|
48
46
|
|
|
49
47
|
|
|
50
48
|
def _setup_logging(self):
|
|
51
49
|
"""
|
|
52
50
|
Setup logging for the current instance of FridaManager
|
|
53
|
-
|
|
54
51
|
"""
|
|
55
52
|
logger = logging.getLogger()
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
'
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
53
|
+
|
|
54
|
+
# Check if the logger already has handlers (i.e., if another project has set it up)
|
|
55
|
+
if not logger.handlers:
|
|
56
|
+
logger.setLevel(logging.INFO)
|
|
57
|
+
color_formatter = ColoredFormatter(
|
|
58
|
+
"%(log_color)s[%(asctime)s] [%(levelname)-4s]%(reset)s - %(message)s",
|
|
59
|
+
datefmt='%d-%m-%y %H:%M:%S',
|
|
60
|
+
reset=True,
|
|
61
|
+
log_colors={
|
|
62
|
+
'DEBUG': 'cyan',
|
|
63
|
+
'INFO': 'green',
|
|
64
|
+
'WARNING': 'bold_yellow',
|
|
65
|
+
'ERROR': 'bold_red',
|
|
66
|
+
'CRITICAL': 'bold_red',
|
|
67
|
+
},
|
|
68
|
+
secondary_log_colors={},
|
|
69
|
+
style='%')
|
|
70
|
+
logging_handler = logging.StreamHandler()
|
|
71
|
+
logging_handler.setFormatter(color_formatter)
|
|
72
|
+
logger.addHandler(logging_handler)
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
def run_frida_server(self, frida_server_path="/data/local/tmp/"):
|
|
78
|
+
# Check if frida-server is already running
|
|
79
|
+
if self.is_frida_server_running():
|
|
80
|
+
if self.verbose:
|
|
81
|
+
self.logger.info("[*] frida-server is already running, skipping start")
|
|
82
|
+
return
|
|
83
|
+
|
|
78
84
|
if frida_server_path is self.run_frida_server.__defaults__[0]:
|
|
79
85
|
cmd = self.frida_install_dst + "frida-server &"
|
|
80
86
|
else:
|
|
@@ -223,13 +229,15 @@ class FridaManager():
|
|
|
223
229
|
try:
|
|
224
230
|
res = requests.get(url)
|
|
225
231
|
except requests.exceptions.RequestException as e:
|
|
226
|
-
self.logger.error("
|
|
227
|
-
|
|
232
|
+
self.logger.error(f"Error making request to {url}: {e}")
|
|
233
|
+
raise RuntimeError(f"Failed to fetch Frida release information: {e}")
|
|
228
234
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
235
|
+
with warnings.catch_warnings():
|
|
236
|
+
warnings.simplefilter("ignore", SyntaxWarning)
|
|
237
|
+
try:
|
|
238
|
+
frida_server_path = re.findall(r'\/download\/\d+\.\d+\.\d+\/frida\-server\-\d+\.\d+\.\d+\-android\-'+arch+'\.xz',res.text)
|
|
239
|
+
except SyntaxWarning:
|
|
240
|
+
frida_server_path = re.findall(r'/download/\d+\.\d+\.\d+/frida-server-\d+\.\d+\.\d+-android-' + arch + r'\.xz', res.text)
|
|
233
241
|
|
|
234
242
|
final_url = frida_download_prefix + frida_server_path[0]
|
|
235
243
|
|
|
@@ -243,7 +251,7 @@ class FridaManager():
|
|
|
243
251
|
return final_url
|
|
244
252
|
|
|
245
253
|
|
|
246
|
-
def make_frida_server_executable(self, frida_server_path="/data/
|
|
254
|
+
def make_frida_server_executable(self, frida_server_path="/data/local/tmp/"):
|
|
247
255
|
if frida_server_path is self.make_frida_server_executable.__defaults__[0]:
|
|
248
256
|
cmd = self.frida_install_dst + "frida-server"
|
|
249
257
|
else:
|
|
@@ -262,8 +270,8 @@ class FridaManager():
|
|
|
262
270
|
|
|
263
271
|
def run_adb_command_as_root(self,command):
|
|
264
272
|
if self.adb_check_root() == False:
|
|
265
|
-
self.logger.error("
|
|
266
|
-
|
|
273
|
+
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.")
|
|
274
|
+
raise RuntimeError("Device not rooted or su binary not accessible")
|
|
267
275
|
|
|
268
276
|
if self.is_magisk_mode:
|
|
269
277
|
output = subprocess.run(['adb', 'shell','su -c '+command], capture_output=True, text=True)
|
AndroidFridaManager/about.py
CHANGED
AndroidFridaManager/job.py
CHANGED
|
@@ -45,7 +45,7 @@ class Job:
|
|
|
45
45
|
self.script.on("message", self.wrap_custom_hooking_handler_with_job_id(self.custom_hooking_handler))
|
|
46
46
|
self.script.load()
|
|
47
47
|
self.state = "running"
|
|
48
|
-
print("[+] hooks
|
|
48
|
+
print("[+] hooks successfully loaded")
|
|
49
49
|
|
|
50
50
|
#if self.is_running_as_thread:
|
|
51
51
|
# Keep the thread alive to handle messages until stop_event is set
|
|
@@ -256,7 +256,7 @@ class JobManager(object):
|
|
|
256
256
|
if job_id in self.jobs:
|
|
257
257
|
return self.jobs[job_id]
|
|
258
258
|
else:
|
|
259
|
-
raise ValueError(f"Job
|
|
259
|
+
raise ValueError(f"Job with ID {job_id} not found.")
|
|
260
260
|
|
|
261
261
|
|
|
262
262
|
def detach_from_app(self):
|
|
@@ -299,13 +299,15 @@ class JobManager(object):
|
|
|
299
299
|
# to handle forks
|
|
300
300
|
def on_child_added(child):
|
|
301
301
|
print(f"Attached to child process with pid {child.pid}")
|
|
302
|
-
self.first_instrumenation_script
|
|
302
|
+
if callable(self.first_instrumenation_script):
|
|
303
|
+
self.first_instrumenation_script(device.attach(child.pid))
|
|
303
304
|
device.resume(child.pid)
|
|
304
305
|
|
|
305
306
|
# if the target process is starting another process
|
|
306
307
|
def on_spawn_added(spawn):
|
|
307
308
|
print(f"Process spawned with pid {spawn.pid}. Name: {spawn.identifier}")
|
|
308
|
-
self.first_instrumenation_script
|
|
309
|
+
if callable(self.first_instrumenation_script):
|
|
310
|
+
self.first_instrumenation_script(device.attach(spawn.pid))
|
|
309
311
|
device.resume(spawn.pid)
|
|
310
312
|
|
|
311
313
|
device.on("child_added", on_child_added)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: AndroidFridaManager
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.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
|
|
@@ -17,9 +17,21 @@ Classifier: Topic :: Software Development :: Debuggers
|
|
|
17
17
|
Requires-Python: >=3.6
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: frida
|
|
20
|
+
Requires-Dist: frida>=15.0.0
|
|
21
21
|
Requires-Dist: colorlog
|
|
22
22
|
Requires-Dist: requests
|
|
23
|
+
Dynamic: author
|
|
24
|
+
Dynamic: author-email
|
|
25
|
+
Dynamic: classifier
|
|
26
|
+
Dynamic: description
|
|
27
|
+
Dynamic: description-content-type
|
|
28
|
+
Dynamic: home-page
|
|
29
|
+
Dynamic: keywords
|
|
30
|
+
Dynamic: license
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
Dynamic: requires-dist
|
|
33
|
+
Dynamic: requires-python
|
|
34
|
+
Dynamic: summary
|
|
23
35
|
|
|
24
36
|
[](https://badge.fury.io/py/AndroidFridaManager)
|
|
25
37
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
AndroidFridaManager/FridaManager.py,sha256=tuDTZQ9maNBkobw2-qJtWPM3bhUQZH7eKPXG5XAKPks,13837
|
|
2
|
+
AndroidFridaManager/__init__.py,sha256=T6AKtrGSLQ9M5bJoWDQcsRTJbSEbksdgrx3AAAdozRI,171
|
|
3
|
+
AndroidFridaManager/about.py,sha256=z1dlTh519qWYEK_J_iuyx6_2eEzRI_pdKsVpVgi_DLA,98
|
|
4
|
+
AndroidFridaManager/job.py,sha256=QTSNjdV7XqawSTV19HQt53aiwoT3UaQeQw2K4AWPxY8,3265
|
|
5
|
+
AndroidFridaManager/job_manager.py,sha256=icdNlfqorEM3XVw4h_83IcoupEFDlkzb29VhEZ6dxrQ,12294
|
|
6
|
+
androidfridamanager-1.8.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
7
|
+
androidfridamanager-1.8.2.dist-info/METADATA,sha256=serVQrmt0u7xH5F8wYqBQ1NOMMRqT4g_cvn5vnxT8mc,4886
|
|
8
|
+
androidfridamanager-1.8.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
androidfridamanager-1.8.2.dist-info/entry_points.txt,sha256=GmNngu2fDNCxUcquFRegBa7GWknPKG1jsM4lvWeyKnY,64
|
|
10
|
+
androidfridamanager-1.8.2.dist-info/top_level.txt,sha256=oH2lVMSRlghmt-_tVrOEUqvY462P9hd5Ktgp5-1qF3o,20
|
|
11
|
+
androidfridamanager-1.8.2.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
AndroidFridaManager/FridaManager.py,sha256=Q8Cl4DzHMhN1Qr_N79qaFXYsow-1ZwHkBG2o4heCVV0,13181
|
|
2
|
-
AndroidFridaManager/__init__.py,sha256=T6AKtrGSLQ9M5bJoWDQcsRTJbSEbksdgrx3AAAdozRI,171
|
|
3
|
-
AndroidFridaManager/about.py,sha256=P4SyBf98HuVqcR5-_TO3EGsvdMjr6-yrFLfIYJRSSAo,97
|
|
4
|
-
AndroidFridaManager/job.py,sha256=NWgU7RzheNfEazL8CcmAIoVwylTdEDNbTPqmiAY7ZhY,3264
|
|
5
|
-
AndroidFridaManager/job_manager.py,sha256=f4ByEiAU8I6JUz7eNrdk8hnaD9VUJW3D-dtX79eEu68,12164
|
|
6
|
-
AndroidFridaManager-1.7.8.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
7
|
-
AndroidFridaManager-1.7.8.dist-info/METADATA,sha256=EL_2HOx2RCFm1ZSAOtxYWH8JH4ZX7Y0R_b4b2KdfoJE,4633
|
|
8
|
-
AndroidFridaManager-1.7.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
9
|
-
AndroidFridaManager-1.7.8.dist-info/entry_points.txt,sha256=GmNngu2fDNCxUcquFRegBa7GWknPKG1jsM4lvWeyKnY,64
|
|
10
|
-
AndroidFridaManager-1.7.8.dist-info/top_level.txt,sha256=oH2lVMSRlghmt-_tVrOEUqvY462P9hd5Ktgp5-1qF3o,20
|
|
11
|
-
AndroidFridaManager-1.7.8.dist-info/RECORD,,
|
{AndroidFridaManager-1.7.8.dist-info → androidfridamanager-1.8.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{AndroidFridaManager-1.7.8.dist-info → androidfridamanager-1.8.2.dist-info/licenses}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|