Skip to content

Commit e676ba0

Browse files
authored
Merge pull request #40 from grimd34th/master
Add rate limiting - Untested
2 parents 40ee85c + 2fd32f0 commit e676ba0

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ $ pip install -r requirements.txt
4040
| --unique-depth UNIQUE_DEPTH | Show likely matches of page content that is found x times (default 1). |
4141
| --ssl | If set then connections will be made over HTTPS instead of HTTP. |
4242
| --fuzzy-logic | If set then all unique content replies are compared and a similarity ratio is given for each pair. This helps to isolate vhosts in situations where a default page isn't static (such as having the time on it). |
43+
| --rate_limit | Amount of time in seconds to delay between each scan (default 0). |
4344
| --waf | If set then simple WAF bypass headers will be sent. |
4445
| -oN OUTPUT_NORMAL | Normal output printed to a file when the -oN option is specified with a filename argument. |
4546
| - | By passing a blank '-' you tell VHostScan to expect input from stdin (pipe). |

VHostScan.py

Lines changed: 1 addition & 0 deletions
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 to delay 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)

lib/core/virtual_host_scanner.py

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

78

8-
99
class virtual_host_scanner(object):
1010
"""Virtual host scanning class
1111
@@ -19,11 +19,13 @@ class virtual_host_scanner(object):
1919
ignore_content_length: integer value of content length to ignore
2020
output: folder to write output file to
2121
"""
22-
22+
23+
2324
def __init__(self, target, wordlist, **kwargs):
2425
self.target = target
2526
self.wordlist = wordlist
2627
self.base_host = kwargs.get('base_host')
28+
self.rate_limit = int(kwargs.get('rate_limit', 0))
2729
self.port = int(kwargs.get('port', 80))
2830
self.real_port = int(kwargs.get('real_port', 80))
2931
self.ignore_content_length = int(kwargs.get('ignore_content_length', 0))
@@ -50,6 +52,7 @@ def ignore_http_codes(self):
5052
def ignore_http_codes(self, codes):
5153
self._ignore_http_codes = [int(code) for code in codes.replace(' ', '').split(',')]
5254

55+
5356
def scan(self):
5457
if not self.base_host:
5558
self.base_host = self.target
@@ -111,6 +114,9 @@ def scan(self):
111114

112115
# add url and hash into array for likely matches
113116
self.results.append(hostname + ',' + page_hash)
117+
118+
#rate limit the connection, if the int is 0 it is ignored
119+
time.sleep(self.rate_limit)
114120

115121
self.completed_scan=True
116122

0 commit comments

Comments
 (0)