-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmalware_simulator.py
More file actions
111 lines (91 loc) · 3.34 KB
/
Copy pathmalware_simulator.py
File metadata and controls
111 lines (91 loc) · 3.34 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import os
import sys
import time
import shutil
import tempfile
import socket
import subprocess
def heavy_computation(intensity=1):
"""Spikes CPU usage."""
while True:
_ = [x**2 for x in range(1000 * intensity)]
time.sleep(0.01)
def keep_network_open():
"""Maintains a network connection."""
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("8.8.8.8", 53)) # Connect to Google DNS
while True:
time.sleep(1)
except:
pass
def child_process():
"""Runs the specific behavior requested via CLI args."""
mode = sys.argv[1] if len(sys.argv) > 1 else "green"
print(f"[{os.getpid()}] Running in mode: {mode}")
if "net" in mode:
import threading
t = threading.Thread(target=keep_network_open, daemon=True)
t.start()
if "high_cpu" in mode:
heavy_computation(50)
elif "med_cpu" in mode:
heavy_computation(10)
else:
while True:
time.sleep(1)
def main():
if len(sys.argv) > 1 and sys.argv[1] != "spawner":
child_process()
return
print("========================================")
print("💀 NexaShield AI Threat Simulator 💀")
print("========================================")
current_path = os.path.abspath(__file__)
temp_dir = tempfile.gettempdir()
appdata_dir = os.environ.get('APPDATA', temp_dir)
# Create the scripts
temp_script = os.path.join(temp_dir, "red_threat_sim.py")
appdata_script = os.path.join(appdata_dir, "orange_threat_sim.py")
try: shutil.copy2(current_path, temp_script)
except: pass
try: shutil.copy2(current_path, appdata_script)
except: pass
processes = []
print("[*] Spawning 4 Green (Safe) processes...")
for _ in range(4):
p = subprocess.Popen([sys.executable, current_path, "green"])
processes.append(p)
print("[*] Spawning 4 Blue (Low Risk) processes...")
for _ in range(4):
p = subprocess.Popen([sys.executable, current_path, "blue_med_cpu"])
processes.append(p)
print("[*] Spawning 4 Yellow (Moderate Risk) processes...")
for _ in range(4):
p = subprocess.Popen([sys.executable, current_path, "yellow_high_cpu"])
processes.append(p)
print("[*] Spawning 4 Orange (High Risk) processes...")
for _ in range(4):
p = subprocess.Popen([sys.executable, appdata_script, "orange_net"])
processes.append(p)
print("[*] Spawning 4 Red (Critical) processes...")
for _ in range(4):
p = subprocess.Popen([sys.executable, temp_script, "red_high_cpu_net"])
processes.append(p)
print("\n[🔥] ALL 20 SIMULATOR PROCESSES ARE NOW RUNNING [🔥]")
print("----------------------------------------")
print("👉 Go to NexaShield -> Processes Tab")
print("👉 Look for 'python.exe' processes.")
print("👉 You should see a perfect rainbow of Green, Blue, Yellow, Orange, and Red!")
print("----------------------------------------")
print("Press CTRL+C to stop all simulators.")
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
print("\n[*] Stopping simulators...")
for p in processes:
p.terminate()
sys.exit(0)
if __name__ == "__main__":
main()