def do_scan(self, args): """ Scan something. Possible scans include AmassScan CORScannerScan GobusterScan SearchsploitScan ThreadedNmapScan WebanalyzeScan AquatoneScan FullScan MasscanScan SubjackScan TKOSubsScan HTBScan """ self.async_alert( style( "If anything goes wrong, rerun your command with --verbose to enable debug statements.", fg="cyan", dim=True, )) # get_scans() returns mapping of {classname: [modulename, ...]} in the recon module # each classname corresponds to a potential recon-pipeline command, i.e. AmassScan, CORScannerScan ... scans = get_scans() # command is a list that will end up looking something like what's below # luigi --module recon.web.webanalyze WebanalyzeScan --target-file tesla --top-ports 1000 --interface eth0 command = ["luigi", "--module", scans.get(args.scantype)[0]] command.extend(args.__statement__.arg_list) if args.sausage: # sausage is not a luigi option, need to remove it # name for the option came from @AlphaRingo command.pop(command.index("--sausage")) webbrowser.open( "localhost:8082" ) # hard-coded here, can specify different with the status command if args.verbose: # verbose is not a luigi option, need to remove it command.pop(command.index("--verbose")) subprocess.run(command) else: # suppress luigi messages in favor of less verbose/cleaner output proc = subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE) # add stderr to the selector loop for processing when there's something to read from the fd selector.register(proc.stderr, selectors.EVENT_READ, self._luigi_pretty_printer)
def test_get_scans(): scans = get_scans() scan_names = [ "AmassScan", "CORScannerScan", "GobusterScan", "MasscanScan", "SubjackScan", "TKOSubsScan", "AquatoneScan", "FullScan", "HTBScan", "SearchsploitScan", "ThreadedNmapScan", "WebanalyzeScan", ] assert len(scan_names) == len(scans.keys()) for name in scan_names: assert name in scans.keys() modules = [ "recon.amass", "recon.nmap", "recon.masscan", "recon.wrappers", "recon.web.aquatone", "recon.web.corscanner", "recon.web.gobuster", "recon.web.subdomain_takeover", "recon.web.webanalyze", ] for module in scans.values(): assert module[0] in modules