Skip to content

Commit 9b88084

Browse files
authored
Merge pull request #557 from AutomationSolutionz/Security_Actions_Issue
Security Action File Generation Issue for windows
2 parents e7dea2c + afd89aa commit 9b88084

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

Framework/Built_In_Automation/Security/BuiltInFunctions.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,19 @@ def port_scaning_nmap(data_set: list) -> str:
5656
def server_scaning_wapiti(data_set: list) -> str:
5757
target = next(item[2] for item in data_set if item[0] == 'wapiti')
5858
wapiti_action = next(item[2] for item in data_set if item[0] == 'verbosity')
59+
5960
if not target.startswith(("http://", "https://")):
6061
target = "http://" + target
62+
6163
command = ["wapiti", f"-v={wapiti_action}", "-u", target]
6264

65+
# Set UTF-8 encoding
66+
env = os.environ.copy()
67+
env["PYTHONUTF8"] = "1"
68+
6369
try:
6470
print(command)
65-
result = subprocess.run(command, capture_output=True, text=True, check=True)
71+
result = subprocess.run(command, capture_output=True, text=True, check=True, env=env)
6672
print("Command Output:", result.stdout)
6773

6874
for line in result.stdout.splitlines():
@@ -76,7 +82,7 @@ def server_scaning_wapiti(data_set: list) -> str:
7682
security_report_dir = Path(ConfigModule.get_config_value("sectionOne", "test_case_folder", temp_config)) / 'security_report' / 'wapiti'
7783
os.makedirs(security_report_dir, exist_ok=True)
7884
destination_path = security_report_dir / os.path.basename(report_path)
79-
# Move the report file to the new location
85+
8086
shutil.move(report_path, destination_path)
8187
print(f"Report moved to {destination_path}")
8288

@@ -101,7 +107,6 @@ def server_scaning_arachni(data_set: list) -> str:
101107
print("***** Arachni setup failed. *****")
102108
return "zeuz_failed"
103109

104-
105110
def server_scaning_nikto(data_set: list) -> str:
106111
"""
107112
Runs Nikto scan if Perl is installed, otherwise provides installation instructions based on the platform.

Framework/Built_In_Automation/Security/nmap_scan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def run_nmap(ip, output_dir=None):
1414
xml_output_file = os.path.join(output_dir, f"nmap_scan_{ip}.xml")
1515
normal_output_file = os.path.join(output_dir, f"nmap_scan_{ip}.txt")
1616

17-
command = f"nmap -sV --script vuln -oX {xml_output_file} -oN {normal_output_file} {ip}"
18-
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
17+
process = subprocess.Popen(["nmap", "-sV", "--script", "vuln", "-oX", xml_output_file, "-oN", normal_output_file, ip], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
18+
1919
spinner = ['|', '/', '-', '\\']
2020
start_time = datetime.now()
2121
scanning = True

node_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def main():
147147

148148
kill_old_process(Path.cwd().parent / "pid.txt")
149149
check_min_python_version(min_python_version="3.11", show_warning=True)
150-
install_missing_modules()
150+
update_outdated_modules()
151151
monkeypatch_fromisoformat()
152152
start_server()
153153

0 commit comments

Comments
 (0)