@@ -132,16 +132,23 @@ async function handle({
132132 * @param {string } port The port to start a new subsequent ZAP scan for.
133133 */
134134async function startSMBScan ( { parentScan, hostname} ) {
135- console . log (
136- " --> Starting async subsequent NMAP SMB Scan for host: " + hostname
137- ) ;
138-
139- await startSubsequentSecureCodeBoxScan ( {
140- parentScan,
141- name : `nmap-smb-${ hostname . toLowerCase ( ) } ` ,
142- scanType : "nmap" ,
143- parameters : [ "-Pn" , "-p445" , "--script" , "smb-protocols" , hostname ] ,
144- } ) ;
135+ if ( hostname ) {
136+ console . log (
137+ " --> Starting async subsequent NMAP SMB Scan for host: " + hostname
138+ ) ;
139+ await startSubsequentSecureCodeBoxScan ( {
140+ parentScan,
141+ name : `nmap-smb-${ hostname . toLowerCase ( ) } ` ,
142+ scanType : "nmap" ,
143+ parameters : [ "-Pn" , "-p445" , "--script" , "smb-protocols" , hostname ] ,
144+ } ) ;
145+ }
146+ else
147+ {
148+ console . log (
149+ " --> Failed to start subsequent NMAP SMB Scan because host: '" + hostname + "' must not be null."
150+ ) ;
151+ }
145152}
146153
147154/**
@@ -150,16 +157,25 @@ async function startSMBScan({ parentScan, hostname}) {
150157 * @param {string } port The port to start a new subsequent ZAP scan for.
151158 */
152159async function startNMAPScan ( { parentScan, hostname} ) {
153- console . log (
154- " --> Starting async subsequent NMAP Scan for host: " + hostname
155- ) ;
160+
156161
157- await startSubsequentSecureCodeBoxScan ( {
158- parentScan,
159- name : `nmap-${ hostname . toLowerCase ( ) } ` ,
160- scanType : "nmap" ,
161- parameters : [ "-Pn" , hostname ] ,
162- } ) ;
162+ if ( hostname ) {
163+ console . log (
164+ " --> Starting async subsequent NMAP Scan for host: " + hostname
165+ ) ;
166+ await startSubsequentSecureCodeBoxScan ( {
167+ parentScan,
168+ name : `nmap-${ hostname . toLowerCase ( ) } ` ,
169+ scanType : "nmap" ,
170+ parameters : [ "-Pn" , hostname ] ,
171+ } ) ;
172+ }
173+ else
174+ {
175+ console . log (
176+ " --> Failed to start subsequent NMAP Scan because host: '" + hostname + "' must not be null."
177+ ) ;
178+ }
163179}
164180
165181/**
@@ -168,16 +184,25 @@ async function startNMAPScan({ parentScan, hostname}) {
168184 * @param {string } port The port to start a new subsequent ZAP scan for.
169185 */
170186async function startZAPBaselineHttpsScan ( { parentScan, hostname, port } ) {
171- console . log (
172- " --> Starting async subsequent ZAP Scan for host: " + hostname + ":" + port
173- ) ;
187+
174188
175- await startSubsequentSecureCodeBoxScan ( {
176- parentScan,
177- name : `zap-https-${ hostname . toLowerCase ( ) } ` ,
178- scanType : "zap-baseline" ,
179- parameters : [ "-t" , "https://" + hostname + ":" + port ] ,
180- } ) ;
189+ if ( hostname ) {
190+ console . log (
191+ " --> Starting async subsequent ZAP Scan for host: '" + hostname + "' and port: '" + port + "'"
192+ ) ;
193+ await startSubsequentSecureCodeBoxScan ( {
194+ parentScan,
195+ name : `zap-https-${ hostname . toLowerCase ( ) } ` ,
196+ scanType : "zap-baseline" ,
197+ parameters : [ "-t" , "https://" + hostname + ":" + port ] ,
198+ } ) ;
199+ }
200+ else
201+ {
202+ console . log (
203+ " --> Failed to start subsequent ZAP Scan because host: '" + hostname + "' and port: '" + port + "' must not be null."
204+ ) ;
205+ }
181206}
182207
183208/**
@@ -186,16 +211,24 @@ async function startZAPBaselineHttpsScan({ parentScan, hostname, port }) {
186211 * @param {string } port The port to start a new subsequent SSH scan for.
187212 */
188213async function startSSHScan ( { parentScan, hostname, port } ) {
189- console . log (
190- " --> Starting async subsequent SSH Scan for host: " + hostname + ":" + port
191- ) ;
192-
193- await startSubsequentSecureCodeBoxScan ( {
194- parentScan,
195- name : `ssh-${ hostname . toLowerCase ( ) } ` ,
196- scanType : "ssh-scan" ,
197- parameters : [ "-t" , hostname , "-p" , port . toString ( ) ] ,
198- } ) ;
214+
215+ if ( hostname && port ) {
216+ console . log (
217+ " --> Starting async subsequent SSH Scan for host: '" + hostname + "' and port: '" + port + "'"
218+ ) ;
219+ await startSubsequentSecureCodeBoxScan ( {
220+ parentScan,
221+ name : `ssh-${ hostname . toLowerCase ( ) } ` ,
222+ scanType : "ssh-scan" ,
223+ parameters : [ "-t" , hostname , "-p" , port . toString ( ) ] ,
224+ } ) ;
225+ }
226+ else
227+ {
228+ console . log (
229+ " --> Failed to start subsequent SSH Scan because host: '" + hostname + "' and port: '" + port + "' must not be null."
230+ ) ;
231+ }
199232}
200233
201234/**
@@ -204,16 +237,25 @@ async function startSSHScan({ parentScan, hostname, port }) {
204237 * @param {string } port The port to start a new subsequent Nikto scan for.
205238 */
206239async function startNiktoHttpScan ( { parentScan, hostname, port } ) {
207- console . log (
208- " --> Starting async subsequent Nikto Scan for host: " + hostname + ":" + port
209- ) ;
240+
210241
211- await startSubsequentSecureCodeBoxScan ( {
212- parentScan,
213- name : `nikto-http-${ hostname . toLowerCase ( ) } ` ,
214- scanType : "nikto" ,
215- parameters : [ "-h" , "http://" + hostname , "-p" , port . toString ( ) , "-Tuning" , "1,2,3,5,7,b" ] ,
216- } ) ;
242+ if ( hostname && port ) {
243+ console . log (
244+ " --> Starting async subsequent Nikto Scan for host: '" + hostname + "' and port: '" + port + "'"
245+ ) ;
246+ await startSubsequentSecureCodeBoxScan ( {
247+ parentScan,
248+ name : `nikto-http-${ hostname . toLowerCase ( ) } ` ,
249+ scanType : "nikto" ,
250+ parameters : [ "-h" , "http://" + hostname , "-p" , port . toString ( ) , "-Tuning" , "1,2,3,5,7,b" ] ,
251+ } ) ;
252+ }
253+ else
254+ {
255+ console . log (
256+ " --> Failed to start subsequent Nikto Scan because host: '" + hostname + "' and port: '" + port + "' must not be null."
257+ ) ;
258+ }
217259}
218260
219261/**
@@ -222,16 +264,25 @@ async function startNiktoHttpScan({ parentScan, hostname, port }) {
222264 * @param {string } port The port to start a new subsequent SSLyze scan for.
223265 */
224266async function startSSLyzeScan ( { parentScan, hostname, port } ) {
225- console . log (
226- " --> Starting async subsequent SSLyze Scan for host: " + hostname + ":" + port
227- ) ;
267+
228268
229- await startSubsequentSecureCodeBoxScan ( {
230- parentScan,
231- name : `sslyze-${ hostname . toLowerCase ( ) } ` ,
232- scanType : "sslyze" ,
233- parameters : [ "--regular" , hostname + ":" + port ] ,
234- } ) ;
269+ if ( hostname && port ) {
270+ console . log (
271+ " --> Starting async subsequent SSLyze Scan for host: '" + hostname + "' and port: '" + port + "'"
272+ ) ;
273+ await startSubsequentSecureCodeBoxScan ( {
274+ parentScan,
275+ name : `sslyze-${ hostname . toLowerCase ( ) } ` ,
276+ scanType : "sslyze" ,
277+ parameters : [ "--regular" , hostname + ":" + port ] ,
278+ } ) ;
279+ }
280+ else
281+ {
282+ console . log (
283+ " --> Failed to start subsequent SSLyze Scan because host: '" + hostname + "' and port: '" + port + "' must not be null."
284+ ) ;
285+ }
235286}
236287
237288module . exports . handle = handle ;
0 commit comments