forked from Ch0pin/medusa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mango.py
executable file
·118 lines (92 loc) · 3.24 KB
/
mango.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
from androguard.misc import AnalyzeAPK
from androguard.core.bytecodes import apk
from colorama import Fore, Back, Style
from libraries.IntentFilter import *
from libraries.libmango import *
from libraries.db import *
from libraries.Questions import *
from libraries.libguava import *
from libraries.libadb import *
import hashlib
import sys, os.path
def print_logo():
print(Style.BRIGHT+"""
Welcome to:
.-'''-.
' _ \
__ __ ___ _..._ / /` '. \
| |/ `.' `. .' '. .--./). | \ '
| .-. .-. ' . .-. . /.''\\ | ' | '
| | | | | | __ | ' ' || | | |\ \ / /
| | | | | | .:--.'. | | | | \`-' / `. ` ..' /
| | | | | |/ | \ | | | | | /("'` '-...-'`
| | | | | |`" __ | | | | | | \ '---.
|__| |__| |__| .'.''| | | | | | /'""'.\
/ / | |_| | | | || ||
\ \._,\ '/| | | | \'. __//
`--' `" '--' '--' `'---' """+Style.RESET_ALL)
def get_device_or_emulator_id():
try:
print(Fore.GREEN)
print("[i] Available devices:\n")
devices = frida.enumerate_devices()
i = 0
for dv in devices:
print('{}) {}'.format(i,dv))
i += 1
print(Fore.RESET)
j = int(Numeric('\nEnter the index of the device you want to use:', lbound=0,ubound=i-1).ask())
device = devices[int(j)]
android_dev = android_device(device.id)
android_dev.print_dev_properties()
print(Fore.RESET)
return device
except Exception as e:
print(e)
return None
def start_session(db_session,existing = False):
application_database = apk_db(db_session)
guava = Guava(application_database)
p = parser()
p.database = application_database
p.guava = guava
if existing:
p.continue_session(guava)
p.device = get_device_or_emulator_id()
p.cmdloop()
if __name__ == "__main__":
print_logo()
if len(sys.argv) > 1:
session = sys.argv[1]
if os.path.exists(session):
start_session(session, True)
else:
print(Fore.RED+"[!] Fatal: can't find: {} ".format(session)+Fore.RESET)
sys.exit()
else:
menu = {}
menu['1']="Start a new session"
menu['2']="Continue an existing session"
menu['3']="Exit"
while True:
print("-"*50 + "\n[?] What do you want to do ?\n"+"-"*50)
options=menu.keys()
for entry in options:
print(entry, menu[entry])
selection=input("\n[?] Enter your selection: ")
if selection =='1':
session = input("\n[?] Enter a session name: ")
start_session(session)
break
elif selection == '2':
session = input("\n[?] Enter full path to the session file: ")
if os.path.exists(session):
start_session(session, True)
else:
print(Fore.RED+"[!] Fatal: can't find: {} ".format(session)+Fore.RESET)
sys.exit()
break
elif selection == '3':
sys.exit()
else:
print("[!] Unknown Option Selected!")