| Algorithm 1 MITM Algorithm Implemented by RAT | |
| 1: | procedure Man-in-the-middle Attack |
| 2: | State ← {mirror, send_to_position, circulate, fake_position, availability_attack} |
| 3: | Sniff packet |
| 4: | if packet from client to robot then |
| 5: | if State is mirror then |
| 6: | if “command is turn right packet” then |
| 7: | replace the TCP.payload by “turn left” payload. |
| 8: | if “command is turn left packet” then |
| 9: | replace the TCP.payload by “turn right” payload. |
| 10: | if State is send_to_position then |
| 11: | replace the TCP.payload by “Go to X, Y” payload; the robot will go to specific location |
| 12: | if State is circulate then |
| 13: | replace the TCP.payload by “turn left” payload; the robot will turn around itself |
| 14: | if State is availability_attack then |
| 15: | drop the packet like if the robot is not present |
| 16: | if packet from robot to client then |
| 17: | if State is availability_attack then |
| 18: | drop the packet like if the robot is not present |
| 19: | if State is fake_position then |
| 20: | replace the TCP.payload with one with fake X,Y; |
| 21: | close; |