Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alirezade authored and alirezade committed Dec 27, 2023
1 parent 7ac5596 commit 135130a
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/AttackerRemote.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,7 @@
import queue


def find_device_address(device_name):
if device_name.lower() == 'plc1':
return '192.168.0.11'
elif device_name.lower() == 'plc2':
target = '192.168.0.12'

elif device_name.lower() == 'hmi1':
target = '192.168.0.21'

elif device_name.lower() == 'hmi2':
target = '192.168.0.22'
else:
raise Exception(f'target:({device_name}) is not recognized!')


class AttackerRemote(AttackerBase):
Expand Down Expand Up @@ -100,7 +88,7 @@ def process_messages(self, msg):
if mode.lower() == 'link':
target_1 = self.find_tag_in_msg(msg, 'target1')
target_2 = self.find_tag_in_msg(msg, 'target2')
target = target_1 + "," + target_2
target = self.find_device_address(target_1) + "," + self.find_device_address(target_2)
self._replay_scapy_attack(target=target, timeout=timeout, replay_count=replay)
else:
raise Exception(f"attack type: ({attack}) is not recognized!")
Expand All @@ -113,6 +101,21 @@ def find_tag_in_msg(msg, tag):
raise Exception(f'Cannot find tag name: ({tag}) in message!')
return msg[tag]

@staticmethod
def find_device_address(device_name):
if device_name.lower() == 'plc1':
return '192.168.0.11'
elif device_name.lower() == 'plc2':
target = '192.168.0.12'

elif device_name.lower() == 'hmi1':
target = '192.168.0.21'

elif device_name.lower() == 'hmi2':
target = '192.168.0.22'
else:
raise Exception(f'target:({device_name}) is not recognized!')


if __name__ == '__main__':
attackerRemote = AttackerRemote("input/sample_mqtt_connection.txt")
Expand Down

0 comments on commit 135130a

Please sign in to comment.