Skip to content

Commit 2390512

Browse files
committed
Alessandro's Concealment module now works in persistent mode
1 parent c888b2c commit 2390512

File tree

16 files changed

+197
-10
lines changed

16 files changed

+197
-10
lines changed

dhalsim/network_attacks/unconstrained_blackbox_netfilter_queue.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def __init__(self, intermediate_yaml_path: Path, yaml_index: int, queue_number:
6868

6969
# We can use the same method, as initially the df will be initialized with 0 values
7070
self.calculated_concealment_values_df = self.set_initial_conditions_of_scada_values()
71+
self.calculated_concealment_values_df_historical = []
7172

7273
# Initialize input values
7374
self.received_scada_tags_df = self.calculated_concealment_values_df
@@ -118,6 +119,9 @@ def interrupt(self):
118119

119120
def sigint_handler(self, sig, frame):
120121
"""Interrupt handler for attacker being stoped"""
122+
self.logger.debug("Printing concealment values")
123+
conc_path = Path(__file__).parent.absolute() / "concealed_values.csv"
124+
self.calculated_concealment_values_df.to_csv(conc_path, index=False)
121125
self.logger.debug("Netfilter queue process shutting down")
122126
self.interrupt()
123127

@@ -134,13 +138,13 @@ def handle_sync(self):
134138
while not self.get_sync(2):
135139
pass
136140

137-
self.logger.debug('Sync is 2. Keeping attack sync in 2, until we get all SCADA flags')
141+
#self.logger.debug('Sync is 2. Keeping attack sync in 2, until we get all SCADA flags')
138142

139143
# We stay in 2, to conceal the values exchanged remotely from the PLCs, until we make a prediction
140144
while self.missing_scada_tags and self.sync_flag:
141145
pass
142146

143-
self.logger.debug('Setting attack sync in 3')
147+
#self.logger.debug('Setting attack sync in 3')
144148
self.set_sync(3)
145149

146150
self.logger.debug('Netfilter sync thread while finished')
@@ -179,7 +183,7 @@ def scada_tag_list_empty(self):
179183

180184
# Wait for sync to take place
181185
while not self.get_sync(3) and self.sync_flag:
182-
self.logger.debug('Waiting for flag 3')
186+
#self.logger.debug('Waiting for flag 3')
183187
pass
184188

185189
self.missing_scada_tags = list(self.scada_tags)

examples/anytown_topology/anytown_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plcs: !include anytown_plcs.yaml
77
simulator: epynet
88
demand: pdd
99

10-
demand_patterns: demands_anytown_small.csv
10+
#demand_patterns: demands_anytown_small.csv
1111
#attacks: !include anytown_concealment_mitm.yaml
1212
attacks: !include anytown_dos.yaml
1313
log_level: debug

examples/anytown_topology/anytown_nwk_delay_and_loss.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ network_events:
77
start: 648
88
end: 792
99
loss_value: 10
10-
delay_value: 4000
10+
delay_value: 100

examples/ctown_topology/ctown_plcs.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- name: PLC1 # PLC1, PU1F PU2F J280 J269 , PU1 PU2
1+
- name: PLC1
22
sensors:
33
- PU1F
44
- PU2F
@@ -7,10 +7,10 @@
77
actuators:
88
- PU1
99
- PU2
10-
- name: PLC2 # PLC2, T1,
10+
- name: PLC2
1111
sensors:
1212
- T1
13-
- name: PLC3 # PLC3, T2 V2F J300 J256 J289 J415 J14 J422 PU4F PU5F PU6F PU7F , V2 PU4 PU5 PU6 PU7
13+
- name: PLC3
1414
sensors:
1515
- T2
1616
- V2F

examples/ctown_topology/dataset/dataset_config_files/ctown_config_05.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
inp_file: ctown_map.inp
2-
iterations: 2880
2+
#iterations: 2880
3+
iterations: 60
34
network_topology_type: complex
45
plcs: !include ctown_plcs.yaml
56
log_level: debug

examples/ctown_topology/dataset/dataset_config_files/ctown_config_10.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ inp_file: ctown_map.inp
22
iterations: 2880
33
network_topology_type: complex
44
plcs: !include ctown_plcs.yaml
5-
log_level: debug
65
simulator: epynet
76
demand: pdd
87
output_path: attack_output_10
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
inp_file: ctown_map.inp
2+
iterations: 2880
3+
network_topology_type: complex
4+
plcs: !include ctown_plcs.yaml
5+
simulator: epynet
6+
demand: pdd
7+
output_path: attack_output_11
8+
demand_patterns: events/demands_ctown_01.csv
9+
initial_tank_data: events/tanks_ctown_01.csv
10+
attacks: !include dataset_attacks/attack_11.yaml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
inp_file: ctown_map.inp
2+
iterations: 2880
3+
network_topology_type: complex
4+
plcs: !include ctown_plcs.yaml
5+
simulator: epynet
6+
demand: pdd
7+
output_path: attack_output_12
8+
demand_patterns: events/demands_ctown_01.csv
9+
initial_tank_data: events/tanks_ctown_01.csv
10+
attacks: !include dataset_attacks/attack_12.yaml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
inp_file: ctown_map.inp
2+
iterations: 2880
3+
network_topology_type: complex
4+
plcs: !include ctown_plcs.yaml
5+
simulator: epynet
6+
demand: pdd
7+
output_path: attack_output_13
8+
demand_patterns: events/demands_ctown_01.csv
9+
initial_tank_data: events/tanks_ctown_01.csv
10+
attacks: !include dataset_attacks/attack_13.yaml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
inp_file: ctown_map.inp
2+
iterations: 2880
3+
network_topology_type: complex
4+
plcs: !include ctown_plcs.yaml
5+
simulator: epynet
6+
demand: pdd
7+
output_path: attack_output_10
8+
demand_patterns: events/demands_ctown_01.csv
9+
initial_tank_data: events/tanks_ctown_01.csv
10+
attacks: !include dataset_attacks/attack_14.yaml

0 commit comments

Comments
 (0)