-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist_functions.py
61 lines (56 loc) · 1.5 KB
/
list_functions.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
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/python3
import frida, sys, getopt
packageName = ''
className = ''
def on_message(message,data):
if message['type'] == 'send':
print("[*] {0}".format(message['payload']))
else:
print(message)
def get_code_ready(className):
code= """
Java.perform(function()
{
var a = Java.use(\"""" + className + """\");
var b = Object.getOwnPropertyNames(a.__proto__);
console.log(b.length);
for(i=0;i<b.length;i++)
{
send(b[i]);
}
});
"""
return code
def get_frida_ready(packageName,className):
device = frida.get_usb_device()
pid = device.spawn([packageName])
process = device.attach(pid)
className = packageName+'.'+className
print(className)
finalCode = get_code_ready(className);
script = process.create_script(finalCode)
script.on('message', on_message)
script.load()
device.resume(pid)
sys.stdin.read()
def main(argv):
try:
opts, args = getopt.getopt(argv, "hp:c:",["package=","class="])
except getopt.GetoptError:
print("[*] Usage: python3 master.py -p <package> -c <className>")
sys.exit(2)
if(len(opts) != 2):
print("[*] Usage: python3 master.py -p <package> -c <className>")
sys.exit(2)
for opt, arg in opts:
if(opt == "-h"):
print("[*] Usage: python3 master.py -c <className>")
sys.exit()
elif(opt == "-c"):
className = arg
elif(opt == "-p"):
packageName = arg
print("[*] Searching for the functions inside class:", className, "And Package" , packageName)
get_frida_ready(str(packageName),str(className))
if __name__ == "__main__":
main(sys.argv[1:])