@@ -64,7 +64,7 @@ def generate_random_event():
64
64
'created' : generate_random_date (),
65
65
'dataset' : random .choice (['process' , 'file' , 'registry' , 'socket' , 'dns' , 'http' , 'tls' , 'alert' ,
66
66
'authentication' , 'authorization' , 'configuration' , 'communication' , 'file' ,
67
- 'network' , 'process' , 'registry' , 'storage' , 'system' , 'web' ]),
67
+ 'network' , 'process' , 'registry' , 'storage' , 'system' , 'web' ]),
68
68
'duration' : random .randint (0 , 99999 ),
69
69
'end' : generate_random_date (),
70
70
'hash' : str (hash (f'hash{ random .randint (0 , 99999 )} ' )),
@@ -74,12 +74,12 @@ def generate_random_event():
74
74
'state' , 'pipeline_error' , 'signal' ]),
75
75
'module' : random .choice (['process' , 'file' , 'registry' , 'socket' , 'dns' , 'http' , 'tls' , 'alert' ,
76
76
'authentication' , 'authorization' , 'configuration' , 'communication' , 'file' ,
77
- 'network' , 'process' , 'registry' , 'storage' , 'system' , 'web' ]),
77
+ 'network' , 'process' , 'registry' , 'storage' , 'system' , 'web' ]),
78
78
'original' : f'original{ random .randint (0 , 99999 )} ' ,
79
79
'outcome' : random .choice (['success' , 'failure' , 'unknown' ]),
80
80
'provider' : random .choice (['process' , 'file' , 'registry' , 'socket' , 'dns' , 'http' , 'tls' , 'alert' ,
81
81
'authentication' , 'authorization' , 'configuration' , 'communication' , 'file' ,
82
- 'network' , 'process' , 'registry' , 'storage' , 'system' , 'web' ]),
82
+ 'network' , 'process' , 'registry' , 'storage' , 'system' , 'web' ]),
83
83
'reason' : f'This event happened due to reason{ random .randint (0 , 99999 )} ' ,
84
84
'reference' : f'https://system.example.com/event/#{ random .randint (0 , 99999 )} ' ,
85
85
'risk_score' : round (random .uniform (0 , 10 ), 1 ),
@@ -89,15 +89,16 @@ def generate_random_event():
89
89
'start' : generate_random_date (),
90
90
'timezone' : random .choice (['UTC' , 'GMT' , 'PST' , 'EST' , 'CST' , 'MST' , 'PDT' , 'EDT' , 'CDT' , 'MDT' ]),
91
91
'type' : random .choice (['access' , 'admin' , 'allowed' , 'change' , 'connection' , 'creation' , 'deletion' ,
92
- 'denied' , 'end' , 'error' , 'group' , 'indicator' , 'info' , 'installation' , 'protocol' ,
93
- 'start' , 'user' ]),
92
+ 'denied' , 'end' , 'error' , 'group' , 'indicator' , 'info' , 'installation' , 'protocol' ,
93
+ 'start' , 'user' ]),
94
94
'url' : f'http://mysystem.example.com/alert/{ random .randint (0 , 99999 )} '
95
95
}
96
96
return event
97
97
98
98
99
99
def generate_random_host ():
100
- family = random .choice (['debian' , 'ubuntu' , 'macos' , 'ios' , 'android' , 'RHEL' ])
100
+ family = random .choice (
101
+ ['debian' , 'ubuntu' , 'macos' , 'ios' , 'android' , 'RHEL' ])
101
102
version = f'{ random .randint (0 , 99 )} .{ random .randint (0 , 99 )} '
102
103
host = {
103
104
'os' : {
@@ -114,7 +115,8 @@ def generate_random_host():
114
115
115
116
116
117
def generate_random_labels ():
117
- labels = {'label1' : f'label{ random .randint (0 , 99 )} ' , 'label2' : f'label{ random .randint (0 , 99 )} ' }
118
+ labels = {
119
+ 'label1' : f'label{ random .randint (0 , 99 )} ' , 'label2' : f'label{ random .randint (0 , 99 )} ' }
118
120
return labels
119
121
120
122
@@ -133,7 +135,7 @@ def generate_random_package():
133
135
'size' : random .randint (0 , 99999 ),
134
136
'type' : random .choice (['deb' , 'rpm' , 'msi' , 'pkg' , 'app' , 'apk' , 'exe' , 'zip' , 'tar' , 'gz' , '7z' ,
135
137
'rar' , 'cab' , 'iso' , 'dmg' , 'tar.gz' , 'tar.bz2' , 'tar.xz' , 'tar.Z' , 'tar.lz4' ,
136
- 'tar.sz' , 'tar.zst' ]),
138
+ 'tar.sz' , 'tar.zst' ]),
137
139
'version' : f'v{ random .randint (0 , 9 )} -stable'
138
140
}
139
141
return package
@@ -166,20 +168,30 @@ def generate_random_vulnerability():
166
168
return vulnerability
167
169
168
170
171
+ def generate_random_wazuh ():
172
+ wazuh = {
173
+ 'cluster' : {
174
+ 'name' : f'wazuh-cluster-{ random .randint (0 ,10 )} '
175
+ }
176
+ }
177
+ return wazuh
178
+
179
+
169
180
def generate_random_data (number ):
170
181
data = []
171
182
for _ in range (number ):
172
183
event_data = {
173
184
'@timestamp' : generate_random_date (),
174
185
'agent' : generate_random_agent (),
175
186
'ecs' : {'version' : '1.7.0' },
176
- 'event' : generate_random_event (),
187
+ # 'event': generate_random_event(),
177
188
'host' : generate_random_host (),
178
189
'labels' : generate_random_labels (),
179
190
'message' : f'message{ random .randint (0 , 99999 )} ' ,
180
191
'package' : generate_random_package (),
181
192
'tags' : generate_random_tags (),
182
- 'vulnerability' : generate_random_vulnerability ()
193
+ 'vulnerability' : generate_random_vulnerability (),
194
+ 'wazuh' : generate_random_wazuh ()
183
195
}
184
196
data .append (event_data )
185
197
return data
@@ -221,7 +233,8 @@ def main():
221
233
222
234
logging .info ('Data generation completed.' )
223
235
224
- inject = input ("Do you want to inject the generated data into your indexer? (y/n) " ).strip ().lower ()
236
+ inject = input (
237
+ "Do you want to inject the generated data into your indexer? (y/n) " ).strip ().lower ()
225
238
if inject == 'y' :
226
239
ip = input ("Enter the IP of your Indexer: " )
227
240
port = input ("Enter the port of your Indexer: " )
0 commit comments