-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbot.py
More file actions
45 lines (31 loc) · 1.05 KB
/
bot.py
File metadata and controls
45 lines (31 loc) · 1.05 KB
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 json
import random
BATCH = 1000
LIMIT = 5
ALPHA = 2
data = []
export = []
if __name__ == "__main__":
print("[01] starting ...")
with open("files/map.txt", "r") as file:
for line in file:
tmp = line.rstrip()
parts = tmp.split("=>")
print(f"[02] loading {parts[0]} batch.")
data.append({
"key": parts[0],
"list": [x.strip("\"") for x in parts[1].split(";")]
})
print("[03] data loaded.")
for _ in range(0, BATCH):
index = random.randint(0, len(data) - 2)
item = data[index]['key']
array = random.sample(data[index]['list'], k=random.randint(1,LIMIT))
if random.randint(0, 10) < ALPHA:
array += random.sample(data[len(data)-1]['list'], k=ALPHA)
export.append({
"attack": item,
"vulenrabilities": array
})
with open("out.json", 'w') as file:
file.write(json.dumps(export, indent=4))