Skip to content

Fixed bug where wordlists would be always default without stdin #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions VHostScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main():
print_banner()
parser = ArgumentParser()
parser.add_argument("-t", dest="target_hosts", required=True, help="Set a target range of addresses to target. Ex 10.11.1.1-255" )
parser.add_argument("-w", dest="wordlist", required=False, type=str, help="Set the wordlist to use (default ./wordlists/virtual-host-scanning.txt)")
parser.add_argument("-w", dest="wordlist", required=False, type=str, help="Set the wordlist to use (default ./wordlists/virtual-host-scanning.txt)", default=False)
parser.add_argument("-b", dest="base_host", required=False, help="Set host to be used during substitution in wordlist (default to TARGET).", default=False)
parser.add_argument("-p", dest="port", required=False, help="Set the port to use (default 80).", default=80)
parser.add_argument("-r", dest="real_port", required=False, help="The real port of the webserver to use in headers when not 80 (see RFC2616 14.23), useful when pivoting through ssh/nc etc (default to PORT).", default=False)
Expand All @@ -35,29 +35,36 @@ def main():
wordlist = list()

if(arguments.stdin and not arguments.wordlist):
input = list(line for line in sys.stdin.read().splitlines())
wordlist.extend(input)
wordlist.extend(list(line for line in sys.stdin.read().splitlines()))
print("[+] Starting virtual host scan for %s using port %s and stdin data" % (arguments.target_hosts,
str(arguments.port)))
elif(arguments.stdin and arguments.wordlist):
if not os.path.exists(arguments.wordlist):
wordlist.extend(list(line for line in sys.stdin.read().splitlines()))
print("[!] Wordlist %s doesn't exist and can't be appended to stdin." % arguments.wordlist)
print("[+] Starting virtual host scan for %s using port %s and stdin data" % (arguments.target_hosts,
str(arguments.port)))
else:
wordlist_file = open(arguments.wordlist).read().splitlines()
wordlist.extend(wordlist_file)
wordlist.extend(list(line for line in open(arguments.wordlist).read().splitlines()))
print("[+] Starting virtual host scan for %s using port %s, stdin data, and wordlist %s" % (arguments.target_hosts,
str(arguments.port),
arguments.wordlist))
else:
# if no stdin, or wordlist pass, open default wordlist location
wordlist_file = open("./wordlists/virtual-host-scanning.txt").read().splitlines()
wordlist.extend(wordlist_file)
print("[+] Starting virtual host scan for %s using port %s and wordlist %s" % (arguments.target_hosts,
str(arguments.port),
"./wordlists/virtual-host-scanning.txt"))

if not arguments.wordlist:
wordlist.extend(list(line for line in open("./wordlists/virtual-host-scanning.txt").read().splitlines()))
print("[+] Starting virtual host scan for %s using port %s and wordlist %s" % ( arguments.target_hosts,
str(arguments.port),
"./wordlists/virtual-host-scanning.txt"))
else:
if not os.path.exists(arguments.wordlist):
print("[!] Wordlist %s doesn't exist, unable to scan." % arguments.wordlist)
sys.exit()
else:
wordlist.extend(list(line for line in open(arguments.wordlist).read().splitlines()))
print("[+] Starting virtual host scan for %s using port %s and wordlist %s" % ( arguments.target_hosts,
str(arguments.port),
str(arguments.wordlist)))

if(arguments.ssl):
print("[>] SSL flag set, sending all results over HTTPS")

Expand Down