Modern Network Security Threats and Defense Mechanisms: A Comparative Study of Intrusion Detection and Prevention Systems