Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nmap security scan visual reporting #555

Merged
merged 3 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions Framework/Built_In_Automation/Security/BuiltInFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from arachni_download import check_and_install_arachni
from nikto_download import check_and_download_nikto
from arachni_run import run_arachni_scan, generate_report_from_afr
from nmap_scan import nmap_scan_run
from helper import extract_target, check_perl_installed, display_table, save_report_to_file

from Framework.Utilities import ConfigModule
Expand All @@ -33,38 +34,31 @@ def port_scaning_nmap(data_set: list) -> str:
display_table(error_data, headers=["Message", "Details"], title="Nmap Error")
return "zeuz_failed"

target_url = next(item[2] for item in data_set if item[0] == "target")
nmap_action = next(item[2] for item in data_set if item[0] == "nmap")
target_url = next(item[2] for item in data_set if item[0] == "nmap")
target = extract_target(target_url)
command = ["nmap", nmap_action, target]

try:
result = subprocess.run(command, capture_output=True, text=True, check=True)
security_report_dir = Path(ConfigModule.get_config_value("sectionOne", "test_case_folder", temp_config)) / 'security_report'
output_file_name = "nmap_scan_report.txt"
save_report_to_file(result.stdout, security_report_dir, output_file_name)

success_data = [
["Command", " ".join(command)],
["Output", result.stdout.strip()],
]
display_table(success_data, headers=["Description", "Details"], title="Nmap Scan Result")
saved_files = nmap_scan_run(target, security_report_dir)
xml_path = saved_files["xml"]
txt_path = saved_files["txt"]
html_path = saved_files["html"]
return "passed"
except subprocess.CalledProcessError as e:
error_data = [
["Command", " ".join(command)],
["Target URL", " ".join(target)],
["Error", e.stderr.strip()],
]
display_table(error_data, headers=["Description", "Details"], title="Nmap Error")
return "zeuz_failed"


def server_scaning_wapiti(data_set: list) -> str:
target = next(item[2] for item in data_set if item[0] == 'target')
wapiti_action = next(item[2] for item in data_set if item[0] == 'wapiti')
target = next(item[2] for item in data_set if item[0] == 'wapiti')
wapiti_action = next(item[2] for item in data_set if item[0] == 'verbosity')
if not target.startswith(("http://", "https://")):
target = "http://" + target
command = ["wapiti", wapiti_action, "-u", target]
command = ["wapiti", f"-v={wapiti_action}", "-u", target]

try:
print(command)
Expand Down
Loading
Loading