jshixiong 1 year ago
parent 3dcc0fdc80
commit 365d264716

@ -8,8 +8,19 @@ from flask import jsonify
virus_queue = []
bugs_queue = []
virus_prefix = "py-virus"
bugs_prefix = "sec-bugs"
# virus_prefix 在三个选项中随机选择
virus_prefix_options = [
"Worm.Linux32.FakeFolder.BS",
"VHEUR/QVM41.2.ABB5.Malware.Gen",
"Hidden.dir.Generic.DWsdh"
]
bugs_prefix_options = [
"KB3023052-Microsoft Edge 2023 BUG",
"KB2880463-Kubectl Sslolo BUG-fix",
"KG3054816-LiveLinux-KSDCO5"
]
virus_size = 6
bugs_size = 5
@ -21,12 +32,15 @@ def initialize_virus_queue():
global virus_queue
for _ in range(virus_size):
random_string = generate_random_string()
# 每次生成数据时,随机选择一个 virus_prefix
virus_prefix = random.choice(virus_prefix_options)
virus_queue.append(f'{virus_prefix}-{random_string}')
def initialize_bugs_queue():
global bugs_queue
for _ in range(bugs_size):
random_string = generate_random_string()
bugs_prefix = random.choice(bugs_prefix_options)
bugs_queue.append(f'{bugs_prefix}-{random_string}')
# 定时检查病毒和漏洞数量
@ -36,11 +50,13 @@ def check_queue_length():
if len(virus_queue) < virus_size:
for _ in range(virus_size - len(virus_queue)):
random_string = generate_random_string()
virus_prefix = random.choice(virus_prefix_options)
virus_queue.append(f'{virus_prefix}-{random_string}')
if len(bugs_queue) < bugs_size:
for _ in range(bugs_size - len(bugs_queue)):
random_string = generate_random_string()
bugs_prefix = random.choice(bugs_prefix_options)
bugs_queue.append(f'{bugs_prefix}-{random_string}')

Loading…
Cancel
Save