## 6 Conclusions  
This research addressed the critical security challenges posed by black hole and gray hole attacks in mobile ad hoc networks (MANETs) utilizing the dynamic source routing (DSR) protocol. Our novel hybrid detection method, which synergizes anomaly detection, data mining techniques, and cryptographic measures, demonstrated significant improvements over existing approaches like Watchdog and standalone DSR.  
Our simulations and analyses revealed superior detection accuracy for both black hole and gray hole attacks, substantially reduced false-positive rates, improved packet delivery ratios (PDRs) under attack scenarios, reduced network latency, and lower system overhead. These results underscore the potential of our hybrid approach in enhancing MANET security and reliability against sophisticated cyber threats.  
Despite the promising results, our study encountered several limitations that warrant acknowledgment. Our evaluation was primarily simulation-based, and real-world implementation may present unforeseen challenges. We focused mainly on black hole and gray hole attacks, while other types of attacks may require additional consideration. The performance of our approach in very large-scale MANETs needs further investigation, and a detailed analysis of the energy impact on resource-constrained devices is needed.  
Building on this research, we propose several avenues for future work. Real-world deployments will be crucial to validate our simulation results in actual MANET environments. Adapting the hybrid approach to detect and mitigate a broader range of MANET security threats is another important direction. We also see potential in exploring advanced machine learning techniques, particularly deep learning, to further enhance detection accuracy and adaptability. Investigating the integration of our hybrid method with other network layers could lead to a more comprehensive security solution. Developing energy-aware variants of the hybrid approach will be essential to better suit resource-constrained devices in MANETs. Finally, exploring the potential of blockchain technology could enhance the trustworthiness and integrity of the detection system.  
In conclusion, our hybrid detection method represents a significant advancement in MANET security, particularly against black hole and gray hole attacks. While limitations exist, the approach shows great promise in improving network reliability and performance under threat conditions. The proposed future work directions aim to address current limitations and further enhance the robustness and applicability of this security solution in diverse MANET scenarios. As MANETs continue to play a crucial role in various applications, from disaster recovery to military operations, the ongoing development of robust security measures remains paramount. Our research contributes to this vital field, paving the way for more secure and reliable ad hoc network communications in an increasingly connected world.  
Conceptualization, M.Y.; methodology, M.Y., S.C. and G.S.; validation, M.Y., S.C. and G.S.; data curation, M.Y.; writing--original draft preparation, M.Y., S.C. and G.S.; writing--review and editing, S.C. and G.S.; supervision, S.C. and G.S. All authors have read and agreed to the published version of the manuscript.  
This work was funded by the Next Generation EU--European Union supporting project number PE00000014.  
Not applicable.  
The raw data supporting the conclusions of this article will be made available by the authors on request.  
This work was partially supported by project SERICS (PE00000014) under the NRRP MUR program funded by the EU--NGEU.  
The authors declare no conflicts of interest.