plc-code-c

Detecting and Preventing DOS Attacks in a PLC

Published on: May 23, 2024
Author(s): Christos Beretas, Evangelos Gkotzaridis
Keyword(s): plc, programming, dos, Cybersecurity, Security, electrical engineering
ISSN: 3036-9495

Abstract

The C code below defines a data structure IpAddress to store the IP address and the number of requests from that address. The detectAndPreventDosAttack function is used to detect DOS attacks by checking the IP address against the list of IP addresses stored. If the number of requests from that IP address exceeds a threshold, the blockIpAddress function is called to block the IP address. In the main function, we simulate a few requests from different IP addresses to demonstrate the detection and prevention of DOS attacks by blocking IP addresses.

Scroll to Top