Skip to content

Commit 6a6af5c

Browse files
committed
make name required and update parsers
Signed-off-by: Johannes Zahn <johannes.zahn@iteratec.com>
1 parent 9c2ad8c commit 6a6af5c

5 files changed

Lines changed: 209 additions & 208 deletions

File tree

‎parser-sdk/nodejs/findings-schema.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
"id",
6565
"parsed_at",
6666
"severity",
67-
"category"
67+
"category",
68+
"name"
6869
]
6970
}
7071
}

‎scanners/nmap/parser/parser.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function transformToFindings(hosts) {
2121

2222
return openPorts.map(openPort => {
2323
return {
24-
name: openPort.service,
24+
name: openPort.service || `Open Port: ${openPort.port}`,
2525
description: `Port ${openPort.port} is ${openPort.state} using ${openPort.protocol} protocol.`,
2626
category: 'Open Port',
2727
location: `${openPort.protocol}://${hostInfo.ip}:${openPort.port}`,

‎scanners/nmap/parser/parser.test.js‎

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -181,45 +181,45 @@ test("should properly parse a nmap xml with missing service information", async
181181
const findings = await parse(xmlContent);
182182
await expect(validateParser(findings)).resolves.toBeUndefined();
183183
expect(findings).toMatchInlineSnapshot(`
184-
Array [
185-
Object {
186-
"attributes": Object {
187-
"hostname": "example.com",
188-
"ip_address": "93.184.216.34",
189-
"mac_address": null,
190-
"method": undefined,
191-
"operating_system": null,
192-
"port": 10250,
193-
"protocol": "tcp",
194-
"scripts": null,
195-
"service": undefined,
196-
"serviceProduct": null,
197-
"serviceVersion": null,
198-
"state": "filtered",
199-
"tunnel": null,
200-
},
201-
"category": "Open Port",
202-
"description": "Port 10250 is filtered using tcp protocol.",
203-
"location": "tcp://93.184.216.34:10250",
204-
"name": undefined,
205-
"osi_layer": "NETWORK",
206-
"severity": "INFORMATIONAL",
207-
},
208-
Object {
209-
"attributes": Object {
210-
"hostname": "example.com",
211-
"ip_address": "93.184.216.34",
212-
"operating_system": null,
213-
},
214-
"category": "Host",
215-
"description": "Found a host",
216-
"location": "example.com",
217-
"name": "Host: example.com",
218-
"osi_layer": "NETWORK",
219-
"severity": "INFORMATIONAL",
220-
},
221-
]
222-
`);
184+
Array [
185+
Object {
186+
"attributes": Object {
187+
"hostname": "example.com",
188+
"ip_address": "93.184.216.34",
189+
"mac_address": null,
190+
"method": undefined,
191+
"operating_system": null,
192+
"port": 10250,
193+
"protocol": "tcp",
194+
"scripts": null,
195+
"service": undefined,
196+
"serviceProduct": null,
197+
"serviceVersion": null,
198+
"state": "filtered",
199+
"tunnel": null,
200+
},
201+
"category": "Open Port",
202+
"description": "Port 10250 is filtered using tcp protocol.",
203+
"location": "tcp://93.184.216.34:10250",
204+
"name": "Open Port: 10250",
205+
"osi_layer": "NETWORK",
206+
"severity": "INFORMATIONAL",
207+
},
208+
Object {
209+
"attributes": Object {
210+
"hostname": "example.com",
211+
"ip_address": "93.184.216.34",
212+
"operating_system": null,
213+
},
214+
"category": "Host",
215+
"description": "Found a host",
216+
"location": "example.com",
217+
"name": "Host: example.com",
218+
"osi_layer": "NETWORK",
219+
"severity": "INFORMATIONAL",
220+
},
221+
]
222+
`);
223223
});
224224

225225
test("Should properly parse a nmap xml with script specific SMB findings", async () => {

0 commit comments

Comments
 (0)