def __init__(self, weights: List[Union[int, float]], exfil_data: Optional[ExfilData] = None, network_io: Optional[BaseNetworkIO] = None, baseline_data: Optional[pd.DataFrame] = None, num_packets_for_split: int = 10): """ :param weights: the weights for each protocol to be chosen randomly :param exfil_data: the data to exfiltrate :param network_io: the networkIO that the planner must bypass :param baseline_data: the baseline data of the communication on each protocol :param num_packets_for_split: the number of chunks to split the exfil data to """ super().__init__(exfil_data, network_io, baseline_data) self.num_packets_for_split: int = num_packets_for_split if self.exfil_data is not None: self.set_exfil_data(exfil_data) self.weights: List[Union[int, float]] = weights self.protocols: List[Layer4Protocol] = list() if baseline_data is not None: self.protocols: List[Layer4Protocol] = [ str_to_layer4_proto(proto_str) for proto_str in baseline_data.index ]
def __init__(self, exfil_data: Optional[ExfilData] = None, network_io: Optional[BaseNetworkIO] = None, baseline_data: Optional[pd.DataFrame] = None): if baseline_data is None: max_proto: Optional[Layer4Protocol] = None else: max_proto: Optional[Layer4Protocol] = str_to_layer4_proto( baseline_data.total_bytes.idxmax()) super().__init__(max_proto, exfil_data, network_io, baseline_data)
def reset(self): self.amounts_sent_over_protos = {str_to_layer4_proto(proto_str): 0 for proto_str in self.baseline_data.index}
def set_baseline_data(self, baseline_data: pd.DataFrame): self.baseline_data = baseline_data self.protocols: List[Layer4Protocol] = [ str_to_layer4_proto(proto_str) for proto_str in baseline_data.index ]
def set_baseline_data(self, baseline_data: pd.DataFrame): self.baseline_data = baseline_data self.chosen_protocol = str_to_layer4_proto( baseline_data.total_bytes.idxmax())