Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 1c277c8

Browse files
committed
Added AMASS subsequent scans also to nmap-subsequent-scans hook. We should refactor the name of the hook to subsequent-scans and bundle all subsequent scans actions there.
1 parent 2186f9c commit 1c277c8

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

hooks/nmap-subsequent-scans/hook.js

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ async function handle({ scan, getFindings }) {
66
console.log(findings);
77

88
console.log(
9-
`Found #${findings.length} findings... trying to find possible subsequent security scans.`
9+
`Found #${findings.length} findings... Trying to find identify if these are NMAP specific findings and start possible subsequent security scans.`
1010
);
1111

1212
for (const finding of findings) {
@@ -18,7 +18,7 @@ async function handle({ scan, getFindings }) {
1818
const port = finding.attributes.port;
1919

2020
console.log(
21-
"Found open port finding for service: " + finding.attributes.port
21+
"Found NMAP 'Open Port' finding for service: " + finding.attributes.port
2222
);
2323

2424
// search for HTTP ports and start subsequent Nikto Scan
@@ -58,6 +58,41 @@ async function handle({ scan, getFindings }) {
5858
}
5959
}
6060
}
61+
62+
console.log(
63+
`Found #${findings.length} findings... Trying to find identify if these are AMASS specific findings and start possible subsequent security scans.`
64+
);
65+
66+
for (const finding of findings) {
67+
if(finding.category === "Subdomain" && finding.osi_layer === "NETWORK" && finding.description.startsWith("Found subdomain")) {
68+
console.log("Found AMASS 'Subdomain' finding: " + finding.location);
69+
70+
const hostname = finding.location;
71+
72+
await startNMAPScan({
73+
parentScan: scan,
74+
hostname
75+
});
76+
}
77+
}
78+
}
79+
80+
/**
81+
* Creates a new subsequent SCB ZAP Scan for the given hostname.
82+
* @param {string} hostname The hostname to start a new subsequent ZAP scan for.
83+
* @param {string} port The port to start a new subsequent ZAP scan for.
84+
*/
85+
async function startNMAPScan({ parentScan, hostname}) {
86+
console.log(
87+
" --> Starting async subsequent NMAP Scan for host: " + hostname
88+
);
89+
90+
await startSubsequentSecureCodeBoxScan({
91+
parentScan,
92+
name: `nmap-${hostname.toLowerCase()}`,
93+
scanType: "nmap",
94+
parameters: ["-Pn", hostname],
95+
});
6196
}
6297

6398
/**

0 commit comments

Comments
 (0)