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

Commit 0099dc3

Browse files
committed
Add dummy scanner for hook integration tests
To perform integration tests to ensure the functionality of the read-only and read-write hooks we need to have a dummy scanner with no dependencies to a real scanner or parser.
1 parent 65cd9a4 commit 0099dc3

File tree

13 files changed

+439
-0
lines changed

13 files changed

+439
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
3+
parser/
4+
scanner/
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: v2
2+
name: read-write-hook-test
3+
description: A Helm chart to test the integration of read and write hooks.
4+
5+
type: application
6+
version: 0.1.0
7+
appVersion: 0.1.0
8+
9+
keywords:
10+
- security
11+
- readWriteHook
12+
- scanner
13+
- secureCodeBox
14+
- integrationTest
15+
- test
16+
home: https://www.securecodebox.io/scanner/Nmap
17+
icon: https://www.securecodebox.io/integrationIcons/Nmap.svg
18+
sources:
19+
- https://github.com/secureCodeBox/secureCodeBox
20+
maintainers:
21+
- name: iteratec GmbH
22+
email: security@iteratec.com
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:12-alpine as build
2+
RUN mkdir -p /home/app
3+
WORKDIR /home/app
4+
COPY package.json package-lock.json ./
5+
RUN npm ci --production
6+
7+
FROM scbexperimental/parser-sdk-nodejs:latest
8+
WORKDIR /home/app/parser-wrapper/parser/
9+
COPY --from=build --chown=app:app /home/app/node_modules/ ./node_modules/
10+
COPY --chown=app:app ./parser.js ./parser.js

integrations/read-write-hook-test/parser/package-lock.json

Lines changed: 153 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "read-write-hook-test-parser",
3+
"version": "1.0.0",
4+
"description": "Parses result files for the type: 'nmap-xml'",
5+
"main": "",
6+
"scripts": {},
7+
"keywords": [],
8+
"author": "iteratec GmbH",
9+
"license": "Apache-2.0",
10+
"dependencies": {
11+
"xml2js": "^0.4.22"
12+
},
13+
"devDependencies": {}
14+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
async function parse(fileContent) {
2+
return transformToFindings();
3+
}
4+
5+
function transformToFindings() {
6+
const portFindings = {
7+
name: "Test read-write-hook service",
8+
description: `Port is using protocol.`,
9+
category: 'Open Port',
10+
location: `tcp://rw-hook-test:80`,
11+
osi_layer: 'NETWORK',
12+
severity: 'INFORMATIONAL',
13+
attributes: {
14+
port: 80,
15+
state: "Open",
16+
ip_address: "host ip address",
17+
mac_address: "hostInfo.mac",
18+
protocol: "openPort.protocol",
19+
hostname: "hostInfo.hostname",
20+
method: "openPort.method",
21+
operating_system: "hostInfo.osNmap",
22+
service: "openPort.service",
23+
serviceProduct: "openPort.serviceProduct",
24+
serviceVersion: "openPort.serviceVersion",
25+
scripts: "openPort.scriptOutputs",
26+
},
27+
};
28+
29+
const hostFindings = {
30+
name: `Host: hostname`,
31+
category: 'Host',
32+
description: 'Found a host',
33+
location: "hostname",
34+
severity: 'INFORMATIONAL',
35+
osi_layer: 'NETWORK',
36+
attributes: {
37+
ip_address: "ip address",
38+
hostname: "hostname",
39+
operating_system: "osNmap",
40+
},
41+
};
42+
43+
return [...portFindings, ...hostFindings];
44+
}
45+
46+
module.exports.parse = parse;

0 commit comments

Comments
 (0)