From c78b89d43d999cd3883b8bec33b0de66bea3b433 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Tue, 14 Dec 2021 12:15:25 +0100 Subject: [PATCH] Agent: Remove tcp scan get banner option --- monkey/infection_monkey/config.py | 1 - monkey/infection_monkey/example.conf | 1 - monkey/infection_monkey/network/tools.py | 7 +++---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/monkey/infection_monkey/config.py b/monkey/infection_monkey/config.py index 49f2b0c71..81c6a9996 100644 --- a/monkey/infection_monkey/config.py +++ b/monkey/infection_monkey/config.py @@ -136,7 +136,6 @@ class Configuration(object): tcp_target_ports = [22, 2222, 445, 135, 3389, 80, 8080, 443, 8008, 3306, 9200] tcp_target_ports.extend(HTTP_PORTS) tcp_scan_timeout = 3000 # 3000 Milliseconds - tcp_scan_get_banner = True # Ping Scanner ping_scan_timeout = 1000 diff --git a/monkey/infection_monkey/example.conf b/monkey/infection_monkey/example.conf index 322171399..6c2bc3235 100644 --- a/monkey/infection_monkey/example.conf +++ b/monkey/infection_monkey/example.conf @@ -56,7 +56,6 @@ "exploit_ntlm_hash_list": [], "exploit_ssh_keys": [], "local_network_scan": false, - "tcp_scan_get_banner": true, "tcp_scan_timeout": 10000, "tcp_target_ports": [ 22, diff --git a/monkey/infection_monkey/network/tools.py b/monkey/infection_monkey/network/tools.py index 9d6878cb9..4bb9f8020 100644 --- a/monkey/infection_monkey/network/tools.py +++ b/monkey/infection_monkey/network/tools.py @@ -76,14 +76,13 @@ def check_tcp_port(ip, port, timeout=DEFAULT_TIMEOUT, get_banner=False): return True, banner -def check_tcp_ports(ip, ports, timeout=DEFAULT_TIMEOUT, get_banner=False): +def check_tcp_ports(ip, ports, timeout=DEFAULT_TIMEOUT): """ Checks whether any of the given ports are open on a target IP. :param ip: IP of host to attack :param ports: List of ports to attack. Must not be empty. :param timeout: Amount of time to wait for connection - :param get_banner: T/F if to get first packets from server - :return: list of open ports. If get_banner=True, then a matching list of banners. + :return: List of open ports. """ sockets = [socket.socket(socket.AF_INET, socket.SOCK_STREAM) for _ in range(len(ports))] [s.setblocking(False) for s in sockets] @@ -130,7 +129,7 @@ def check_tcp_ports(ip, ports, timeout=DEFAULT_TIMEOUT, get_banner=False): % (str(ip), ",".join([str(s[0]) for s in connected_ports_sockets])) ) banners = [] - if get_banner and (len(connected_ports_sockets) != 0): + if len(connected_ports_sockets) != 0: readable_sockets, _, _ = select.select( [s[1] for s in connected_ports_sockets], [], [], 0 )