def nmap_scan_subdomain_host(vhost,workspace,simulation,output_base_dir,config_file=None): celery_path = sys.path[0] config_nmap_options = config_parser.extract_bb_nmap_options(config_file=config_file) config = ConfigParser(allow_no_value=True) config.read(['config.ini']) vhost_explicitly_out_of_scope = lib.db.is_vhost_explicitly_out_of_scope(vhost, workspace) output_host_dir = os.path.normpath(os.path.join(output_base_dir, vhost)) try: os.stat(output_host_dir) except: os.makedirs(output_host_dir) output_file = os.path.normpath(os.path.join(output_host_dir, vhost + "_nmap_tcp_scan.txt")) if not vhost_explicitly_out_of_scope: #print(config_nmap_options) cmd_name = "nmap_tcp_scan" try: if not simulation: populated_command = "nmap " + vhost + config_nmap_options + " -oA " + output_file else: populated_command = "#nmap " + vhost + config_nmap_options + " -oA " + output_file except TypeError: print("[!] Error: In the config file, there needs to be one, and only one, enabled tcp_scan command in the nmap_commands section.") print("[!] This determines what ports to scan.") exit() task_id = uuid() utils.create_task(cmd_name, populated_command, vhost, output_file, workspace, task_id) result = chain( tasks.cel_nmap_scan.si(cmd_name, populated_command, vhost, config_nmap_options, celery_path, task_id,workspace).set(task_id=task_id), )()
def nmap_scan_subdomain_host(host, workspace, simulation, output_base_dir): celery_path = sys.path[0] config_nmap_options = config_parser.extract_bb_nmap_options() config = ConfigParser(allow_no_value=True) config.read(['config.ini']) #print(config_nmap_options) cmd_name = "nmap_bug_bounty_mode" populated_command = "nmap " + host + config_nmap_options task_id = uuid() utils.create_task(cmd_name, populated_command, host, output_base_dir, workspace, task_id) result = chain( #tasks.cel_create_task.subtask(args=(cmd_name, populated_command, host, output_base_dir, workspace, task_id)), tasks.cel_nmap_scan.si(cmd_name, populated_command, host, config_nmap_options, celery_path, task_id, workspace).set(task_id=task_id), tasks.cel_scan_process_nmap_data.s(workspace), tasks.cel_process_db_services.si(output_base_dir, simulation, workspace, host=host), tasks.post_process_domains_bb.si(host, cmd_name, populated_command, output_base_dir, workspace, simulation, celery_path), )()