Skip to content

Commit 6d76f8a

Browse files
committed
Add rate limiting
1 parent 35b7059 commit 6d76f8a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

VHostScan.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def main():
2828
parser.add_argument('--unique-depth', dest='unique_depth', type=int, help='Show likely matches of page content that is found x times (default 1).', default=1)
2929
parser.add_argument("--ssl", dest="ssl", action="store_true", help="If set then connections will be made over HTTPS instead of HTTP (default http).", default=False)
3030
parser.add_argument("--fuzzy-logic", dest="fuzzy_logic", action="store_true", help="If set then fuzzy match will be performed against unique hosts (default off).", default=False)
31+
parser.add_argument("--rate-limit", dest="rate_limit", type=int, help='Amount of time in seconds between each scan (default 0).', default=0)
3132
parser.add_argument("--waf", dest="add_waf_bypass_headers", action="store_true", help="If set then simple WAF bypass headers will be sent.", default=False)
3233
parser.add_argument("-oN", dest="output_normal", help="Normal output printed to a file when the -oN option is specified with a filename argument." )
3334
parser.add_argument("-", dest="stdin", action="store_true", help="By passing a blank '-' you tell VHostScan to expect input from stdin (pipe).", default=False)
@@ -78,7 +79,7 @@ def main():
7879
print("[>] Ignoring Content length: %s" % (arguments.ignore_content_length))
7980

8081
scanner = virtual_host_scanner( arguments.target_hosts, arguments.base_host, wordlist, arguments.port, arguments.real_port, arguments.ssl,
81-
arguments.unique_depth, arguments.ignore_http_codes, arguments.ignore_content_length, arguments.fuzzy_logic, arguments.add_waf_bypass_headers)
82+
arguments.unique_depth, arguments.ignore_http_codes, arguments.ignore_content_length, arguments.fuzzy_logic, arguments.rate_limit, arguments.add_waf_bypass_headers)
8283

8384
scanner.scan()
8485
output = output_helper(scanner, arguments)

lib/core/virtual_host_scanner.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import requests
33
import hashlib
44
import pandas as pd
5+
import time
56
from lib.core.discovered_host import *
67

78

@@ -20,7 +21,7 @@ class virtual_host_scanner(object):
2021
output: folder to write output file to
2122
"""
2223

23-
def __init__(self, target, base_host, wordlist, port=80, real_port=80, ssl=False, unique_depth=1, ignore_http_codes='404', ignore_content_length=0, fuzzy_logic=False, add_waf_bypass_headers=False):
24+
def __init__(self, target, base_host, wordlist, port=80, real_port=80, ssl=False, unique_depth=1, ignore_http_codes='404', ignore_content_length=0, fuzzy_logic=False, rate_limit=0, add_waf_bypass_headers=False):
2425
self.target = target
2526
self.base_host = base_host
2627
self.port = int(port)
@@ -31,6 +32,7 @@ def __init__(self, target, base_host, wordlist, port=80, real_port=80, ssl=False
3132
self.unique_depth = unique_depth
3233
self.ssl = ssl
3334
self.fuzzy_logic = fuzzy_logic
35+
self.rate_limit = rate_limit
3436
self.add_waf_bypass_headers = add_waf_bypass_headers
3537

3638
# this can be made redundant in future with better exceptions
@@ -104,6 +106,9 @@ def scan(self):
104106

105107
# add url and hash into array for likely matches
106108
self.results.append(hostname + ',' + page_hash)
109+
110+
#rate limit the connection, if the int is 0 it is ignored
111+
time.sleep(self.rate_limit)
107112

108113
self.completed_scan=True
109114

0 commit comments

Comments
 (0)