Skip to content

Commit 0229b4f

Browse files
committed
Multiple tags concealment now supported for offset/value parameters, ongoing work into path
1 parent 8d15ad6 commit 0229b4f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

dhalsim/network_attacks/concealment_netfilter_queue.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,24 @@ def handle_enip_response(self, ip_payload):
6666

6767
# Concealment values to SCADA
6868
for session in self.scada_session_ids:
69+
self.logger.debug('Concealing to SCADA: ' + str(this_session))
6970
if session['session'] == this_session and session['context'] == this_context:
70-
for tag in self.intermediate_attack['concealment_data']['concealment_value']:
71-
if session['tag'] == tag['tag']:
72-
if self.intermediate_attack['concealment_data']['type'] == 'value':
73-
self.logger.debug('Concealing to SCADA: ' + str(this_session))
74-
concealment_value = tag['value']
75-
self.logger.debug('Concealment value is: ' + str(concealment_value))
76-
return translate_float_to_payload(concealment_value, ip_payload[Raw].load)
77-
elif self.intermediate_attack['concealment_data']['type'] == 'offset':
78-
self.logger.debug('Concealing to SCADA: ' + str(this_session))
79-
return translate_float_to_payload(translate_payload_to_float(ip_payload[Raw].load) + tag['offset'],
71+
if self.intermediate_attack['concealment_data']['type'] == 'value' or self.intermediate_attack['concealment_data']['type'] == 'offset':
72+
for tag in self.intermediate_attack['concealment_data']['concealment_value']:
73+
if session['tag'] == tag['tag']:
74+
if self.intermediate_attack['concealment_data']['type']:
75+
self.logger.debug('Concealment value is: ' + str(tag['value']))
76+
return translate_float_to_payload(tag['value'], ip_payload[Raw].load)
77+
elif self.intermediate_attack['concealment_data']['type'] == 'offset':
78+
self.logger.debug('Concealment offset is: ' + str(tag['offset']))
79+
return translate_float_to_payload(translate_payload_to_float(ip_payload[Raw].load) + tag['offset'],
8080
ip_payload[Raw].load)
81-
elif self.intermediate_attack['concealment_data']['type'] == 'path':
82-
self.logger.debug('Concealing to SCADA: ' + str(this_session))
83-
exp = (self.concealment_data_pd['iteration'] == self.get_master_clock())
84-
concealment_value = float(self.concealment_data_pd.loc[exp][self.attacked_tags].values[-1])
85-
self.logger.debug('Concealing with value: ' + str(concealment_value))
86-
p[Raw].load = translate_float_to_payload(concealment_value, p[Raw].load)
81+
elif self.intermediate_attack['concealment_data']['type'] == 'path':
82+
self.logger.debug('Concealing to SCADA with path')
83+
exp = (self.concealment_data_pd['iteration'] == self.get_master_clock())
84+
concealment_value = float(self.concealment_data_pd.loc[exp][session['tag']].values[-1])
85+
self.logger.debug('Concealing with value: ' + str(concealment_value))
86+
return translate_float_to_payload(concealment_value, ip_payload[Raw].load)
8787

8888
def handle_enip_request(self, ip_payload, offset):
8989

0 commit comments

Comments
 (0)