44from bugscanx .utils .common import get_input , get_confirm , is_cidr
55
66
7- def read_hosts (filename = None , cidr = None ):
8- if filename :
9- with open (filename ) as file :
10- return [line .strip () for line in file ]
11- elif cidr :
12- return []
13- return []
14-
15-
167def get_cidr_ranges_from_input (cidr_input ):
178 return [c .strip () for c in cidr_input .split (',' )]
189
@@ -65,7 +56,7 @@ def get_input_direct(no302=False):
6556
6657 if cidr :
6758 cidr_ranges = get_cidr_ranges_from_input (cidr )
68- from .scanners .direct import CIDRDirectScanner
59+ from .scanners .direct import CIDRDirectScanner
6960 scanner = CIDRDirectScanner (
7061 method_list = method_list ,
7162 cidr_ranges = cidr_ranges ,
@@ -76,7 +67,7 @@ def get_input_direct(no302=False):
7667 from .scanners .direct import HostDirectScanner
7768 scanner = HostDirectScanner (
7869 method_list = method_list ,
79- host_list = read_hosts ( filename , cidr ) ,
70+ input_file = filename ,
8071 port_list = port_list ,
8172 no302 = no302
8273 )
@@ -112,7 +103,7 @@ def get_input_proxy():
112103 else :
113104 from .scanners .proxy_check import HostProxyScanner
114105 scanner = HostProxyScanner (
115- host_list = read_hosts ( filename , cidr ) ,
106+ input_file = filename ,
116107 port_list = port_list ,
117108 target = target_url ,
118109 payload = payload ,
@@ -161,7 +152,7 @@ def get_input_proxy2():
161152 from .scanners .proxy_request import HostProxy2Scanner
162153 scanner = HostProxy2Scanner (
163154 method_list = method_list ,
164- host_list = read_hosts ( filename , cidr ) ,
155+ input_file = filename ,
165156 port_list = port_list ,
166157 ).set_proxy (proxy , proxy_username , proxy_password )
167158
@@ -184,14 +175,16 @@ def get_input_ssl():
184175 else :
185176 from .scanners .ssl import HostSSLScanner
186177 scanner = HostSSLScanner (
187- host_list = read_hosts ( filename , cidr ) ,
178+ input_file = filename ,
188179 )
189180
190181 return scanner , output , threads
191182
192183
193184def get_input_ping ():
194185 filename , cidr = get_host_input ()
186+ if filename is None and cidr is None :
187+ return None , None , None
195188
196189 port_list = get_input ("Enter port(s)" , "number" , default = "443" ).split (',' )
197190 output , threads = get_common_inputs (filename or cidr )
@@ -206,7 +199,7 @@ def get_input_ping():
206199 else :
207200 from .scanners .ping import HostPingScanner
208201 scanner = HostPingScanner (
209- host_list = read_hosts ( filename , cidr ) ,
202+ input_file = filename ,
210203 port_list = port_list ,
211204 )
212205
0 commit comments