Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nullt3r committed Apr 20, 2022
1 parent c8a94b4 commit bb0e567
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions jfscan/modules/Nmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def _run_single_nmap(self, _args):
return

ports = ",".join(map(str, ports))
stdout_buffer = ""

if output is not None:
nmap_output = f"/tmp/_jfscan_{utils.random_string()}.xml"
Expand Down Expand Up @@ -71,18 +72,20 @@ def _run_single_nmap(self, _args):
output_in_colors = output_in_colors.replace(" filtered ", "\033[1m\033[93m filtered \033[0m")
output_in_colors = output_in_colors.replace(" closed ", "\033[1m\033[91m closed \033[0m")

print("-------\033[1m" + f_host_domain + "\033[0m" + "".join(["-" for s in range(hyphen_count - len(f_host_domain))]))
stdout_buffer += "-------\033[1m" + f_host_domain + "\033[0m" + "".join(["-" for s in range(hyphen_count - len(f_host_domain))])

if "Nmap done: 1 IP address (0 hosts up)" in nmap_stdout or result.returncode != 0:
logger.warning("\nHost %s seems down now, your network connection is not able to handle the scanning, \nare you scanning over a wifi? Try VPS or ethernet instead.\n\n", host)
stdout_buffer += f"\nHost {host} seems down now, your network connection is not able to handle the scanning, \nare you scanning over a wifi? Try VPS or ethernet instead.\n\n"
else:
nmap_stdout = "\r\n".join(nmap_stdout.splitlines()[3:][:-2]) + "\r\n"
nmap_stdout = "\r\n".join(nmap_stdout.splitlines()[3:][:-2])

output_in_colors = nmap_stdout.replace(" open ", "\033[1m\033[92m open \033[0m")
output_in_colors = output_in_colors.replace(" filtered ", "\033[1m\033[93m filtered \033[0m")
output_in_colors = output_in_colors.replace(" closed ", "\033[1m\033[91m closed \033[0m")

print(output_in_colors)
stdout_buffer += output_in_colors

print(stdout_buffer)

if output is not None:
if utils.file_is_empty(nmap_output):
Expand Down

0 comments on commit bb0e567

Please sign in to comment.