Skip to content

Commit 40ee85c

Browse files
authored
Merge pull request #42 from diogoosorio/virtual-host-scanner-constructor-dict-params
Pass the virtual_host_scanner constructor arguments as a dict
2 parents 35b7059 + 61ad716 commit 40ee85c

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

VHostScan.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ def main():
7777
if(arguments.ignore_content_length > 0):
7878
print("[>] Ignoring Content length: %s" % (arguments.ignore_content_length))
7979

80-
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)
80+
scanner_args = vars(arguments)
81+
scanner_args.update({'target': arguments.target_hosts, 'wordlist': wordlist})
82+
scanner = virtual_host_scanner(**scanner_args)
8283

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

lib/core/virtual_host_scanner.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ class virtual_host_scanner(object):
2020
output: folder to write output file to
2121
"""
2222

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):
23+
def __init__(self, target, wordlist, **kwargs):
2424
self.target = target
25-
self.base_host = base_host
26-
self.port = int(port)
27-
self.real_port = int(real_port)
28-
self.ignore_http_codes = list(map(int, ignore_http_codes.replace(' ', '').split(',')))
29-
self.ignore_content_length = ignore_content_length
3025
self.wordlist = wordlist
31-
self.unique_depth = unique_depth
32-
self.ssl = ssl
33-
self.fuzzy_logic = fuzzy_logic
34-
self.add_waf_bypass_headers = add_waf_bypass_headers
26+
self.base_host = kwargs.get('base_host')
27+
self.port = int(kwargs.get('port', 80))
28+
self.real_port = int(kwargs.get('real_port', 80))
29+
self.ignore_content_length = int(kwargs.get('ignore_content_length', 0))
30+
self.ssl = kwargs.get('ssl', False)
31+
self.fuzzy_logic = kwargs.get('fuzzy_logic', False)
32+
self.add_waf_bypass_headers = kwargs.get('add_waf_bypass_headers', False)
33+
self.unique_depth = int(kwargs.get('unique_depth', 1))
34+
self.ignore_http_codes = kwargs.get('ignore_http_codes', '404')
3535

3636
# this can be made redundant in future with better exceptions
3737
self.completed_scan=False
@@ -42,6 +42,13 @@ def __init__(self, target, base_host, wordlist, port=80, real_port=80, ssl=False
4242
# store associated data for discovered hosts in array for oN, oJ, etc'
4343
self.hosts = []
4444

45+
@property
46+
def ignore_http_codes(self):
47+
return self._ignore_http_codes
48+
49+
@ignore_http_codes.setter
50+
def ignore_http_codes(self, codes):
51+
self._ignore_http_codes = [int(code) for code in codes.replace(' ', '').split(',')]
4552

4653
def scan(self):
4754
if not self.base_host:

0 commit comments

Comments
 (0)