forked from p15670423/monkey
CR fixes
This commit is contained in:
parent
fddda34dcd
commit
30d81e05c9
|
@ -28,13 +28,12 @@ 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] = {}
|
if banner:
|
||||||
if banner:
|
host.services[service]['banner'] = banner
|
||||||
host.services[service]['banner'] = banner
|
if only_one_port:
|
||||||
if only_one_port:
|
break
|
||||||
break
|
|
||||||
|
|
||||||
return len(ports) != 0
|
return len(ports) != 0
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue