Skip to content

Commit 21f232b

Browse files
committed
Use the new scanner_argument_parser to parse the arguments
Instead of build the argparser.ArgumentParser directly, delegate to the new scanner_argument_parser class the responsibility of parsing the CLI arguments.
1 parent 7377b6c commit 21f232b

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

VHostScan.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from lib.helpers.output_helper import *
1010
from lib.helpers.file_helper import get_combined_word_lists, load_random_user_agents
1111
from lib.core.__version__ import __version__
12+
from lib.input import cli_argument_parser
1213

1314

1415
def print_banner():
@@ -19,32 +20,12 @@ def print_banner():
1920

2021
def main():
2122
print_banner()
22-
parser = ArgumentParser()
23-
parser.add_argument("-t", dest="target_hosts", required=True, help="Set a target range of addresses to target. Ex 10.11.1.1-255" )
24-
parser.add_argument("-w", dest="wordlists", required=False, type=str, help="Set the wordlists to use (default ./wordlists/virtual-host-scanning.txt)", default=False)
25-
parser.add_argument("-b", dest="base_host", required=False, help="Set host to be used during substitution in wordlist (default to TARGET).", default=False)
26-
parser.add_argument("-p", dest="port", required=False, help="Set the port to use (default 80).", default=80)
27-
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)
28-
29-
parser.add_argument('--ignore-http-codes', dest='ignore_http_codes', type=str, help='Comma separated list of http codes to ignore with virtual host scans (default 404).', default='404')
30-
parser.add_argument('--ignore-content-length', dest='ignore_content_length', type=int, help='Ignore content lengths of specificed amount (default 0).', default=0)
31-
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)
32-
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)
33-
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)
34-
parser.add_argument("--no-lookups", dest="no_lookup", action="store_true", help="Disable reverse lookups (identifies new targets and appends to wordlist, on by default).", default=False)
35-
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)
36-
parser.add_argument('--random-agent', dest='random_agent', action='store_true', help='If set, then each scan will use random user-agent from predefined list.', default=False)
37-
parser.add_argument('--user-agent', dest='user_agent', type=str, help='Specify a user-agent to use for scans')
38-
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)
39-
parser.add_argument("-oN", dest="output_normal", help="Normal output printed to a file when the -oN option is specified with a filename argument." )
40-
parser.add_argument("-oJ", dest="output_json", help="JSON output printed to a file when the -oJ option is specified with a filename argument." )
41-
parser.add_argument("-", dest="stdin", action="store_true", help="By passing a blank '-' you tell VHostScan to expect input from stdin (pipe).", default=False)
42-
43-
arguments = parser.parse_args()
44-
wordlist = []
23+
24+
parser = cli_argument_parser()
25+
arguments = parser.parse(sys.argv[1:])
4526

27+
wordlist = []
4628
word_list_types = []
47-
4829
default_wordlist = "./wordlists/virtual-host-scanning.txt" if not arguments.stdin else None
4930

5031
if arguments.stdin:

0 commit comments

Comments
 (0)