1
+ """
2
+ A tool for exploiting android devices from adb
3
+ Usage:
4
+ For usage instructions execute the following lines:
5
+ >>> python main.py -help
6
+ """
1
7
import os
2
8
import sys
3
9
import time
@@ -28,7 +34,7 @@ def devices(self):
28
34
table .add_column ("Model" , style = "magenta" )
29
35
table .add_column ("Name" , style = "magenta" )
30
36
for d in adbutils .adb .device_list ():
31
- table .add_row (d .serial ,d .prop .model ,d .prop .name )
37
+ table .add_row (d .serial , d .prop .model , d .prop .name )
32
38
console = Console ()
33
39
console .print (table )
34
40
@@ -61,23 +67,29 @@ def list_forward(self, device='all'):
61
67
console = Console ()
62
68
console .print (table )
63
69
70
+ def forward (self , device , local , remote ):
71
+ Utils .banner ()
72
+ d = adbutils .adb .device (device )
73
+ d .forward (local , remote )
74
+ print (Fore .GREEN + "The port forward is now active..." )
64
75
65
76
def wifi (self , device , state ):
66
77
Utils .banner ()
67
78
d = adbutils .adb .device (device )
68
79
if state == 'on' :
69
80
d .shell ('svc wifi enable' )
70
- print (Fore .GREEN + 'The wifi is now enabled on the device' )
81
+ print (Fore .GREEN + 'The wifi is now enabled on the device' )
71
82
else :
72
83
d .shell ('svc wifi disable' )
73
- print (Fore .GREEN + 'The wifi is now disabled on the device. To turn wifi back on, you need to plugged in the device' )
84
+ print (
85
+ Fore .GREEN + 'The wifi is now disabled on the device. To turn wifi back on, you need to plugged in the device' )
74
86
75
- def dumpsys (self ,device ):
87
+ def dumpsys (self , device ):
76
88
Utils .banner ()
77
89
d = adbutils .adb .device (device )
78
90
print (d .shell (device + ' dumpsys' ))
79
91
80
- def list_apps (self ,device ):
92
+ def list_apps (self , device ):
81
93
Utils .banner ()
82
94
d = adbutils .adb .device (device )
83
95
apps = d .list_packages ()
@@ -94,12 +106,12 @@ def wpa_supplicant(self, device):
94
106
d = adbutils .adb .device (device )
95
107
d .shell ("su -c 'cp /data/misc/wifi/wpa_supplicant.conf /sdcard/'" )
96
108
d .sync .pull ("/sdcard/wpa_supplicant.conf" , "wpa_supplicant.conf" )
97
- #d.shell(device + " pull /sdcard/wpa_supplicant.conf "+location)
109
+ # d.shell(device + " pull /sdcard/wpa_supplicant.conf "+location)
98
110
print (Fore .GREEN + 'WPA Supplicant exported corerctly' )
99
111
except :
100
- print (Fore .RED + 'An error has been ocurred grabbing the wpa_supplicant' )
112
+ print (Fore .RED + 'An error has been ocurred grabbing the wpa_supplicant' )
101
113
102
- def install (self , device ,apk ):
114
+ def install (self , device , apk ):
103
115
try :
104
116
Utils .banner ()
105
117
d = adbutils .adb .device (device )
@@ -117,16 +129,15 @@ def install_remote(self, device, url):
117
129
except :
118
130
print (Fore .RED + 'An error has been occurred installing the APK. Check the path or the error related' )
119
131
120
-
121
132
def uninstall (self , device , app ):
122
133
try :
123
134
Utils .banner ()
124
135
d = adbutils .adb .device (device )
125
136
d .uninstall (app )
126
137
print (Fore .GREEN + 'APK uninstalled successfully' )
127
138
except :
128
- print (Fore . RED + 'An error has been occurred uninstalling the APK. Check the package name or the error related' )
129
-
139
+ print (
140
+ Fore . RED + 'An error has been occurred uninstalling the APK. Check the package name or the error related' )
130
141
131
142
def shell (self , device , command ):
132
143
Utils .banner ()
@@ -158,10 +169,103 @@ def get_folder(self, device, path, name):
158
169
d .shell ("su -c 'cp /data/misc/wifi/wpa_supplicant.conf /sdcard/'" )
159
170
d .sync .pull (path , name )
160
171
161
- def logs (self , device ):
172
+ def logs (self , device , app = "all" ):
173
+ Utils .banner ()
174
+ if app == "all" :
175
+ os .system ('adb -s ' + device + " logcat " )
176
+ else :
177
+ os .system ('adb -s ' + device + " logcat " + "app" )
178
+
179
+ def start_app (self ):
180
+ Utils .banner ()
181
+
182
+ def stop_app (self ):
183
+ Utils .banner ()
184
+
185
+ def clear_app (self ):
186
+ Utils .banner ()
187
+
188
+ def show_ip (self ):
189
+ Utils .banner ()
190
+
191
+ def extract_app (self ):
192
+ Utils .banner ()
193
+
194
+ def battery (self ):
195
+ Utils .banner ()
196
+
197
+ def netstat (self ):
198
+ Utils .banner ()
199
+
200
+ def airplane (self ):
201
+ Utils .banner ()
202
+
203
+ def sound (self ):
204
+ Utils .banner ()
205
+
206
+ def keycode (self ):
207
+ Utils .banner ()
208
+
209
+ def current_app (self ):
210
+ Utils .banner ()
211
+
212
+ def send_key (self ):
213
+ Utils .banner ()
214
+
215
+ def check_screen (self ):
216
+ Utils .banner ()
217
+
218
+ def dump_hierarchy (self , device ):
219
+ Utils .banner ()
220
+ d = adbutils .adb .device (device )
221
+ print (Fore .GREEN + d .dump_hierarchy ())
222
+
223
+ def key_event (self ):
224
+ Utils .banner ()
225
+
226
+ def open_browser (self , device , url ):
162
227
Utils .banner ()
163
228
d = adbutils .adb .device (device )
229
+ d .open_browser (url )
230
+ print (Fore .GREEN + 'The url is opening...' )
231
+
232
+ def remove (self ):
233
+ Utils .banner ()
234
+
235
+ def rotation (self ):
236
+ Utils .banner ()
237
+
238
+ def swipe (self ):
239
+ Utils .banner ()
240
+
241
+ def switch_screen (self ):
242
+ Utils .banner ()
243
+
244
+ def show_ip (self ):
245
+ Utils .banner ()
246
+
247
+ def show_mac (self ):
248
+ Utils .banner ()
249
+
250
+ def screenrecord (self ):
251
+ Utils .banner ()
164
252
253
+ def stream_screen (self ):
254
+ Utils .banner ()
255
+
256
+ def screenshot (self ):
257
+ Utils .banner ()
258
+
259
+ def version (self ):
260
+ """Show the version of the tool"""
261
+ Utils .banner ()
262
+ table = Table ()
263
+ table .add_column ("Version" , style = "cyan" )
264
+ table .add_column ("URL" , style = "magenta" )
265
+ table .add_column ("Developed" , style = "magenta" )
266
+ table .add_row ('0.1' , "https://github.com/mesquidar/adbsploit" , 'Ruben Mesquida' )
267
+ console = Console ()
268
+ console .print (table )
165
269
166
270
167
271
if __name__ == '__main__' :
0 commit comments