-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathverify_installation.py
More file actions
executable file
·148 lines (123 loc) · 4.19 KB
/
verify_installation.py
File metadata and controls
executable file
·148 lines (123 loc) · 4.19 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
#!/usr/bin/env python3
"""
RelayKing Installation Verification Script
Checks that all dependencies are installed and modules can be imported
"""
import sys
import importlib
def check_python_version():
"""Check Python version is 3.8+"""
print("[*] Checking Python version...")
version = sys.version_info
if version.major < 3 or (version.major == 3 and version.minor < 8):
print(f"[!] ERROR: Python 3.8+ required, found {version.major}.{version.minor}")
return False
print(f"[+] Python {version.major}.{version.minor}.{version.micro} OK")
return True
def check_dependencies():
"""Check required Python packages"""
print("\n[*] Checking dependencies...")
dependencies = {
'impacket': 'Impacket (SMB, LDAP, MSSQL protocols)',
'requests': 'Requests (HTTP/HTTPS)',
'requests_ntlm': 'Requests-NTLM (NTLM auth for HTTP)',
'ldap3': 'LDAP3 (LDAP operations)',
'dns.resolver': 'dnspython (DNS resolution)',
'pyasn1': 'PyASN1 (ASN.1 encoding)',
'urllib3': 'urllib3 (HTTP client)',
}
all_ok = True
for module, description in dependencies.items():
try:
importlib.import_module(module)
print(f"[+] {description}: OK")
except ImportError:
print(f"[!] {description}: MISSING")
all_ok = False
return all_ok
def check_modules():
"""Check RelayKing modules can be imported"""
print("\n[*] Checking RelayKing modules...")
modules = [
'core.banner',
'core.config',
'core.target_parser',
'core.scanner',
'core.relay_analyzer',
'protocols.base_detector',
'protocols.smb_detector',
'protocols.http_detector',
'protocols.ldap_detector',
'protocols.mssql_detector',
'protocols.additional_detectors',
'detectors.webdav_detector',
'detectors.ntlm_reflection',
'detectors.coercion',
'output.formatters',
]
all_ok = True
for module in modules:
try:
importlib.import_module(module)
print(f"[+] {module}: OK")
except ImportError as e:
print(f"[!] {module}: FAILED - {e}")
all_ok = False
return all_ok
def check_syntax():
"""Check syntax of all Python files"""
print("\n[*] Checking Python syntax...")
import ast
import os
all_ok = True
for root, dirs, files in os.walk('.'):
# Skip __pycache__ and venv directories
dirs[:] = [d for d in dirs if d not in ['__pycache__', 'venv', 'env', '.git']]
for file in files:
if file.endswith('.py'):
filepath = os.path.join(root, file)
try:
with open(filepath, 'r') as f:
ast.parse(f.read())
except SyntaxError as e:
print(f"[!] Syntax error in {filepath}: {e}")
all_ok = False
if all_ok:
print("[+] All Python files have valid syntax")
return all_ok
def main():
"""Run all verification checks"""
print("=" * 80)
print("RelayKing Installation Verification")
print("=" * 80)
checks = [
("Python Version", check_python_version),
("Dependencies", check_dependencies),
("Modules", check_modules),
("Syntax", check_syntax),
]
results = {}
for name, check_func in checks:
results[name] = check_func()
# Summary
print("\n" + "=" * 80)
print("SUMMARY")
print("=" * 80)
all_passed = all(results.values())
for name, passed in results.items():
status = "PASS" if passed else "FAIL"
symbol = "[+]" if passed else "[!]"
print(f"{symbol} {name}: {status}")
print("=" * 80)
if all_passed:
print("\n[+] All checks passed! RelayKing is ready to use.")
print("\nQuick start:")
print(" python3 relayking.py --help")
print(" python3 relayking.py -u user -p password -d domain.local --audit")
return 0
else:
print("\n[!] Some checks failed. Please install missing dependencies:")
print(" pip install -r requirements.txt")
return 1
if __name__ == "__main__":
sys.exit(main())