suricata-mcp 2.0.0 → 2.1.2
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/README.md +264 -43
- package/dist/chunk-ZDBO3OVL.js +3446 -0
- package/dist/chunk-ZDBO3OVL.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +398 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +272 -1
- package/dist/index.js +15 -3268
- package/dist/index.js.map +1 -1
- package/dist/mcp-bin.d.ts +2 -0
- package/dist/mcp-bin.js +17 -0
- package/dist/mcp-bin.js.map +1 -0
- package/package.json +20 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,273 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
1
3
|
|
|
2
|
-
|
|
4
|
+
interface SuricataConfig {
|
|
5
|
+
evePath: string;
|
|
6
|
+
eveArchiveDir: string;
|
|
7
|
+
rulesDir: string | null;
|
|
8
|
+
maxResults: number;
|
|
9
|
+
unixSocket: string | null;
|
|
10
|
+
zeekLogsDir: string | null;
|
|
11
|
+
pcapDir: string | null;
|
|
12
|
+
mispUrl: string | null;
|
|
13
|
+
mispApiKey: string | null;
|
|
14
|
+
thehiveUrl: string | null;
|
|
15
|
+
thehiveApiKey: string | null;
|
|
16
|
+
allowMutation: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare function getConfig(env?: NodeJS.ProcessEnv): SuricataConfig;
|
|
19
|
+
|
|
20
|
+
declare function createSuricataMcpServer(config?: SuricataConfig): McpServer;
|
|
21
|
+
declare function stripDraftSchemaFromTransport(transport: StdioServerTransport): void;
|
|
22
|
+
declare function serveMcp(config?: SuricataConfig): Promise<void>;
|
|
23
|
+
|
|
24
|
+
type EventType = "alert" | "flow" | "dns" | "http" | "tls" | "fileinfo" | "smtp" | "ssh" | "anomaly" | "stats" | "drop";
|
|
25
|
+
interface EveBase {
|
|
26
|
+
timestamp: string;
|
|
27
|
+
event_type: EventType;
|
|
28
|
+
src_ip?: string;
|
|
29
|
+
src_port?: number;
|
|
30
|
+
dest_ip?: string;
|
|
31
|
+
dest_port?: number;
|
|
32
|
+
proto?: string;
|
|
33
|
+
flow_id?: number;
|
|
34
|
+
in_iface?: string;
|
|
35
|
+
community_id?: string;
|
|
36
|
+
}
|
|
37
|
+
interface AlertEvent extends EveBase {
|
|
38
|
+
event_type: "alert";
|
|
39
|
+
alert: {
|
|
40
|
+
action: "allowed" | "blocked";
|
|
41
|
+
gid: number;
|
|
42
|
+
signature_id: number;
|
|
43
|
+
rev: number;
|
|
44
|
+
signature: string;
|
|
45
|
+
category: string;
|
|
46
|
+
severity: number;
|
|
47
|
+
metadata?: Record<string, string[]>;
|
|
48
|
+
};
|
|
49
|
+
app_proto?: string;
|
|
50
|
+
payload?: string;
|
|
51
|
+
payload_printable?: string;
|
|
52
|
+
http?: HttpDetails;
|
|
53
|
+
dns?: DnsDetails;
|
|
54
|
+
tls?: TlsDetails;
|
|
55
|
+
}
|
|
56
|
+
interface FlowEvent extends EveBase {
|
|
57
|
+
event_type: "flow";
|
|
58
|
+
app_proto?: string;
|
|
59
|
+
flow: {
|
|
60
|
+
pkts_toserver: number;
|
|
61
|
+
pkts_toclient: number;
|
|
62
|
+
bytes_toserver: number;
|
|
63
|
+
bytes_toclient: number;
|
|
64
|
+
start: string;
|
|
65
|
+
end: string;
|
|
66
|
+
age: number;
|
|
67
|
+
state: string;
|
|
68
|
+
reason: string;
|
|
69
|
+
alerted: boolean;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
interface DnsDetails {
|
|
73
|
+
type?: string;
|
|
74
|
+
id?: number;
|
|
75
|
+
rrname?: string;
|
|
76
|
+
rrtype?: string;
|
|
77
|
+
rcode?: string;
|
|
78
|
+
rdata?: string;
|
|
79
|
+
answers?: Array<{
|
|
80
|
+
rrname: string;
|
|
81
|
+
rrtype: string;
|
|
82
|
+
rdata: string;
|
|
83
|
+
ttl: number;
|
|
84
|
+
}>;
|
|
85
|
+
grouped?: Record<string, string[]>;
|
|
86
|
+
tx_id?: number;
|
|
87
|
+
}
|
|
88
|
+
interface DnsEvent extends EveBase {
|
|
89
|
+
event_type: "dns";
|
|
90
|
+
dns: DnsDetails;
|
|
91
|
+
}
|
|
92
|
+
interface HttpDetails {
|
|
93
|
+
hostname?: string;
|
|
94
|
+
url?: string;
|
|
95
|
+
http_user_agent?: string;
|
|
96
|
+
http_content_type?: string;
|
|
97
|
+
http_method?: string;
|
|
98
|
+
protocol?: string;
|
|
99
|
+
status?: number;
|
|
100
|
+
length?: number;
|
|
101
|
+
http_refer?: string;
|
|
102
|
+
redirect?: string;
|
|
103
|
+
}
|
|
104
|
+
interface HttpEvent extends EveBase {
|
|
105
|
+
event_type: "http";
|
|
106
|
+
http: HttpDetails;
|
|
107
|
+
}
|
|
108
|
+
interface TlsDetails {
|
|
109
|
+
subject?: string;
|
|
110
|
+
issuerdn?: string;
|
|
111
|
+
serial?: string;
|
|
112
|
+
fingerprint?: string;
|
|
113
|
+
sni?: string;
|
|
114
|
+
version?: string;
|
|
115
|
+
notbefore?: string;
|
|
116
|
+
notafter?: string;
|
|
117
|
+
ja3?: {
|
|
118
|
+
hash?: string;
|
|
119
|
+
string?: string;
|
|
120
|
+
};
|
|
121
|
+
ja3s?: {
|
|
122
|
+
hash?: string;
|
|
123
|
+
string?: string;
|
|
124
|
+
};
|
|
125
|
+
ja4?: string;
|
|
126
|
+
}
|
|
127
|
+
interface TlsEvent extends EveBase {
|
|
128
|
+
event_type: "tls";
|
|
129
|
+
tls: TlsDetails;
|
|
130
|
+
}
|
|
131
|
+
interface FileinfoEvent extends EveBase {
|
|
132
|
+
event_type: "fileinfo";
|
|
133
|
+
fileinfo: {
|
|
134
|
+
filename?: string;
|
|
135
|
+
magic?: string;
|
|
136
|
+
md5?: string;
|
|
137
|
+
sha1?: string;
|
|
138
|
+
sha256?: string;
|
|
139
|
+
size?: number;
|
|
140
|
+
state?: string;
|
|
141
|
+
stored?: boolean;
|
|
142
|
+
tx_id?: number;
|
|
143
|
+
gaps?: boolean;
|
|
144
|
+
};
|
|
145
|
+
app_proto?: string;
|
|
146
|
+
http?: HttpDetails;
|
|
147
|
+
}
|
|
148
|
+
interface SmtpEvent extends EveBase {
|
|
149
|
+
event_type: "smtp";
|
|
150
|
+
smtp: {
|
|
151
|
+
helo?: string;
|
|
152
|
+
mail_from?: string;
|
|
153
|
+
rcpt_to?: string[];
|
|
154
|
+
};
|
|
155
|
+
email?: {
|
|
156
|
+
from?: string;
|
|
157
|
+
to?: string[];
|
|
158
|
+
subject?: string;
|
|
159
|
+
attachment?: string[];
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
interface SshEvent extends EveBase {
|
|
163
|
+
event_type: "ssh";
|
|
164
|
+
ssh: {
|
|
165
|
+
client?: {
|
|
166
|
+
software_version?: string;
|
|
167
|
+
proto_version?: string;
|
|
168
|
+
};
|
|
169
|
+
server?: {
|
|
170
|
+
software_version?: string;
|
|
171
|
+
proto_version?: string;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
interface AnomalyEvent extends EveBase {
|
|
176
|
+
event_type: "anomaly";
|
|
177
|
+
anomaly: {
|
|
178
|
+
type?: string;
|
|
179
|
+
event?: string;
|
|
180
|
+
layer?: string;
|
|
181
|
+
code?: number;
|
|
182
|
+
};
|
|
183
|
+
tx_id?: number;
|
|
184
|
+
}
|
|
185
|
+
interface StatsEvent extends EveBase {
|
|
186
|
+
event_type: "stats";
|
|
187
|
+
stats: {
|
|
188
|
+
uptime: number;
|
|
189
|
+
capture?: {
|
|
190
|
+
kernel_packets?: number;
|
|
191
|
+
kernel_drops?: number;
|
|
192
|
+
errors?: number;
|
|
193
|
+
};
|
|
194
|
+
decoder?: {
|
|
195
|
+
pkts?: number;
|
|
196
|
+
bytes?: number;
|
|
197
|
+
ipv4?: number;
|
|
198
|
+
ipv6?: number;
|
|
199
|
+
tcp?: number;
|
|
200
|
+
udp?: number;
|
|
201
|
+
icmpv4?: number;
|
|
202
|
+
icmpv6?: number;
|
|
203
|
+
};
|
|
204
|
+
detect?: {
|
|
205
|
+
alert?: number;
|
|
206
|
+
engines?: Array<{
|
|
207
|
+
id: number;
|
|
208
|
+
last_reload: string;
|
|
209
|
+
rules_loaded: number;
|
|
210
|
+
rules_failed: number;
|
|
211
|
+
}>;
|
|
212
|
+
};
|
|
213
|
+
flow?: {
|
|
214
|
+
tcp?: number;
|
|
215
|
+
udp?: number;
|
|
216
|
+
icmpv4?: number;
|
|
217
|
+
icmpv6?: number;
|
|
218
|
+
};
|
|
219
|
+
app_layer?: {
|
|
220
|
+
flow?: Record<string, number>;
|
|
221
|
+
tx?: Record<string, number>;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
interface DropEvent extends EveBase {
|
|
226
|
+
event_type: "drop";
|
|
227
|
+
alert?: AlertEvent["alert"];
|
|
228
|
+
drop: {
|
|
229
|
+
reason?: string;
|
|
230
|
+
action?: string;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
type EveEvent = AlertEvent | FlowEvent | DnsEvent | HttpEvent | TlsEvent | FileinfoEvent | SmtpEvent | SshEvent | AnomalyEvent | StatsEvent | DropEvent;
|
|
234
|
+
interface TimeRange {
|
|
235
|
+
timeFrom?: string;
|
|
236
|
+
timeTo?: string;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
interface QueryOptions {
|
|
240
|
+
eventTypes: EventType[];
|
|
241
|
+
timeRange?: TimeRange;
|
|
242
|
+
maxResults: number;
|
|
243
|
+
}
|
|
244
|
+
declare class QueryEngine {
|
|
245
|
+
private config;
|
|
246
|
+
constructor(config: SuricataConfig);
|
|
247
|
+
query<T extends EveEvent>(eventTypes: EventType[], filter: (event: T) => boolean, options?: {
|
|
248
|
+
timeRange?: TimeRange;
|
|
249
|
+
limit?: number;
|
|
250
|
+
}): Promise<T[]>;
|
|
251
|
+
queryAll<T extends EveEvent>(eventTypes: EventType[], filter: (event: T) => boolean, options?: {
|
|
252
|
+
timeRange?: TimeRange;
|
|
253
|
+
maxEvents?: number;
|
|
254
|
+
}): Promise<T[]>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
interface BeaconCandidate {
|
|
258
|
+
srcIp: string;
|
|
259
|
+
dstIp: string;
|
|
260
|
+
dstPort: number;
|
|
261
|
+
connectionCount: number;
|
|
262
|
+
intervals: number[];
|
|
263
|
+
avgInterval: number;
|
|
264
|
+
stdDevInterval: number;
|
|
265
|
+
jitter: number;
|
|
266
|
+
confidence: number;
|
|
267
|
+
}
|
|
268
|
+
declare function detectBeaconingCandidates(flows: FlowEvent[], minConnections?: number, jitterThreshold?: number): {
|
|
269
|
+
uniquePairsAnalyzed: number;
|
|
270
|
+
candidates: BeaconCandidate[];
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
export { type AlertEvent, type BeaconCandidate, type DnsEvent, type EveEvent, type EventType, type FlowEvent, QueryEngine, type QueryOptions, type SuricataConfig, createSuricataMcpServer, detectBeaconingCandidates, getConfig, serveMcp, stripDraftSchemaFromTransport };
|