Agent: Remove tcp scan get banner option

This commit is contained in:
Ilija Lazoroski 2021-12-14 12:15:25 +01:00
parent 210e981f7e
commit c78b89d43d
3 changed files with 3 additions and 6 deletions

View File

@ -136,7 +136,6 @@ class Configuration(object):
tcp_target_ports = [22, 2222, 445, 135, 3389, 80, 8080, 443, 8008, 3306, 9200] tcp_target_ports = [22, 2222, 445, 135, 3389, 80, 8080, 443, 8008, 3306, 9200]
tcp_target_ports.extend(HTTP_PORTS) tcp_target_ports.extend(HTTP_PORTS)
tcp_scan_timeout = 3000 # 3000 Milliseconds tcp_scan_timeout = 3000 # 3000 Milliseconds
tcp_scan_get_banner = True
# Ping Scanner # Ping Scanner
ping_scan_timeout = 1000 ping_scan_timeout = 1000

View File

@ -56,7 +56,6 @@
"exploit_ntlm_hash_list": [], "exploit_ntlm_hash_list": [],
"exploit_ssh_keys": [], "exploit_ssh_keys": [],
"local_network_scan": false, "local_network_scan": false,
"tcp_scan_get_banner": true,
"tcp_scan_timeout": 10000, "tcp_scan_timeout": 10000,
"tcp_target_ports": [ "tcp_target_ports": [
22, 22,

View File

@ -76,14 +76,13 @@ def check_tcp_port(ip, port, timeout=DEFAULT_TIMEOUT, get_banner=False):
return True, banner 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. Checks whether any of the given ports are open on a target IP.
:param ip: IP of host to attack :param ip: IP of host to attack
:param ports: List of ports to attack. Must not be empty. :param ports: List of ports to attack. Must not be empty.
:param timeout: Amount of time to wait for connection :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.
:return: list of open ports. If get_banner=True, then a matching list of banners.
""" """
sockets = [socket.socket(socket.AF_INET, socket.SOCK_STREAM) for _ in range(len(ports))] sockets = [socket.socket(socket.AF_INET, socket.SOCK_STREAM) for _ in range(len(ports))]
[s.setblocking(False) for s in sockets] [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])) % (str(ip), ",".join([str(s[0]) for s in connected_ports_sockets]))
) )
banners = [] banners = []
if get_banner and (len(connected_ports_sockets) != 0): if len(connected_ports_sockets) != 0:
readable_sockets, _, _ = select.select( readable_sockets, _, _ = select.select(
[s[1] for s in connected_ports_sockets], [], [], 0 [s[1] for s in connected_ports_sockets], [], [], 0
) )