@@ -18,7 +18,7 @@ def read_hosts(filename=None, cidr=None):
1818
1919def get_common_inputs (input_source ):
2020 output = get_input ("Enter output filename" , default = f"result_{ os .path .basename (str (input_source ))} " , validate_input = False )
21- threads = get_input ("Enter threads" , "number" , default = "50" )
21+ threads = get_input ("Enter threads" , "number" , default = "50" , allow_comma_separated = False )
2222 return output , threads
2323
2424def get_host_input ():
@@ -28,12 +28,16 @@ def get_host_input():
2828 return None , cidr
2929 return filename , None
3030
31+ def list_to_comma_separated (result ):
32+ return ', ' .join (result ) if isinstance (result , list ) else result
33+
3134def get_input_direct (no302 = False ):
3235 filename , cidr = get_host_input ()
3336 port_list = get_input ("Enter port(s)" , "number" , default = "80" ).split (',' )
3437 output , threads = get_common_inputs (filename or cidr )
3538 method_list = get_input ("Select HTTP method(s)" , "choice" , multiselect = True ,
36- choices = ["GET" , "HEAD" , "POST" , "PUT" , "DELETE" , "OPTIONS" , "TRACE" , "PATCH" ])
39+ choices = ["GET" , "HEAD" , "POST" , "PUT" , "DELETE" , "OPTIONS" , "TRACE" , "PATCH" ],
40+ transformer = list_to_comma_separated )
3741
3842 scanner = DirectScanner ()
3943 scanner .method_list = method_list
@@ -59,7 +63,7 @@ def get_input_proxy():
5963 payload = get_input ("Enter payload" , default = default_payload )
6064 port_list = get_input ("Enter port(s)" , "number" , default = "80" ).split (',' )
6165 output , threads = get_common_inputs (filename or cidr )
62- bug = get_input ("Enter bug (optional) " , default = "" , validate_input = False )
66+ bug = get_input ("Enter bug" , default = "" , validate_input = False , instruction = "(optional)" )
6367
6468 scanner = ProxyScanner ()
6569 scanner .host_list = read_hosts (filename , cidr )
@@ -77,10 +81,11 @@ def get_input_proxy2():
7781 filename , cidr = get_host_input ()
7882 port_list = get_input ("Enter port(s)" , "number" , default = "80" ).split (',' )
7983 output , threads = get_common_inputs (filename or cidr )
80- method_list = get_input ("Select HTTP method" , "choice" , multiselect = True ,
81- choices = ["GET" , "HEAD" , "POST" , "PUT" , "DELETE" , "OPTIONS" , "TRACE" , "PATCH" ])
84+ method_list = get_input ("Select HTTP method(s)" , "choice" , multiselect = True ,
85+ choices = ["GET" , "HEAD" , "POST" , "PUT" , "DELETE" , "OPTIONS" , "TRACE" , "PATCH" ],
86+ transformer = list_to_comma_separated )
8287
83- proxy = get_input ("Enter proxy (proxy:port)" )
88+ proxy = get_input ("Enter proxy" , instruction = " (proxy:port)" )
8489
8590 use_auth = get_confirm (" Use proxy authentication?" )
8691 proxy_username = None
@@ -101,10 +106,14 @@ def get_input_proxy2():
101106
102107def get_input_ssl ():
103108 filename , cidr = get_host_input ()
109+ tls_version = get_input ("Select TLS version" , "choice" ,
110+ choices = list (SSLScanner .TLS_VERSIONS .keys ()),
111+ default = "TLS 1.2" )
104112 output , threads = get_common_inputs (filename or cidr )
105113
106114 scanner = SSLScanner ()
107115 scanner .host_list = read_hosts (filename , cidr )
116+ scanner .tls_version = SSLScanner .TLS_VERSIONS [tls_version ]
108117
109118 return scanner , output , threads
110119
@@ -121,16 +130,16 @@ def get_input_ping():
121130 return scanner , output , threads
122131
123132def get_user_input ():
124- mode = get_input ("Select mode" , "choice" ,
125- choices = ["direct " , "direct -no302" , "proxy -check" , "proxy -request" , "ping " , "ssl " ])
133+ mode = get_input ("Select scanning mode" , "choice" ,
134+ choices = ["Direct " , "Direct -no302" , "Proxy -check" , "Proxy -request" , "Ping " , "SSL " ])
126135
127136 input_handlers = {
128- 'direct ' : lambda : get_input_direct (no302 = False ),
129- 'direct -no302' : lambda : get_input_direct (no302 = True ),
130- 'proxy -check' : get_input_proxy ,
131- 'proxy -request' : get_input_proxy2 ,
132- 'ping ' : get_input_ping ,
133- 'ssl ' : get_input_ssl
137+ 'Direct ' : lambda : get_input_direct (no302 = False ),
138+ 'Direct -no302' : lambda : get_input_direct (no302 = True ),
139+ 'Proxy -check' : get_input_proxy ,
140+ 'Proxy -request' : get_input_proxy2 ,
141+ 'Ping ' : get_input_ping ,
142+ 'SSL ' : get_input_ssl
134143 }
135144
136145 scanner , output , threads = input_handlers [mode ]()
@@ -143,7 +152,7 @@ def main():
143152
144153 if output :
145154 with open (output , 'a+' ) as file :
146- if mode == 'proxy -check' :
155+ if mode == 'Proxy -check' :
147156 json .dump (scanner .success_list (), file , indent = 2 )
148157 else :
149158 file .write ('\n ' .join ([str (x ) for x in scanner .success_list ()]) + '\n ' )
0 commit comments