5
5
>>> python adbsploit.py -help
6
6
"""
7
7
import os
8
+ import shutil
8
9
import sys
9
10
import time
10
11
import adbutils
14
15
from rich .table import Table
15
16
from colorama import Fore
16
17
17
- global_device = "device"
18
+
18
19
19
20
20
21
class Utils :
@@ -26,15 +27,17 @@ def banner():
26
27
27
28
28
29
class Cli (object ):
30
+ gdevice = 'serial'
29
31
30
32
def devices (self ):
31
33
Utils .banner ()
32
34
table = Table ()
33
35
table .add_column ("Device detected" , style = "cyan" )
34
36
table .add_column ("Model" , style = "magenta" )
35
37
table .add_column ("Name" , style = "magenta" )
38
+ table .add_column ("Device" , style = "magenta" )
36
39
for d in adbutils .adb .device_list ():
37
- table .add_row (d .serial , d .prop .model , d .prop .name )
40
+ table .add_row (d .serial , d .prop .model , d .prop .name , d . prop . device )
38
41
console = Console ()
39
42
console .print (table )
40
43
@@ -47,6 +50,7 @@ def select(self, device):
47
50
Utils .banner ()
48
51
output = adbutils .adb .device (serial = device )
49
52
print ("Selected device: " + Fore .GREEN + output .serial )
53
+ Cli .gdevice = output .serial
50
54
51
55
def list_forward (self , device = 'all' ):
52
56
Utils .banner ()
@@ -286,7 +290,7 @@ def dump_hierarchy(self, device):
286
290
def keyevent (self , device , key ):
287
291
Utils .banner ()
288
292
d = adbutils .adb .device (device )
289
- k = d .keyevent (key )
293
+ d .keyevent (key )
290
294
print (Fore .GREEN + "They key event is processed correctly..." )
291
295
292
296
def show_keyevents (self ):
@@ -405,17 +409,10 @@ def remove_password(self, device):
405
409
d4 = d .shell ("su 0 'rm /data/system/locksettings.db-shm'" )
406
410
print (d4 )
407
411
408
- #TODO
409
- def rotate (self , device ):
410
- Utils .banner ()
411
- d = adbutils .adb .device (device )
412
- d .rotation ()
413
-
414
- #TODO
415
- def swipe (self , device ):
412
+ def swipe (self , device , sx , sy , ex , ey , duration = '0.5' ):
416
413
Utils .banner ()
417
414
d = adbutils .adb .device (device )
418
- d .swipe ()
415
+ d .swipe (sx , sy , ex , ey , duration )
419
416
420
417
def screen (self , device , status ):
421
418
Utils .banner ()
@@ -427,7 +424,7 @@ def screen(self, device, status):
427
424
else :
428
425
print (Fore .RED + "That option doesn't exists..." )
429
426
430
- def unlock_screen (self , device , code ):
427
+ def unlock_screen (self , device , code = '' ):
431
428
Utils .banner ()
432
429
d = adbutils .adb .device (device )
433
430
if d .is_screen_on () == False :
@@ -439,23 +436,48 @@ def unlock_screen(self, device, code):
439
436
else :
440
437
print (Fore .GREEN + "The screen is already unlocked..." )
441
438
442
- def show_mac (self ):
439
+ def lock_screen (self , device ):
443
440
Utils .banner ()
441
+ d = adbutils .adb .device (device )
442
+ d .keyevent (26 )
443
+ print (Fore .GREEN + "The screen is now locked..." )
444
+
445
+ def show_macaddress (self , device ):
446
+ Utils .banner ()
447
+ d = adbutils .adb .device (device )
448
+ print (Fore .GREEN + d .shell ("cat /sys/class/net/wlan0/address" ))
444
449
445
450
def screenrecord (self ):
446
451
Utils .banner ()
447
452
453
+ #TODO
448
454
def stream_screen (self ):
449
455
Utils .banner ()
450
456
451
- def screenshot (self ):
457
+ def screenshot (self , device , name = 'screenshot' ):
452
458
Utils .banner ()
459
+ os .system ("adb -s " + device + " exec-out screencap -p >" + name + ".png" )
460
+ print (Fore .GREEN + "An image is created with the name " + name + ".png ..." )
453
461
454
- def get_notifications (self ,device ):
462
+ def dump_meminfo (self , device , app = 'all' ):
455
463
Utils .banner ()
456
464
d = adbutils .adb .device (device )
457
- print (d .shell ("dumpsys notification | grep ticker | cut -d= -f2" ))
465
+ if app == 'all' :
466
+ d .shell ("dumpsys meminfo" )
467
+ else :
468
+ d .shell ("dumpsys meminfo " + app )
458
469
470
+ def process_list (self , device ):
471
+ Utils .banner ()
472
+ d = adbutils .adb .device (device )
473
+ print (d .shell ("ps -ef" ))
474
+
475
+ def tcpip (self , port ):
476
+ Utils .banner ()
477
+ if port == '' :
478
+ print (Fore .RED + "You must specify a port to listen on your device..." )
479
+ else :
480
+ os .system ("adb tcpip " + port )
459
481
460
482
def version (self ):
461
483
"""Show the version of the tool"""
@@ -468,6 +490,6 @@ def version(self):
468
490
console = Console ()
469
491
console .print (table )
470
492
471
-
472
493
if __name__ == '__main__' :
473
494
fire .Fire (Cli )
495
+
0 commit comments