diff --git a/celerystalk b/celerystalk index f473a58..ca223de 100755 --- a/celerystalk +++ b/celerystalk @@ -82,7 +82,7 @@ import csv from lib.nmap import nmapcommand -build=str(164) +build=str(166) def print_banner(): diff --git a/lib/nmap.py b/lib/nmap.py index 12acc09..055d86e 100644 --- a/lib/nmap.py +++ b/lib/nmap.py @@ -17,15 +17,21 @@ def nmap_scan_subdomain_host(vhost,workspace,simulation,output_base_dir,config_f config.read(['config.ini']) vhost_explicitly_out_of_scope = lib.db.is_vhost_explicitly_out_of_scope(vhost, workspace) - output_file = os.path.normpath(os.path.join(output_base_dir, vhost,vhost + "_nmap_tcp_scan.txt")) + 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 + " -oN " + output_file + populated_command = "nmap " + vhost + config_nmap_options + " -oA " + output_file else: - populated_command = "#nmap " + vhost + config_nmap_options + " -oN " + output_file + 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.")