-
Notifications
You must be signed in to change notification settings - Fork 0
/
dummy.ts
45 lines (39 loc) · 1.23 KB
/
dummy.ts
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
import axios from 'axios';
const mispUrl = 'https://your-misp-instance-url';
const mispKey = 'YOUR_MISP_API_KEY';
const mispVerifyCert = false;
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
const createDummyEvent = async () => {
const eventInfo = `Dummy Event - ${Math.floor(Math.random() * 90000) + 10000}`;
const eventData = {
info: eventInfo,
distribution: 0,
threat_level_id: 2,
analysis: 1,
Attribute: [
{
type: 'ip-dst',
value: '8.8.8.8'
}
]
};
try {
const response = await axios.post(`${mispUrl}/events/add`, eventData, {
headers: {
Authorization: mispKey,
Accept: 'application/json',
'Content-Type': 'application/json'
},
httpsAgent: mispVerifyCert ? undefined : new (require('https').Agent)({ rejectUnauthorized: false })
});
console.log(`Event ${eventInfo} has been created:`, response.data);
} catch (error) {
console.error('Error creating event:', error);
}
};
(async () => {
while (true) {
await createDummyEvent();
await sleep(5000);
}
})();