#2681 Updated to include yaml file tests + include listening on multiports.
This commit is contained in:
@@ -27,6 +27,7 @@ from primaite.simulator.network.hardware.nodes.network.router import Router
|
||||
from primaite.simulator.network.hardware.nodes.network.switch import Switch
|
||||
from primaite.simulator.network.hardware.nodes.network.wireless_router import WirelessRouter
|
||||
from primaite.simulator.network.nmne import NMNEConfig
|
||||
from primaite.simulator.network.transmission.network_layer import IPProtocol
|
||||
from primaite.simulator.network.transmission.transport_layer import Port
|
||||
from primaite.simulator.sim_container import Simulation
|
||||
from primaite.simulator.system.applications.application import Application
|
||||
@@ -455,6 +456,21 @@ class PrimaiteGame:
|
||||
dos_intensity=float(opt.get("dos_intensity", "1.0")),
|
||||
max_sessions=int(opt.get("max_sessions", "1000")),
|
||||
)
|
||||
elif application_type == "C2Beacon":
|
||||
if "options" in application_cfg:
|
||||
opt = application_cfg["options"]
|
||||
new_application.configure(
|
||||
c2_server_ip_address=IPv4Address(opt.get("c2_server_ip_address")),
|
||||
keep_alive_frequency=(opt.get("keep_alive_frequency"))
|
||||
if opt.get("keep_alive_frequency")
|
||||
else 5,
|
||||
masquerade_protocol=IPProtocol[(opt.get("masquerade_protocol"))]
|
||||
if opt.get("masquerade_protocol")
|
||||
else IPProtocol.TCP,
|
||||
masquerade_port=Port[(opt.get("masquerade_port"))]
|
||||
if opt.get("masquerade_port")
|
||||
else Port.HTTP,
|
||||
)
|
||||
if "network_interfaces" in node_cfg:
|
||||
for nic_num, nic_cfg in node_cfg["network_interfaces"].items():
|
||||
new_node.connect_nic(NIC(ip_address=nic_cfg["ip_address"], subnet_mask=nic_cfg["subnet_mask"]))
|
||||
|
||||
@@ -247,9 +247,9 @@ class AbstractC2(Application, identifier="AbstractC2"):
|
||||
self.keep_alive_sent = True
|
||||
self.sys_log.info(f"{self.name}: Keep Alive sent to {self.c2_remote_connection}")
|
||||
self.sys_log.debug(
|
||||
f"{self.name}: Keep Alive sent to {self.c2_remote_connection}"
|
||||
f"Using Masquerade Port: {self.c2_config.masquerade_port}"
|
||||
f"Using Masquerade Protocol: {self.c2_config.masquerade_protocol}"
|
||||
f"{self.name}: Keep Alive sent to {self.c2_remote_connection} "
|
||||
f"Masquerade Port: {self.c2_config.masquerade_port} "
|
||||
f"Masquerade Protocol: {self.c2_config.masquerade_protocol} "
|
||||
)
|
||||
return True
|
||||
else:
|
||||
|
||||
@@ -97,6 +97,7 @@ class C2Server(AbstractC2, identifier="C2Server"):
|
||||
def __init__(self, **kwargs):
|
||||
kwargs["name"] = "C2Server"
|
||||
super().__init__(**kwargs)
|
||||
self.run()
|
||||
|
||||
def _handle_command_output(self, payload: C2Packet) -> bool:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user