-
Notifications
You must be signed in to change notification settings - Fork 179
Expand file tree
/
Copy pathcli.test.js
More file actions
46 lines (40 loc) · 1.12 KB
/
cli.test.js
File metadata and controls
46 lines (40 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const { Time } = require('./sdk');
const child_process = require('child_process');
test(
'finds open juice-shop ports when started via cli',
async () => {
const authstring = `${global.username}:${global.password}`;
child_process.execSync(
`./run_scanner.sh -a ${authstring} nmap juice-shop`,
{
cwd: '../cli',
}
);
const { report } = require('../cli/job_nmap_result.json');
const [finding1, finding2, ...otherFindings] = report.findings.map(
({ description, category, name, osi_layer, severity }) => ({
description,
category,
name,
osi_layer,
severity,
})
);
expect(finding1).toMatchObject({
description: 'Port 3000 is open using tcp protocol.',
category: 'Open Port',
name: 'ppp',
osi_layer: 'NETWORK',
severity: 'INFORMATIONAL',
});
expect(finding2).toMatchObject({
category: 'Host',
description: 'Found a host',
name: 'Host: juice-shop',
osi_layer: 'NETWORK',
severity: 'INFORMATIONAL',
});
expect(otherFindings).toEqual([]);
},
1 * Time.Minute
);