From b5cae35bfd82fbb3a541499b8bb6a426ddf18070 Mon Sep 17 00:00:00 2001 From: Ekultek Date: Thu, 5 Sep 2019 12:56:09 -0500 Subject: [PATCH 1/8] minor tweaks and updates --- etc/text_files/nmap_opts.lst | 2 + lib/banner.py | 2 +- lib/scanner/nmap.py | 306 +++++++++++++++++++++++++---------- lib/settings.py | 3 +- lib/term/terminal.py | 118 ++++++++++---- 5 files changed, 310 insertions(+), 121 deletions(-) diff --git a/etc/text_files/nmap_opts.lst b/etc/text_files/nmap_opts.lst index 818bc5e..10dc88d 100644 --- a/etc/text_files/nmap_opts.lst +++ b/etc/text_files/nmap_opts.lst @@ -89,6 +89,8 @@ -oG -oA -v +-vv +-vvv -d --reason --open diff --git a/lib/banner.py b/lib/banner.py index bb59e3e..b9a3289 100644 --- a/lib/banner.py +++ b/lib/banner.py @@ -1,7 +1,7 @@ import os import random -VERSION = "4.0" +VERSION = "4.0.1" def banner_1(line_sep="#--", space=" " * 30): diff --git a/lib/scanner/nmap.py b/lib/scanner/nmap.py index 71187f7..c219b97 100644 --- a/lib/scanner/nmap.py +++ b/lib/scanner/nmap.py @@ -120,7 +120,12 @@ def do_scan(host, nmap_path, ports=None, arguments=None): perform the nmap scan """ if arguments is None: - arguments = "-sV" + lib.output.misc_info("using default scan arguments") + arguments = [ + "-sF", "-Pn", "-sV", + "-O", "-F", "--reason", + "-vvv" + ] launch_arguments = [ nmap_path, '-oX', '-', host, '-p ' + ports if ports is not None else "", @@ -150,106 +155,235 @@ def do_scan(host, nmap_path, ports=None, arguments=None): return output_data, "".join(nmap_warn_tracestack), "".join(nmap_error_tracestack) +# copy pasta :DD +# https://github.com/komand/python-nmap/blob/master/nmap/nmap.py#L273 def parse_xml_output(output, warnings, error): """ - parse the XML data out of the file into a dict + Analyses NMAP xml scan ouput + May raise PortScannerError exception if nmap output was not xml + Test existance of the following key to know if something went wrong : ['nmap']['scaninfo']['error'] + If not present, everything was ok. + :param nmap_xml_output: xml string to analyse + :returns: scan_result as dictionnary """ - results = {} + # nmap xml output looks like : + # + # + #
+ # + # + # + # + # + # + # + # + # + # + # + # + #