Skip to content

Commit 2de7519

Browse files
committed
Added prefix and suffix arguments, beginnings of prefix implementation; added verbose argument and updated host scanner to show hosts scanned in verbose mode
1 parent 00d3b10 commit 2de7519

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

VHostScan.py

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def main():
3333

3434
wordlist_helper = WordList()
3535
wordlist, wordlist_types = wordlist_helper.get_wordlist(
36-
arguments.wordlists)
36+
arguments.wordlists, arguments.prefix, arguments.suffix)
3737

3838
if len(wordlist) == 0:
3939
print("[!] No words found in provided wordlists, unable to scan.")
@@ -82,11 +82,16 @@ def main():
8282
wordlist.append(str(ip))
8383
wordlist.append(host)
8484
wordlist.extend(aliases)
85+
if arguments.verbose:
86+
print("[!] Discovered {host}/{ip}. Adding...".format(ip=str(ip), host=host))
8587
except (dns.resolver.NXDOMAIN):
8688
print("[!] Couldn't find any records (NXDOMAIN)")
8789
except (dns.resolver.NoAnswer):
8890
print("[!] Couldn't find any records (NoAnswer)")
8991

92+
if arguments.verbose:
93+
print("[>] Scanning with %s items in wordlist" % len(wordlist))
94+
9095
scanner_args = vars(arguments)
9196
scanner_args.update({
9297
'target': arguments.target_hosts,

lib/core/virtual_host_scanner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def __init__(self, target, wordlist, **kwargs):
5959
self.unique_depth = int(kwargs.get('unique_depth', 1))
6060
self.ignore_http_codes = kwargs.get('ignore_http_codes', '404')
6161
self.first_hit = kwargs.get('first_hit')
62+
self.verbose = kwargs.get('verbose')
6263

6364
self.ignore_content_length = int(
6465
kwargs.get('ignore_content_length', 0)
@@ -104,6 +105,9 @@ def scan(self):
104105
for virtual_host in self.wordlist:
105106
hostname = virtual_host.replace('%s', self.base_host)
106107

108+
if self.verbose:
109+
print("[*] Scanning {hostname}".format(hostname=hostname))
110+
107111
if self.real_port == 80:
108112
host_header = hostname
109113
else:

lib/helpers/wordlist_helper.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def get_stdin_wordlist(self):
1919
return list(line for line in sys.stdin.read().splitlines()) \
2020
if not sys.stdin.isatty() else []
2121

22-
def get_wordlist(self, wordlist_files=None):
22+
def get_wordlist(self, wordlist_files=None, wordlist_prefix=False, wordlist_suffix=False):
2323
default_wordlist_file = DEFAULT_WORDLIST_FILE
2424

2525
stdin_words = self.get_stdin_wordlist()
@@ -29,11 +29,20 @@ def get_wordlist(self, wordlist_files=None):
2929

3030
combined_files = wordlist_files or default_wordlist_file
3131
combined = get_combined_word_lists(combined_files)
32+
3233
if combined:
3334
words_type = 'wordlists: {}'.format(
3435
', '.join(combined['file_paths']))
3536
self.set_words(words_type=words_type, words=combined['words'])
3637

38+
# Apply prefixes
39+
if wordlist_prefix:
40+
prefixed = [wordlist_prefix + word for word in self.wordlist]
41+
self.wordlist = self.wordlist + prefixed
42+
43+
#if wordlist_suffix:
44+
45+
3746
return self.wordlist, self.wordlist_types
3847

3948
def set_words(self, words_type, words):

lib/input.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ def setup_parser():
3434
help='Set the port to use (default 80).'
3535
)
3636

37+
parser.add_argument(
38+
'--prefix', dest='prefix', default=False,
39+
help='Add a prefix to each item in the word list (dev, test etc)'
40+
)
41+
42+
parser.add_argument(
43+
'--suffix', dest='suffix', default=False,
44+
help='Add a suffix to each item in the word list'
45+
)
46+
3747
parser.add_argument(
3848
'-r', dest='real_port', type=int, default=False,
3949
help='The real port of the webserver to use in headers when '
@@ -98,6 +108,11 @@ def setup_parser():
98108
help='If set then simple WAF bypass headers will be sent.'
99109
)
100110

111+
parser.add_argument(
112+
'-v', dest='verbose', action='store_true', default=False,
113+
help='Print verbose output'
114+
)
115+
101116
output = parser.add_mutually_exclusive_group()
102117
output.add_argument(
103118
'-oN', dest='output_normal',

0 commit comments

Comments
 (0)