## 7 Conclusions  
In conclusion, this study introduced a framework for enhancing security measures in WSNs while minimizing the impact on energy resources by utilizing the ECP-LEACH protocol and ERF-LET algorithm, referred to as S-2 EC-ERF. The integration of the ERF-LET algorithm at the node level played a pivotal role in fortifying the security posture of individual nodes, thus achieving an exceptional accuracy of 98.193% in detecting and mitigating potential security threats. Leveraging a comprehensive dataset obtained from orchestrated NS3 simulations, the ERF-LET algorithm demonstrated its proficiency in differentiating between legitimate and malicious packets, thereby laying a strong foundation for subsequent evaluations. The proposed framework was further validated through real-time simulations conducted on NS3. The results demonstrated the superiority of the proposed framework in terms of the packet delivery ratio, average throughput, end-to-end delay, mean energy consumption, and accuracy. The commendable performance in the average throughput and end-to-end delay highlights the efficiency of S-2 EC-ERF in maintaining data transfer rates and communication latency, even in adversarial conditions. Additionally, S-2 EC-ERF exhibited lower average energy consumption compared to other frameworks, thus emphasizing its energy-efficient nature. These findings collectively position the proposed framework as a promising and resilient solution for securing WSNs under diverse attack scenarios. The ERF-LET algorithm's accuracy in detecting security threats contributes significantly to the robustness of the overall approach, thereby providing a harmonious balance between security and energy efficiency. This research significantly advances the discourse on securing WSNs and sets the stage for further developments in the field, thereby contributing to the ongoing evolution of WSNs.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Related Works** & **Energy-Remaining (\%)** & **Accuracy (\%)** \\ \hline
[27] & 80 & 79 \\
[28] & 96 & 92 \\
[29] & 50 & 31.5 \\
[30] & 67 & 62 \\
[31] & 76 & 70 \\ S-2 EC-ERF & 94.7 & 98.193 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Comparison between S-2 EC-ERF and related works in terms of energy remaining and accuracy.  
**Author Contributions:** Conceptualization, M.K.I.I. and A.A.J.A.-A.; methodology, M.K.I.I. and A.A.J.A.-A.; software, M.K.I.I. and A.A.J.A.-A.; validation, M.K.I.I., A.A.J.A.-A., M.B.M., and A.F.; formal analysis, M.K.I.I. and A.A.J.A.-A.; investigation, M.K.I.I. and A.A.J.A.-A.; resources, M.K.I.I. and A.A.J.A.-A.; data curation, M.K.I.I. and A.A.J.A.-A.; writing--original draft preparation, M.K.I.I. and A.A.J.A.-A.; writing--review and editing, M.B.M. and A.F.; visualization, M.K.I.I. and A.A.J.A.-A.; supervision, M.B.M. and A.F.; project administration, M.K.I.I., A.A.J.A.-A., M.B.M., and A.F.; funding acquisition, M.K.I.I. and A.A.J.A.-A. All authors have read and agreed to the published version of the manuscript.  
This research received no external funding.  
**Institutional Review Board Statement:** Not applicable.  
**Informed Consent Statement:** Not applicable.  
**Data Availability Statement:** Data are available from the authors and can be provided upon request.  
**Conflicts of Interest:** The authors declare no conflicts of interest.