2022-08-30 20:42:46 +08:00
|
|
|
from typing import Sequence
|
2022-07-19 02:27:08 +08:00
|
|
|
|
2022-08-30 20:42:46 +08:00
|
|
|
from common.agent_configuration import AgentConfiguration, PluginConfiguration
|
2022-07-19 02:27:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
def add_exploiters(
|
2022-07-19 02:49:25 +08:00
|
|
|
agent_configuration: AgentConfiguration,
|
|
|
|
brute_force: Sequence[PluginConfiguration] = [],
|
|
|
|
vulnerability: Sequence[PluginConfiguration] = [],
|
2022-07-19 02:27:08 +08:00
|
|
|
) -> AgentConfiguration:
|
2022-08-30 20:33:45 +08:00
|
|
|
|
|
|
|
agent_configuration.propagation.exploitation.brute_force = brute_force
|
|
|
|
agent_configuration.propagation.exploitation.vulnerability = vulnerability
|
|
|
|
|
|
|
|
return agent_configuration
|
2022-07-19 02:27:08 +08:00
|
|
|
|
|
|
|
|
2022-07-27 22:59:58 +08:00
|
|
|
def add_fingerprinters(
|
2022-07-28 18:10:24 +08:00
|
|
|
agent_configuration: AgentConfiguration, fingerprinters: Sequence[PluginConfiguration]
|
2022-07-27 22:59:58 +08:00
|
|
|
) -> AgentConfiguration:
|
|
|
|
|
2022-08-30 20:33:45 +08:00
|
|
|
agent_configuration.propagation.network_scan.fingerprinters = fingerprinters
|
|
|
|
|
|
|
|
return agent_configuration
|
2022-07-27 22:59:58 +08:00
|
|
|
|
|
|
|
|
2022-07-19 02:27:08 +08:00
|
|
|
def add_tcp_ports(
|
|
|
|
agent_configuration: AgentConfiguration, tcp_ports: Sequence[int]
|
|
|
|
) -> AgentConfiguration:
|
|
|
|
|
2022-08-30 20:33:45 +08:00
|
|
|
agent_configuration.propagation.network_scan.tcp.ports = tuple(tcp_ports)
|
|
|
|
|
|
|
|
return agent_configuration
|
2022-07-19 02:27:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
def add_subnets(
|
|
|
|
agent_configuration: AgentConfiguration, subnets: Sequence[str]
|
|
|
|
) -> AgentConfiguration:
|
2022-08-30 20:33:45 +08:00
|
|
|
|
|
|
|
agent_configuration.propagation.network_scan.targets.subnets = subnets
|
|
|
|
|
|
|
|
return agent_configuration
|
2022-07-19 02:27:08 +08:00
|
|
|
|
|
|
|
|
2022-07-19 02:52:31 +08:00
|
|
|
def add_credential_collectors(
|
|
|
|
agent_configuration: AgentConfiguration, credential_collectors: Sequence[PluginConfiguration]
|
|
|
|
) -> AgentConfiguration:
|
2022-08-30 20:33:45 +08:00
|
|
|
|
|
|
|
agent_configuration.credential_collectors = tuple(credential_collectors)
|
|
|
|
|
|
|
|
return agent_configuration
|
2022-07-19 02:52:31 +08:00
|
|
|
|
|
|
|
|
2022-07-19 20:12:46 +08:00
|
|
|
def add_http_ports(
|
|
|
|
agent_configuration: AgentConfiguration, http_ports: Sequence[int]
|
|
|
|
) -> AgentConfiguration:
|
|
|
|
|
2022-08-30 20:33:45 +08:00
|
|
|
agent_configuration.propagation.exploitation.options.http_ports = http_ports
|
|
|
|
|
|
|
|
return agent_configuration
|
2022-07-19 20:12:46 +08:00
|
|
|
|
|
|
|
|
2022-07-20 01:24:00 +08:00
|
|
|
def set_keep_tunnel_open_time(
|
|
|
|
agent_configuration: AgentConfiguration, keep_tunnel_open_time: int
|
|
|
|
) -> AgentConfiguration:
|
2022-08-30 20:33:45 +08:00
|
|
|
|
|
|
|
agent_configuration.keep_tunnel_open_time = keep_tunnel_open_time
|
|
|
|
|
|
|
|
return agent_configuration
|
2022-07-20 01:24:00 +08:00
|
|
|
|
|
|
|
|
2022-07-19 03:03:52 +08:00
|
|
|
def set_maximum_depth(
|
|
|
|
agent_configuration: AgentConfiguration, maximum_depth: int
|
|
|
|
) -> AgentConfiguration:
|
2022-08-30 20:33:45 +08:00
|
|
|
|
|
|
|
agent_configuration.propagation.maximum_depth = maximum_depth
|
|
|
|
|
|
|
|
return agent_configuration
|