From 4beb84528c69ea0b499bca0e3a3aa6419dc96b31 Mon Sep 17 00:00:00 2001 From: Seth Art Date: Wed, 1 May 2019 22:49:19 -0400 Subject: [PATCH 1/2] Build 166 - Fix for issue #82. Create directory for scanned nmap host so that nmap output can be saved to that host. --- celerystalk | 2 +- lib/nmap.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/celerystalk b/celerystalk index 208105e..ca223de 100755 --- a/celerystalk +++ b/celerystalk @@ -82,7 +82,7 @@ import csv from lib.nmap import nmapcommand -build=str(163) +build=str(166) def print_banner(): diff --git a/lib/nmap.py b/lib/nmap.py index 12acc09..7fd1394 100644 --- a/lib/nmap.py +++ b/lib/nmap.py @@ -17,7 +17,13 @@ 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" From dfd4588b9c49f4d62b7511cd9391bb63782dc340 Mon Sep 17 00:00:00 2001 From: Seth Art Date: Wed, 1 May 2019 22:50:50 -0400 Subject: [PATCH 2/2] Build 166 - Fix for issue #82. Changed hardcoded nmap -N to -A for now. --- lib/nmap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nmap.py b/lib/nmap.py index 7fd1394..055d86e 100644 --- a/lib/nmap.py +++ b/lib/nmap.py @@ -29,9 +29,9 @@ def nmap_scan_subdomain_host(vhost,workspace,simulation,output_base_dir,config_f 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.")