mirror of
https://github.com/Oxbian/SIDPS.git
synced 2025-07-06 20:05:42 +02:00
feat: config file + database connection / dockerfile
This commit is contained in:
@ -1,8 +1,12 @@
|
||||
# Seuils
|
||||
TIME_WINDOW = 180
|
||||
NB_SEUIL = 5
|
||||
def rule(packet, tcp_packets, db):
|
||||
"""Règle SYNScan:
|
||||
Un SYNScan va envoyer des requêtes TCP avec le flag SYN
|
||||
Si le port est ouvert alors le serveur répondra: Syn ACK, puis le client Reset la connexion
|
||||
Sinon le port est fermé et le serveur répondera: Reset ACK
|
||||
"""
|
||||
|
||||
time_window = db.get_key("synscan_time", 180)
|
||||
seuil = db.get_key("synscan_count", 5)
|
||||
|
||||
def rule(packet, tcp_packets):
|
||||
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) >= NB_SEUIL:
|
||||
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:
|
||||
print(f"Alerte, seuil dépassés, risque de SynScan")
|
||||
|
@ -1,8 +1,11 @@
|
||||
# Seuils
|
||||
TIME_WINDOW = 180 # 180 secondes pour avoir X paquets
|
||||
NB_SEUIL = 5
|
||||
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é.
|
||||
Si le port est ouvert le serveur acceptera la connexion SYN -> SYN ACK -> ACK -> Reset -> ACK
|
||||
Sinon le port est fermé et le serveur refusera la connexion SYN -> Reset ACK
|
||||
"""
|
||||
time_window = db.get_key("tcpconnectscan_time", 180)
|
||||
seuil = db.get_key("tcpconnectscan_count", 5)
|
||||
|
||||
|
||||
def rule(packet, tcp_packets):
|
||||
if (tcp_packets.count_packet_of_type("A", TIME_WINDOW) + tcp_packets.count_packet_of_type("RA", TIME_WINDOW)) >= NB_SEUIL:
|
||||
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")
|
||||
|
Reference in New Issue
Block a user