From 64c8c36fce2aba9b5607c710f8e1fb10daa4a653 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?An=C5=BEe=20=C5=BDitnik?= <anze.zitnik@xlab.si>
Date: Thu, 18 Mar 2021 20:11:28 +0100
Subject: [PATCH] Added nmap profiles: basic_discovery_ports and
 custom_parameters

---
 MANIFEST                         |  2 +-
 README.md                        |  4 ++++
 config-examples/nmap-custom.json | 13 +++++++++++++
 config-examples/nmap-ports.json  | 13 +++++++++++++
 config-examples/nmap.json        | 10 ++++++++++
 configure.py                     |  4 ++++
 6 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 config-examples/nmap-custom.json
 create mode 100644 config-examples/nmap-ports.json
 create mode 100644 config-examples/nmap.json

diff --git a/MANIFEST b/MANIFEST
index d6cae1d..78ea03f 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,3 +1,3 @@
-VERSION=v1.4.3
+VERSION=v1.4.4
 SERVICE=vat-genscan
 
diff --git a/README.md b/README.md
index 4e350fb..10b9196 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,10 @@ Supported scanners and their profiles:
 	* `basic`: no parameters
 * `nmap`
 	* `basic_discovery`: no parameters
+	* `basic_discovery_ports`: provide port parameter (nmap -sV -p xxx)
+		* ports
+	* `custom`: provide all command line parameters (nmap xxxxxx)
+		* parameters
 
 *See example config files in `config-examples` folder.*
 
diff --git a/config-examples/nmap-custom.json b/config-examples/nmap-custom.json
new file mode 100644
index 0000000..6cbcea3
--- /dev/null
+++ b/config-examples/nmap-custom.json
@@ -0,0 +1,13 @@
+{
+    "target": {
+        "ip": "192.168.1.0/24"
+    },
+    "config": {
+        "nmap": {
+            "profile": "custom_parameters",
+            "parameters": {
+                "parameters": "-sV -p 22"
+            }
+        }
+    }
+}
diff --git a/config-examples/nmap-ports.json b/config-examples/nmap-ports.json
new file mode 100644
index 0000000..8ff4529
--- /dev/null
+++ b/config-examples/nmap-ports.json
@@ -0,0 +1,13 @@
+{
+    "target": {
+        "ip": "192.168.1.0/24"
+    },
+    "config": {
+        "nmap": {
+            "profile": "basic_discovery_ports",
+            "parameters": {
+                "ports": "22,80,443"
+            }
+        }
+    }
+}
diff --git a/config-examples/nmap.json b/config-examples/nmap.json
new file mode 100644
index 0000000..fe55d2a
--- /dev/null
+++ b/config-examples/nmap.json
@@ -0,0 +1,10 @@
+{
+    "target": {
+        "ip": "192.168.1.0/24"
+    },
+    "config": {
+        "nmap": {
+            "profile": "basic_discovery"
+        }
+    }
+}
diff --git a/configure.py b/configure.py
index 5b63378..f7606ef 100644
--- a/configure.py
+++ b/configure.py
@@ -62,6 +62,10 @@ def configure():
             cscan_config["NMAP"] = {"CS_NMAP": "nmap"}
             if profile == "basic_discovery":
                 cscan_config["NMAP"]["CS_NMAP_ARGS"] = "-sV"
+            if profile == "basic_discovery_ports":
+                cscan_config["NMAP"]["CS_NMAP_ARGS"] = "-sV -p " + config["config"][scanner]["parameters"]["ports"]
+            if profile == "custom_parameters":
+                cscan_config["NMAP"]["CS_NMAP_ARGS"] = config["config"][scanner]["parameters"]["parameters"]
             else:
                 raise UnsupportedProfileException()
             cs_scripts.append("nmap.sh")
-- 
GitLab