forked from noobpk/frida-android-hook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
49 lines (43 loc) · 1.45 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python3
import sys
import os
setup = """#!/usr/bin/python3
import os
import subprocess
import shlex
import sys
from shutil import which
try:
if(which('python3') is not None):
command = shlex.split("python3 " +"core/hook.py")
else:
command = shlex.split("python " +"core/hook.py")
command.extend(sys.argv[1:])
subprocess.call(command, cwd=os.path.dirname(__file__))
except Exception as e:
raise e
"""""
def _buildBinary():
try:
if sys.platform == 'darwin':
with open('frida-android-hook/androidhook','w+', encoding="utf-8") as f:
f.write(setup)
os.system('chmod +x frida-android-hook/androidhook')
print("[+] Build executable for Darwin success.")
elif sys.platform == 'linux':
with open('frida-android-hook/androidhook','w+', encoding="utf-8") as f:
f.write(setup)
os.system('chmod +x frida-android-hook/androidhook')
print("[+] Build executable for Linux success.")
elif sys.platform == 'win32':
with open('frida-android-hook/androidhook.py','w+', encoding="utf-8") as f:
f.write(setup)
print("[+] Build executable for Windows success.")
except Exception as e:
raise e
if __name__ == '__main__':
if sys.version_info < (3, 0):
print("[x_x] Android hook requires Python 3.x")
sys.exit(0)
else:
_buildBinary()