diff --git a/src/decoderBrut.py b/src/decoderBrut.py index 9eb65f2..d0797cf 100644 --- a/src/decoderBrut.py +++ b/src/decoderBrut.py @@ -94,7 +94,6 @@ def decode(pkt): bigL.append(miniL) if bigL!=[]: - print("attention") triPacket(bigL,connec) diff --git a/src/ecritureBDD.py b/src/ecritureBDD.py index 01232d3..41a58bb 100644 --- a/src/ecritureBDD.py +++ b/src/ecritureBDD.py @@ -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,10 +35,11 @@ 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: print(error) finally: if co is not None: - co.close() \ No newline at end of file + co.close()