This commit is contained in:
Ace Pace 2018-01-09 18:37:59 +02:00
parent fddda34dcd
commit 30d81e05c9
2 changed files with 8 additions and 9 deletions

View File

@ -28,7 +28,6 @@ class TcpScanner(HostScanner, HostFinger):
shuffle(target_ports) shuffle(target_ports)
ports, banners = check_tcp_ports(host.ip_addr, target_ports, self._config.tcp_scan_timeout / 1000.0) 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): for target_port, banner in zip(ports, banners):
service = 'tcp-' + str(target_port) service = 'tcp-' + str(target_port)
host.services[service] = {} host.services[service] = {}

View File

@ -132,7 +132,7 @@ def check_tcp_ports(ip, ports, timeout=DEFAULT_TIMEOUT, get_banner=False):
time_left) time_left)
# any read_socket is automatically a writesocket # any read_socket is automatically a writesocket
num_replies = len(write_sockets) + len(err_sockets) 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 break
else: else:
time_left -= SLEEP_BETWEEN_POLL time_left -= SLEEP_BETWEEN_POLL