mirror of
https://github.com/Oxbian/SIDPS.git
synced 2025-07-06 20:05:42 +02:00
feat: rewrite sql + alert sent to sql db from idps
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
from datetime import datetime
|
||||
|
||||
def rule(packet, tcp_packets, db):
|
||||
"""Règle SYNScan:
|
||||
Un SYNScan va envoyer des requêtes TCP avec le flag SYN
|
||||
@ -9,4 +11,5 @@ def rule(packet, tcp_packets, db):
|
||||
seuil = db.get_key("synscan_count", 5)
|
||||
|
||||
if (tcp_packets.count_packet_of_type("RA", time_window) + tcp_packets.count_packet_of_type("SA", time_window)) + tcp_packets.count_packet_of_type("R", time_window) >= seuil:
|
||||
db.send_alert(datetime.now(), 5, None, "Syn scan", packet['IP'].src, packet['IP'].dst, proto="TCP", reason="Détection de nombreux patterns de Syn->SynACK->Reset ACK et Syn->Reset ACK", act="Alerte")
|
||||
print(f"Alerte, seuil dépassés, risque de SynScan")
|
||||
|
@ -1,3 +1,5 @@
|
||||
from datetime import datetime
|
||||
|
||||
def rule(packet, tcp_packets, db):
|
||||
"""Règle TCPConnect Scan:
|
||||
Un scan TCP connect va effectuer une connexion TCP en entier sur chaque port scanné.
|
||||
@ -8,4 +10,5 @@ def rule(packet, tcp_packets, db):
|
||||
seuil = db.get_key("tcpconnectscan_count", 5)
|
||||
|
||||
if (tcp_packets.count_packet_of_type("A", time_window) + tcp_packets.count_packet_of_type("RA", time_window)) >= seuil:
|
||||
print(f"Alerte, seuils dépassés, risque de TCPConnectScan")
|
||||
db.send_alert(datetime.now(), 5, None, "TCPConnect Scan", packet['IP'].src, packet['IP'].dst, proto="TCP", reason="Détection de nombreux patterns de Syn->SynACK->ACK->Reset->ACK et Syn->Reset ACK", act="Alerte")
|
||||
print(f"Alerte, seuils dépassés, risque de TCPConnectScan")
|
||||
|
Reference in New Issue
Block a user