# Build-Launch-Consolidate Framework and Toolkit for Impact Analysis on Wireless Sensor Networks
## 4 Case Study: Analyzing Flooding Attack
### Results and Analysis
#### 4.3.2 Impact on End-to-End Delay  
The average E2E delay for binary layout networks, as demonstrated in Table 4, following the flooding attack increased by 15% compared to the normal scenario, unlike the grid layout, where delays in message delivery increased by 72%. Figures 14 and 15 provide boxplots that detail statistics for E2E readings for all messages sent by each node of the binary and grid layouts, under the normal and attack scenarios. Each data point represents the E2E delay of one delivered message throughout each simulation. For each node, scenario pair, we plotted a box representing the interquartile range (bounded by Q1 and Q3), a line indicating the median, a cross indicating the arithmetic mean, and whiskers extending the minimum and maximum values (excluding outliers, which were plotted as individual dots). These figures aim to compare the impact of the attack with the normal baseline. Irrespective of the attack, the minimum delay the nodes recorded in both layouts was 27 milliseconds. However, the maximum delay observed in a normal scenario for the binary layout was approximately 7 s, in contrast to the roughly 14 s delay logged under attack, as depicted in Figure 14. Nodes 20, 21, 31, 32, and 33 had no messages delivered when their parent (node 13) was carrying the attack. Accordingly, Figure 14 does not plot any readings. As for the grid layout, its maximum delay reached up to 28 s in normal network operations and 30 s when the network was under attack, which is illustrated in Figure 15. Nodes 26, 27, and 28 in the attack scenario for the grid layout had a single message delivered, and thus, the mean and median are plotted using the same value. A closer look provides further insights into how each network behaved under the attack, as illustrated in Figures 16 and 17 for the binary and grid layouts, respectively.  
Figure 14: Boxplot visualizing E2E of the binary layout nodes, comparing normal and attack scenarios.  
Because the child nodes of the attacker in the binary layout had a PDR of 0%, there were no messages to be delivered and, consequentially, no delay to be measured as presented in Figure 16. Although the attacker's parent witnessed 30% additional delays, its other branch (consisting of nodes 12, 19, and 30) were the most impacted. Across the network, node 30 recorded the largest average delay of 4101 ms ms, followed by node 19 with a delay of 2477 ms, which corresponds to an increase of 278% and 119%, respectively, from their baseline levels. It is noted that the impact of E2E delays spilled over to other branches and impacted a larger proportion of the network. Furthermore, some nodes in further branches recorded notable improvements (e.g., nodes 9, 23, 25, and 4), which slightly offset the average delay of the overall network. It is observed that these nodes are on the other branch away from the attacker. This emphasizes the role of the heatmap in helping us break down the impact on the network and obtain insights that would not have been visible if we measured the performance as an overall.  
Figure 16: Heatmap of binary layout, highlighting percentage change in average E2E post attack.  
Figure 15: Boxplot visualizing E2E of the grid layout nodes, comparing normal and attack scenarios.  
As for the grid layout, shown in Figure 17, we notice an increased spread of impacted nodes across the network, demonstrating the ripple effect of the flooding attack. Twenty-six nodes witnessed increased delays by more than 100% as a result of the attack. Almost all nodes suffered extensive delays, including some nodes that are close to the sink. For example, node 3 is adjacent to the sink and recorded a 422% increase in delays. Although the attacker's direct neighbors were significantly impacted, node 18 showed a 40% improvement in E2E delay. After further examination, this was shown to be a measurement of the only packet that was delivered according to the PDR heatmap (4% PDR in Figure 13).