1
+ from argparse import ArgumentParser
2
+
3
+ class cli_argument_parser (object ):
4
+ def __init__ (self ):
5
+ self ._parser = self .setup_parser ()
6
+
7
+ def parse (self , argv ):
8
+ return self ._parser .parse_args (argv )
9
+
10
+ @staticmethod
11
+ def setup_parser ():
12
+ parser = ArgumentParser ()
13
+
14
+ parser .add_argument (
15
+ '-t' , dest = 'target_hosts' , required = True ,
16
+ help = 'Set a target range of addresses to target. Ex 10.11.1.1-255'
17
+ ),
18
+
19
+ parser .add_argument (
20
+ '-w' , dest = 'wordlists' ,
21
+ help = 'Set the wordlists to use (default ./wordlists/virtual-host-scanning.txt)'
22
+ )
23
+
24
+ parser .add_argument (
25
+ '-b' , dest = 'base_host' , default = False ,
26
+ help = 'Set host to be used during substitution in wordlist (default to TARGET).'
27
+ )
28
+
29
+ parser .add_argument (
30
+ '-p' , dest = 'port' , default = 80 , type = int ,
31
+ help = 'Set the port to use (default 80).'
32
+ )
33
+
34
+ parser .add_argument (
35
+ '-r' , dest = 'real_port' , type = int , default = False ,
36
+ 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).'
37
+ )
38
+
39
+ parser .add_argument (
40
+ '--ignore-http-codes' , dest = 'ignore_http_codes' , default = '404' ,
41
+ help = 'Comma separated list of http codes to ignore with virtual host scans (default 404).'
42
+ )
43
+
44
+ parser .add_argument (
45
+ '--ignore-content-length' , dest = 'ignore_content_length' , type = int , default = 0 ,
46
+ help = 'Ignore content lengths of specificed amount (default 0).'
47
+ )
48
+
49
+ parser .add_argument (
50
+ '--unique-depth' , dest = 'unique_depth' , type = int , default = 1 ,
51
+ help = 'Show likely matches of page content that is found x times (default 1).'
52
+ )
53
+
54
+ parser .add_argument (
55
+ '--ssl' , dest = 'ssl' , action = 'store_true' , default = False ,
56
+ help = 'If set then connections will be made over HTTPS instead of HTTP (default http).'
57
+ )
58
+
59
+ parser .add_argument (
60
+ '--fuzzy-logic' , dest = 'fuzzy_logic' , action = 'store_true' , default = False ,
61
+ help = 'If set then fuzzy match will be performed against unique hosts (default off).'
62
+ )
63
+
64
+ parser .add_argument (
65
+ '--no-lookups' , dest = 'no_lookup' , action = 'store_true' , default = False ,
66
+ help = 'Disable reverse lookups (identifies new targets and appends to wordlist, on by default).'
67
+ )
68
+
69
+ parser .add_argument (
70
+ '--rate-limit' , dest = 'rate_limit' , type = int , default = 0 ,
71
+ help = 'Amount of time in seconds to delay between each scan (default 0).'
72
+ )
73
+
74
+ parser .add_argument (
75
+ '--waf' , dest = 'add_waf_bypass_headers' , action = 'store_true' , default = False ,
76
+ help = 'If set then simple WAF bypass headers will be sent.'
77
+ )
78
+
79
+ parser .add_argument (
80
+ '-' , dest = 'stdin' , action = 'store_true' , default = False ,
81
+ help = "By passing a blank '-' you tell VHostScan to expect input from stdin (pipe)."
82
+ )
83
+
84
+ output = parser .add_mutually_exclusive_group ()
85
+ output .add_argument (
86
+ '-oN' , dest = 'output_normal' ,
87
+ help = 'Normal output printed to a file when the -oN option is specified with a filename argument.'
88
+ )
89
+
90
+ output .add_argument (
91
+ '-oJ' , dest = 'output_json' ,
92
+ help = 'JSON output printed to a file when the -oJ option is specified with a filename argument.'
93
+ )
94
+
95
+ user_agent = parser .add_mutually_exclusive_group ()
96
+ user_agent .add_argument (
97
+ '--random-agent' , dest = 'random_agent' , action = 'store_true' , default = False ,
98
+ help = 'If set, then each scan will use random user-agent from predefined list.'
99
+ )
100
+
101
+ user_agent .add_argument (
102
+ '--user-agent' , dest = 'user_agent' ,
103
+ help = 'Specify a user-agent to use for scans'
104
+ )
105
+
106
+ return parser
0 commit comments