regles :thumbs_up:

master
Paul SQUIZZATO 2 years ago
parent 53bdd62652
commit 4140960d6c

@ -94,7 +94,6 @@ def decode(pkt):
bigL.append(miniL)
if bigL!=[]:
print("attention")
triPacket(bigL,connec)

@ -1,6 +1,4 @@
import psycopg2 as psy
import pandas as pd
import getpass
import regles
def verifRegle(co):
@ -15,11 +13,13 @@ def verifRegle(co):
ruleWarning=0
condition=len(rule[0])
for i in rule[0]:
if dataState[(i[0],i[1])]==i[2]:
ruleAccepted+=1
if (i[0],i[1]) in dataState:
if dataState[(i[0],i[1])]==i[2]:
ruleWarning+=1
if ruleWarning>=condition:
if dataState(rule[1][0],rule[1][1])==rule[1][2]:
return False
if (rule[1][0],rule[1][1]) in dataState:
if dataState[(rule[1][0],rule[1][1])]==rule[1][2]:
return False
return True
@ -35,6 +35,7 @@ def ecritureBDD(lStatus,connec):
if verifRegle(co):
co.commit()
else:
print("A rule has been violated. The system is endangered. The database")
co.rollback()
cur.close()
except(Exception,psy.DatabaseError) as error:

Loading…
Cancel
Save