@j3r3mcdev/oast-server 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +29 -29
- package/.github/workflows/publish.yml +31 -31
- package/README.md +192 -192
- package/dist/core/router.d.ts +1 -0
- package/dist/core/router.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -1
- package/jest.config.js +14 -14
- package/package.json +45 -45
- package/sadmin list shadows +9 -9
- package/src/api/controllers/__tests__/tasks.controller.test.ts +74 -74
- package/src/api/controllers/events.controller.ts +10 -10
- package/src/api/controllers/health.controller.ts +7 -7
- package/src/api/controllers/tasks.controller.ts +41 -41
- package/src/api/dto/__tests__/create-task.dto.test.ts +41 -41
- package/src/api/dto/__tests__/filter-tasks.dto.test.ts +35 -35
- package/src/api/dto/create-task.dto.ts +33 -33
- package/src/api/dto/filter-tasks.dto.ts +33 -33
- package/src/api/services/__tests__/events.service.test.ts +41 -41
- package/src/api/services/__tests__/tasks.service.test.ts +41 -41
- package/src/api/services/events.service.ts +17 -17
- package/src/api/services/tasks.service.ts +79 -79
- package/src/api/sse/events.stream.ts +90 -90
- package/src/bootstrap.ts +89 -89
- package/src/core/__tests__/core-router.test.ts +30 -30
- package/src/core/__tests__/core-server.test.ts +44 -44
- package/src/core/__tests__/event.normalizer.test.ts +56 -56
- package/src/core/__tests__/event.router.test.ts +89 -89
- package/src/core/__tests__/logger.test.ts +32 -32
- package/src/core/__tests__/storage-manager.test.ts +74 -74
- package/src/core/event.normalizer.ts +147 -147
- package/src/core/event.router.ts +13 -13
- package/src/core/http/__tests__/adapter-node.test.ts +52 -52
- package/src/core/http/__tests__/body-parser-multipart.test.ts +41 -41
- package/src/core/http/__tests__/body-parser-raw.test.ts +28 -28
- package/src/core/http/__tests__/body-parser-text.test.ts +28 -28
- package/src/core/http/__tests__/compile-path.test.ts +39 -39
- package/src/core/http/__tests__/middleware-pipeline.test.ts +51 -51
- package/src/core/http/__tests__/request.test.ts +34 -34
- package/src/core/http/__tests__/response.test.ts +35 -35
- package/src/core/http/__tests__/router-match.test.ts +171 -171
- package/src/core/http/adapter-node.ts +51 -51
- package/src/core/http/buildRequest.ts +18 -18
- package/src/core/http/compile-path.ts +32 -32
- package/src/core/http/errors.ts +37 -37
- package/src/core/http/http-server.ts +52 -52
- package/src/core/http/middleware.ts +160 -160
- package/src/core/http/request.ts +55 -55
- package/src/core/http/response.ts +93 -93
- package/src/core/http/router.ts +138 -138
- package/src/core/id-generator.ts +8 -8
- package/src/core/logger.ts +113 -113
- package/src/core/router.ts +44 -44
- package/src/core/server.ts +85 -85
- package/src/core/storage.ts +64 -64
- package/src/index.ts +14 -14
- package/src/listeners/api/__tests__/api.controller.test.ts +116 -116
- package/src/listeners/api/__tests__/api.extractor.test.ts +46 -46
- package/src/listeners/api/__tests__/api.listener.test.ts +82 -82
- package/src/listeners/api/__tests__/api.routes.test.ts +155 -155
- package/src/listeners/api/__tests__/api.sse.test.ts +105 -105
- package/src/listeners/api/api.controllers.ts +67 -67
- package/src/listeners/api/api.extractor.ts +43 -43
- package/src/listeners/api/api.listener.ts +50 -50
- package/src/listeners/api/api.routes.ts +76 -76
- package/src/listeners/api/api.sse.ts +38 -38
- package/src/listeners/dns/__tests__/dns.test.ts +118 -118
- package/src/listeners/dns/dns.extractor.ts +14 -14
- package/src/listeners/dns/dns.listener.ts +61 -61
- package/src/listeners/http/__tests__/http.extractor.test.ts +59 -59
- package/src/listeners/http/__tests__/http.listener.test.ts +133 -133
- package/src/listeners/http/http.extractor.ts +15 -15
- package/src/listeners/http/http.listener.ts +110 -110
- package/src/listeners/listener.interface.ts +4 -4
- package/src/listeners/smtp/__tests__/smtp.extractor.test.ts +69 -69
- package/src/listeners/smtp/__tests__/smtp.listener.test.ts +150 -150
- package/src/listeners/smtp/smtp.extractor.ts +18 -18
- package/src/listeners/smtp/smtp.listener.ts +60 -60
- package/src/listeners/ssrf/__tests__/ssrf.extractor.test.ts +41 -41
- package/src/listeners/ssrf/__tests__/ssrf.listener.test.ts +87 -87
- package/src/listeners/ssrf/ssrf.extractor.ts +14 -14
- package/src/listeners/ssrf/ssrf.listener.ts +37 -37
- package/src/listeners/tcp/tcp.extractor.ts +16 -16
- package/src/listeners/tcp/tcp.listener.ts +61 -61
- package/src/listeners/webhook/__tests__/webhook.extractor.test.ts +35 -35
- package/src/listeners/webhook/__tests__/webhook.listener.test.ts +122 -122
- package/src/listeners/webhook/webhook.extractor.ts +12 -12
- package/src/listeners/webhook/webhook.listener.ts +58 -58
- package/src/listeners/websocket/__tests__/websocket.extractor.test.ts +33 -33
- package/src/listeners/websocket/__tests__/websocket.listener.test.ts +90 -90
- package/src/listeners/websocket/websocket.extractor.ts +11 -11
- package/src/listeners/websocket/websocket.listener.ts +40 -40
- package/src/storage-adapters/adapters/__tests__/memory.storage.test.ts +75 -75
- package/src/storage-adapters/adapters/memory.storage.ts +64 -64
- package/src/storage-adapters/storage.interface.ts +26 -26
- package/src/types/event.types.ts +147 -147
- package/tsconfig.json +20 -21
package/src/types/event.types.ts
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
//
|
|
2
|
-
// RAW EVENTS
|
|
3
|
-
//
|
|
4
|
-
export interface RawEvent {
|
|
5
|
-
ip: string;
|
|
6
|
-
method: string;
|
|
7
|
-
path: string;
|
|
8
|
-
headers: Record<string, string | string[] | undefined>;
|
|
9
|
-
query: Record<string, any>;
|
|
10
|
-
body: any;
|
|
11
|
-
raw: any;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface RawDnsEvent {
|
|
15
|
-
ip: string;
|
|
16
|
-
query: string;
|
|
17
|
-
recordType: string;
|
|
18
|
-
raw: any;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface RawSmtpEvent {
|
|
22
|
-
ip: string;
|
|
23
|
-
from: string;
|
|
24
|
-
to: string[];
|
|
25
|
-
subject: string;
|
|
26
|
-
body: string;
|
|
27
|
-
raw: any;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface RawTcpEvent {
|
|
31
|
-
ip: string;
|
|
32
|
-
port: number;
|
|
33
|
-
data: string;
|
|
34
|
-
raw: any;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface RawSsrfEvent {
|
|
38
|
-
ip: string;
|
|
39
|
-
method: string | undefined;
|
|
40
|
-
path: string | undefined;
|
|
41
|
-
headers: Record<string, string | string[] | undefined>;
|
|
42
|
-
query: Record<string, any>;
|
|
43
|
-
raw: any;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface RawWebhookEvent {
|
|
47
|
-
ip: string;
|
|
48
|
-
headers: Record<string, string | string[] | undefined>;
|
|
49
|
-
body: any;
|
|
50
|
-
raw: any;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface RawWebSocketEvent {
|
|
54
|
-
ip: string;
|
|
55
|
-
message: string;
|
|
56
|
-
raw: any;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
// NORMALIZED EVENTS
|
|
61
|
-
//
|
|
62
|
-
export interface NormalizedHttpEvent {
|
|
63
|
-
id: string;
|
|
64
|
-
type: "http";
|
|
65
|
-
timestamp: number;
|
|
66
|
-
sourceIp: string;
|
|
67
|
-
request: {
|
|
68
|
-
method: string;
|
|
69
|
-
path: string;
|
|
70
|
-
headers: Record<string, string | string[] | undefined>;
|
|
71
|
-
query: Record<string, any>;
|
|
72
|
-
body: any;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface NormalizedDnsEvent {
|
|
77
|
-
id: string;
|
|
78
|
-
type: "dns";
|
|
79
|
-
timestamp: number;
|
|
80
|
-
ip: string;
|
|
81
|
-
query: string;
|
|
82
|
-
recordType: string;
|
|
83
|
-
raw: any;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface NormalizedSmtpEvent {
|
|
87
|
-
id: string;
|
|
88
|
-
type: "smtp";
|
|
89
|
-
timestamp: number;
|
|
90
|
-
ip: string;
|
|
91
|
-
from: string;
|
|
92
|
-
to: string[];
|
|
93
|
-
subject: string;
|
|
94
|
-
body: string;
|
|
95
|
-
raw: any;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface NormalizedTcpEvent {
|
|
99
|
-
id: string;
|
|
100
|
-
type: "tcp";
|
|
101
|
-
timestamp: number;
|
|
102
|
-
ip: string;
|
|
103
|
-
port: number;
|
|
104
|
-
data: string;
|
|
105
|
-
raw: any;
|
|
106
|
-
}
|
|
107
|
-
export interface NormalizedSsrfEvent {
|
|
108
|
-
id: string;
|
|
109
|
-
type: "ssrf";
|
|
110
|
-
timestamp: number;
|
|
111
|
-
sourceIp: string;
|
|
112
|
-
request: {
|
|
113
|
-
method: string | undefined;
|
|
114
|
-
path: string | undefined;
|
|
115
|
-
headers: Record<string, string | string[] | undefined>;
|
|
116
|
-
query: Record<string, any>;
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface NormalizedWebhookEvent {
|
|
121
|
-
id: string;
|
|
122
|
-
type: "webhook";
|
|
123
|
-
timestamp: number;
|
|
124
|
-
sourceIp: string;
|
|
125
|
-
headers: Record<string, string | string[] | undefined>;
|
|
126
|
-
body: any;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export interface NormalizedWebSocketEvent {
|
|
130
|
-
id: string;
|
|
131
|
-
type: "websocket";
|
|
132
|
-
timestamp: number;
|
|
133
|
-
sourceIp: string;
|
|
134
|
-
message: string;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
//
|
|
138
|
-
// UNION
|
|
139
|
-
//
|
|
140
|
-
export type AnyNormalizedEvent =
|
|
141
|
-
| NormalizedHttpEvent
|
|
142
|
-
| NormalizedDnsEvent
|
|
143
|
-
| NormalizedSmtpEvent
|
|
144
|
-
| NormalizedTcpEvent
|
|
145
|
-
| NormalizedSsrfEvent
|
|
146
|
-
| NormalizedWebhookEvent
|
|
147
|
-
| NormalizedWebSocketEvent;
|
|
1
|
+
//
|
|
2
|
+
// RAW EVENTS
|
|
3
|
+
//
|
|
4
|
+
export interface RawEvent {
|
|
5
|
+
ip: string;
|
|
6
|
+
method: string;
|
|
7
|
+
path: string;
|
|
8
|
+
headers: Record<string, string | string[] | undefined>;
|
|
9
|
+
query: Record<string, any>;
|
|
10
|
+
body: any;
|
|
11
|
+
raw: any;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface RawDnsEvent {
|
|
15
|
+
ip: string;
|
|
16
|
+
query: string;
|
|
17
|
+
recordType: string;
|
|
18
|
+
raw: any;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface RawSmtpEvent {
|
|
22
|
+
ip: string;
|
|
23
|
+
from: string;
|
|
24
|
+
to: string[];
|
|
25
|
+
subject: string;
|
|
26
|
+
body: string;
|
|
27
|
+
raw: any;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface RawTcpEvent {
|
|
31
|
+
ip: string;
|
|
32
|
+
port: number;
|
|
33
|
+
data: string;
|
|
34
|
+
raw: any;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface RawSsrfEvent {
|
|
38
|
+
ip: string;
|
|
39
|
+
method: string | undefined;
|
|
40
|
+
path: string | undefined;
|
|
41
|
+
headers: Record<string, string | string[] | undefined>;
|
|
42
|
+
query: Record<string, any>;
|
|
43
|
+
raw: any;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface RawWebhookEvent {
|
|
47
|
+
ip: string;
|
|
48
|
+
headers: Record<string, string | string[] | undefined>;
|
|
49
|
+
body: any;
|
|
50
|
+
raw: any;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface RawWebSocketEvent {
|
|
54
|
+
ip: string;
|
|
55
|
+
message: string;
|
|
56
|
+
raw: any;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//
|
|
60
|
+
// NORMALIZED EVENTS
|
|
61
|
+
//
|
|
62
|
+
export interface NormalizedHttpEvent {
|
|
63
|
+
id: string;
|
|
64
|
+
type: "http";
|
|
65
|
+
timestamp: number;
|
|
66
|
+
sourceIp: string;
|
|
67
|
+
request: {
|
|
68
|
+
method: string;
|
|
69
|
+
path: string;
|
|
70
|
+
headers: Record<string, string | string[] | undefined>;
|
|
71
|
+
query: Record<string, any>;
|
|
72
|
+
body: any;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface NormalizedDnsEvent {
|
|
77
|
+
id: string;
|
|
78
|
+
type: "dns";
|
|
79
|
+
timestamp: number;
|
|
80
|
+
ip: string;
|
|
81
|
+
query: string;
|
|
82
|
+
recordType: string;
|
|
83
|
+
raw: any;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface NormalizedSmtpEvent {
|
|
87
|
+
id: string;
|
|
88
|
+
type: "smtp";
|
|
89
|
+
timestamp: number;
|
|
90
|
+
ip: string;
|
|
91
|
+
from: string;
|
|
92
|
+
to: string[];
|
|
93
|
+
subject: string;
|
|
94
|
+
body: string;
|
|
95
|
+
raw: any;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface NormalizedTcpEvent {
|
|
99
|
+
id: string;
|
|
100
|
+
type: "tcp";
|
|
101
|
+
timestamp: number;
|
|
102
|
+
ip: string;
|
|
103
|
+
port: number;
|
|
104
|
+
data: string;
|
|
105
|
+
raw: any;
|
|
106
|
+
}
|
|
107
|
+
export interface NormalizedSsrfEvent {
|
|
108
|
+
id: string;
|
|
109
|
+
type: "ssrf";
|
|
110
|
+
timestamp: number;
|
|
111
|
+
sourceIp: string;
|
|
112
|
+
request: {
|
|
113
|
+
method: string | undefined;
|
|
114
|
+
path: string | undefined;
|
|
115
|
+
headers: Record<string, string | string[] | undefined>;
|
|
116
|
+
query: Record<string, any>;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface NormalizedWebhookEvent {
|
|
121
|
+
id: string;
|
|
122
|
+
type: "webhook";
|
|
123
|
+
timestamp: number;
|
|
124
|
+
sourceIp: string;
|
|
125
|
+
headers: Record<string, string | string[] | undefined>;
|
|
126
|
+
body: any;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface NormalizedWebSocketEvent {
|
|
130
|
+
id: string;
|
|
131
|
+
type: "websocket";
|
|
132
|
+
timestamp: number;
|
|
133
|
+
sourceIp: string;
|
|
134
|
+
message: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
//
|
|
138
|
+
// UNION
|
|
139
|
+
//
|
|
140
|
+
export type AnyNormalizedEvent =
|
|
141
|
+
| NormalizedHttpEvent
|
|
142
|
+
| NormalizedDnsEvent
|
|
143
|
+
| NormalizedSmtpEvent
|
|
144
|
+
| NormalizedTcpEvent
|
|
145
|
+
| NormalizedSsrfEvent
|
|
146
|
+
| NormalizedWebhookEvent
|
|
147
|
+
| NormalizedWebSocketEvent;
|
package/tsconfig.json
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"outDir": "dist",
|
|
8
|
-
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"emitDeclarationOnly": false,
|
|
11
|
+
|
|
12
|
+
"strict": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"resolveJsonModule": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*"],
|
|
19
|
+
"exclude": ["node_modules", "dist"]
|
|
20
|
+
}
|