forked from p34709852/monkey
CR fixes
This commit is contained in:
parent
fddda34dcd
commit
30d81e05c9
|
@ -28,13 +28,12 @@ class TcpScanner(HostScanner, HostFinger):
|
|||
shuffle(target_ports)
|
||||
|
||||
ports, banners = check_tcp_ports(host.ip_addr, target_ports, self._config.tcp_scan_timeout / 1000.0)
|
||||
if len(ports) != 0:
|
||||
for target_port, banner in zip(ports, banners):
|
||||
service = 'tcp-' + str(target_port)
|
||||
host.services[service] = {}
|
||||
if banner:
|
||||
host.services[service]['banner'] = banner
|
||||
if only_one_port:
|
||||
break
|
||||
for target_port, banner in zip(ports, banners):
|
||||
service = 'tcp-' + str(target_port)
|
||||
host.services[service] = {}
|
||||
if banner:
|
||||
host.services[service]['banner'] = banner
|
||||
if only_one_port:
|
||||
break
|
||||
|
||||
return len(ports) != 0
|
||||
|
|
|
@ -132,7 +132,7 @@ def check_tcp_ports(ip, ports, timeout=DEFAULT_TIMEOUT, get_banner=False):
|
|||
time_left)
|
||||
# any read_socket is automatically a writesocket
|
||||
num_replies = len(write_sockets) + len(err_sockets)
|
||||
if num_replies == len(port_attempts) or time_left == 0:
|
||||
if num_replies == len(port_attempts) or time_left <= 0:
|
||||
break
|
||||
else:
|
||||
time_left -= SLEEP_BETWEEN_POLL
|
||||
|
|
Loading…
Reference in New Issue