8000 Add new functions · CKAndroidProject/adbsploit@ad8b5d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad8b5d3

Browse files
committed
Add new functions
1 parent 7737c65 commit ad8b5d3

File tree

1 file changed

+116
-12
lines changed

1 file changed

+116
-12
lines changed

adbsploit/adbsploit.py

Lines changed: 116 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
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+
"""
17
import os
28
import sys
39
import time
@@ -28,7 +34,7 @@ def devices(self):
2834
table.add_column("Model", style="magenta")
2935
table.add_column("Name", style="magenta")
3036
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)
3238
console = Console()
3339
console.print(table)
3440

@@ -61,23 +67,29 @@ def list_forward(self, device='all'):
6167
console = Console()
6268
console.print(table)
6369

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...")
6475

6576
def wifi(self, device, state):
6677
Utils.banner()
6778
d = adbutils.adb.device(device)
6879
if state == 'on':
6980
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')
7182
else:
7283
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')
7486

75-
def dumpsys(self,device):
87+
def dumpsys(self, device):
7688
Utils.banner()
7789
d = adbutils.adb.device(device)
7890
print(d.shell(device + ' dumpsys'))
7991

80-
def list_apps(self,device):
92+
def list_apps(self, device):
8193
Utils.banner()
8294
d = adbutils.adb.device(device)
8395
apps = d.list_packages()
@@ -94,12 +106,12 @@ def wpa_supplicant(self, device):
94106
d = adbutils.adb.device(device)
95107
d.shell("su -c 'cp /data/misc/wifi/wpa_supplicant.conf /sdcard/'")
96108
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)
98110
print(Fore.GREEN + 'WPA Supplicant exported corerctly')
99111
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')
101113

102-
def install(self, device,apk):
114+
def install(self, device, apk):
103115
try:
104116
Utils.banner()
105117
d = adbutils.adb.device(device)
@@ -117,16 +129,15 @@ def install_remote(self, device, url):
117129
except:
118130
print(Fore.RED + 'An error has been occurred installing the APK. Check the path or the error related')
119131

120-
121132
def uninstall(self, device, app):
122133
try:
123134
Utils.banner()
124135
d = adbutils.adb.device(device)
125136
d.uninstall(app)
126137
print(Fore.GREEN + 'APK uninstalled successfully')
127138
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')
130141

131142
def shell(self, device, command):
132143
Utils.banner()
@@ -158,10 +169,103 @@ def get_folder(self, device, path, name):
158169
d.shell("su -c 'cp /data/misc/wifi/wpa_supplicant.conf /sdcard/'")
159170
d.sync.pull(path, name)
160171

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):
162227
Utils.banner()
163228
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()
164252

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)
165269

166270

167271
if __name__ == '__main__':

0 commit comments

Comments
 (0)
0