def do_Status(self, args): """Gets the status of running processes""" print("Output Dir: " + '\033[95m' + dbQueue.dumpDir + '\033[0m') print("") print("Finished processes:") print("-------------------") r = db_runner( conn, "SELECT host,ports FROM Hosts WHERE status like '%Completed%' ORDER BY ports DESC" ) for i in r: print(i) print("") print("Running processes:") print("------------------") r = db_runner( conn, "SELECT host, ports, status FROM Hosts WHERE status like '%Stage%'" ) for i in r: print(i) print("") print("Hosts waiting for work:") print("-----------------------") r = db_runner( conn, "SELECT host, status FROM Hosts WHERE status like '%Waiting%'") print(len(r)) print("")
def msfSafeChecks(host): #[ 05/14/2019 11:34:10 - DEBUG - ] dbQueue: 'INSERT INTO results VALUES (?,?,?,?)', ['10.156.158.126', '8080', 'tcp', 'http'] # DBcommit = 'UPDATE Hosts SET status=? WHERE host=?', ["Stage5 - Running udp unicornscan", network] DBselect = 'SELECT host, port, serviceID FROM results WHERE host=?', [host] r = db_runner(conn, DBselect) for i in r: print (i)
def do_ShowHostResults(self, key): # get the output from completed process if key: r = db_runner(conn, 'SELECT host FROM Hosts WHERE host=?', [key]) cmdRunner.showResult(r) else: print("") print("Choose the finished report to view:") print("Example: ShowHostResults 10.10.10.18/32") #c = dbQueue.db_getCursor() r = db_runner( conn, "SELECT host,ports FROM Hosts WHERE status like 'Completed%' ORDER BY ports DESC" ) for i in r: print(i) print("")
def emptyline(self): print("") print("Global Session : " + '\033[95m' + dbQueue.master + '\033[0m') print("Output Dir : " + "\033[95m" + dbQueue.dumpDir + '\033[0m') print("Verbosity : " + '\033[95m' + str(dbQueue.debug.value) + '\033[0m') r = db_runner( conn, "SELECT host, status FROM Hosts WHERE status like '%Stage%'") print("Running Processes : " + '\033[92m' + str(len(r)) + '\033[0m') r = db_runner( conn, "SELECT host, status FROM Hosts WHERE status like '%Waiting%'") print("Remaining Hosts : " + '\033[92m' + str(len(r)) + '\033[0m') print("") realTimeMuxER('stty sane') pass
def MBaku(taskDB): workerName = (multiprocessing.current_process()).name while True: # Check to see if there is work to do taskDB = dbQueue.workDB.get() if taskDB: # need to do some magic here to pass the right data s = str(taskDB).strip('()') helper.whine("dbQueue: " + s, "INFO") pattern = "\'(.*)\', (\[.*\])" match = re.match(pattern, s) if not match: print("No Match error " + pattern + " " + s) sql = match.group(1) s = match.group(2).strip("[]") s = re.sub(r'\'', '', s) args = tuple(item.strip() for item in s.split(',')) db_runner(conn, sql, args) helper.printR("[MBaku] Got the poison pill ... DEAD.")
def msfSafeChecks(network, output): whine("Welcome to MSF Safe Checks: " + '\033[95m' + network + '\033[0m', "info") config = configparser.ConfigParser() msfCFG = os.path.abspath(os.path.dirname(__file__)) + "/utils/msf.ini" whine("Loading Safe Checks from: " + msfCFG, "debug") config.read(msfCFG) MSF = ast.literal_eval(config.get("MSF-SAFE", "msfLIST")) conn = dbQueue.conn host = network.split('/', 1)[0] DBselect = "SELECT host, port, serviceID FROM results WHERE host='" + host + "'" whine("Gathering ports : " + host, "debug") r = db_runner(conn, DBselect) if not r: return serviceSET = set(r) for i in serviceSET: port = i[1] service = i[2] whine( "Identifying MSF Safe Checks for Port: " + port + " Service: " + service, "debug") regEX = ".*" + service r = re.compile(regEX) msfLIST = list(filter(r.match, MSF)) for module in msfLIST: m = module.rsplit('/', 1)[-1] # At this point we already did HTTP so lets skip them. That might change tho if "http" in module: continue whine("Running Metasploit Module: " + module, "debug") f = output + "_Metasploit_" + m + ".txt" cmd = "msfconsole -x \"use " + module + ";set rhosts " + host + ";set rport " + port + "; run; exit\" > " + f muxER(cmd) whine("Done with MSF Safe Checks: " + '\033[95m' + network + '\033[0m', "info")