Repository navigation
Expand file tree
/
Copy pathtest_full_system.py
More file actions
261 lines (233 loc) Β· 8.52 KB
/
Copy pathtest_full_system.py
File metadata and controls
261 lines (233 loc) Β· 8.52 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#!/usr/bin/env python3
"""
DeadSec Framework - Full System Test
Tests all components to ensure everything works correctly
"""
import os
import sys
import importlib.util
import ast
def test_file_exists(filepath, description):
"""Test if a file exists"""
if os.path.exists(filepath):
print(f"β {description}: {filepath}")
return True
else:
print(f"β MISSING: {description} - {filepath}")
return False
def test_python_syntax(filepath, description):
"""Test Python file syntax"""
try:
with open(filepath, 'r', encoding='utf-8') as f:
code = f.read()
ast.parse(code)
print(f"β {description} syntax valid")
return True
except SyntaxError as e:
print(f"β {description} syntax error: {e}")
return False
except Exception as e:
print(f"β {description} check error: {e}")
return False
def test_imports(filepath, description):
"""Test if Python file can be imported"""
try:
spec = importlib.util.spec_from_file_location("test_module", filepath)
if spec and spec.loader:
module = importlib.util.module_from_spec(spec)
sys.modules["test_module"] = module
# Don't execute, just check if it would import
print(f"β {description} imports valid")
return True
else:
print(f"β {description} import spec invalid")
return False
except Exception as e:
print(f"β {description} import warning: {str(e)[:100]}")
return True # Some imports may fail due to missing dependencies
def main():
print("=" * 80)
print(" " * 20 + "DEADSEC FRAMEWORK SYSTEM TEST")
print("=" * 80)
print()
base_dir = os.path.dirname(os.path.abspath(__file__))
results = []
# Core Files
print("π§ TESTING CORE COMPONENTS")
print("-" * 80)
results.append(test_file_exists(os.path.join(base_dir, "src", "cnc_server.py"), "C&C Server"))
results.append(test_file_exists(os.path.join(base_dir, "src", "bot.py"), "Bot Module"))
results.append(test_file_exists(os.path.join(base_dir, "web_gui.html"), "Web GUI"))
results.append(test_file_exists(os.path.join(base_dir, "app.js"), "JavaScript"))
results.append(test_file_exists(os.path.join(base_dir, "styles.css"), "CSS"))
print()
# Python Payloads
print("π― TESTING PYTHON PAYLOADS")
print("-" * 80)
payloads = [
"credential_harvester.py",
"keylogger.py",
"screenshot_capture.py",
"network_scanner.py",
"file_exfiltrator.py",
"privesc_checker.py",
"python_agent.py",
"ddos_attack.py",
"privesc_exploit.py"
]
for payload in payloads:
filepath = os.path.join(base_dir, "payloads", payload)
if test_file_exists(filepath, payload):
test_python_syntax(filepath, payload)
print()
# PowerShell Payloads
print("π» TESTING POWERSHELL PAYLOADS")
print("-" * 80)
ps_payloads = [
"windows_agent.ps1",
"windows_credential_harvester.ps1",
"windows_keylogger.ps1",
"windows_screenshot.ps1",
"windows_network_scanner.ps1",
"windows_file_exfiltrator.ps1",
"windows_geolocation.ps1",
"windows_privesc_checker.ps1",
"windows_ddos.ps1",
"windows_privesc_exploit.ps1"
]
for payload in ps_payloads:
filepath = os.path.join(base_dir, "payloads", payload)
results.append(test_file_exists(filepath, payload))
print()
# Documentation
print("π TESTING DOCUMENTATION")
print("-" * 80)
docs = [
"Readme.md",
"RED_TEAM_GUIDE.md",
"WEB_GUI_GUIDE.md",
"DDOS_ATTACK_GUIDE.md",
"WINDOWS_PAYLOADS_GUIDE.md",
"FRAMEWORK_SUMMARY.md",
"QUICK_REFERENCE.md",
"DEADSEC_LOGO.txt"
]
for doc in docs:
filepath = os.path.join(base_dir, doc)
results.append(test_file_exists(filepath, doc))
print()
# Test Core Python Syntax
print("π¬ TESTING CORE PYTHON SYNTAX")
print("-" * 80)
test_python_syntax(os.path.join(base_dir, "src", "cnc_server.py"), "C&C Server")
test_python_syntax(os.path.join(base_dir, "src", "bot.py"), "Bot Module")
print()
# Test Web GUI Structure
print("π TESTING WEB GUI STRUCTURE")
print("-" * 80)
try:
with open(os.path.join(base_dir, "web_gui.html"), 'r', encoding='utf-8') as f:
html_content = f.read()
checks = [
("DeadSec Title", "DEADSEC" in html_content),
("Privilege Escalation Button", "showPrivescDialog()" in html_content),
("DDoS Attack Button", "showDDoSDialog()" in html_content),
("Privesc Dialog", "privesc-dialog" in html_content),
("DDoS Dialog", "ddos-dialog" in html_content),
("Bot List", "bot-list" in html_content),
("Console Output", "console-output" in html_content),
]
for check_name, check_result in checks:
if check_result:
print(f"β {check_name} present")
results.append(True)
else:
print(f"β {check_name} MISSING")
results.append(False)
except Exception as e:
print(f"β Error reading web_gui.html: {e}")
results.append(False)
print()
# Test JavaScript Functions
print("β‘ TESTING JAVASCRIPT FUNCTIONS")
print("-" * 80)
try:
with open(os.path.join(base_dir, "app.js"), 'r', encoding='utf-8') as f:
js_content = f.read()
functions = [
"showPrivescDialog",
"closePrivescDialog",
"launchPrivesc",
"showDDoSDialog",
"closeDDoSDialog",
"launchDDoS",
"deployPayload",
"refreshBots",
"executeRemoteCommand"
]
for func in functions:
if f"function {func}" in js_content or f"const {func}" in js_content:
print(f"β Function '{func}' defined")
results.append(True)
else:
print(f"β Function '{func}' MISSING")
results.append(False)
except Exception as e:
print(f"β Error reading app.js: {e}")
results.append(False)
print()
# Test Payload Configurations
print("βοΈ TESTING PAYLOAD CONFIGURATIONS")
print("-" * 80)
try:
with open(os.path.join(base_dir, "app.js"), 'r', encoding='utf-8') as f:
js_content = f.read()
payload_configs = [
"credential_harvester",
"keylogger",
"screenshot",
"network_scanner",
"file_exfiltrator",
"privesc_checker",
"geolocation",
"ddos_attack",
"privesc_exploit"
]
for config in payload_configs:
if config in js_content:
print(f"β Payload config '{config}' present")
results.append(True)
else:
print(f"β Payload config '{config}' not found in JS")
results.append(False)
except Exception as e:
print(f"β Error checking payload configs: {e}")
results.append(False)
print()
# Summary
print("=" * 80)
passed = sum(results)
total = len(results)
percentage = (passed / total * 100) if total > 0 else 0
print(f"\nπ TEST RESULTS: {passed}/{total} checks passed ({percentage:.1f}%)\n")
if percentage == 100:
print("π ALL TESTS PASSED! DeadSec Framework is fully operational!")
print("β All core components present")
print("β All payloads available")
print("β Web GUI properly configured")
print("β JavaScript functions defined")
print("\nπ You can start the server with: python src/cnc_server.py")
print("π Access the web GUI at: http://localhost:5000")
elif percentage >= 90:
print("β
Framework is operational with minor issues")
print("β οΈ Some optional components may be missing")
elif percentage >= 75:
print("β οΈ Framework is partially operational")
print("β Some critical components may need attention")
else:
print("β Framework has significant issues")
print("β Multiple critical components are missing")
print("\n" + "=" * 80)
return 0 if percentage >= 90 else 1
if __name__ == "__main__":
sys.exit(main())