Merge branch 'Zar-Branch' of https://git.racooncity.org/brotoskyj/AirlockTools into allowlistsearch
This commit is contained in:
+15
-10
@@ -69,11 +69,12 @@ def augmentAggregatedHashes(url, agg_df: pd.DataFrame) -> pd.DataFrame:
|
||||
return aug_df
|
||||
|
||||
def categorizeHashes(aug_df: pd.DataFrame, threat_tolerance: int, untrusted_publishers: list):
|
||||
if untrusted_publishers is None:
|
||||
untrusted_publishers = []
|
||||
if untrusted_publishers is None:
|
||||
untrusted_publishers = []
|
||||
|
||||
df = aug_df.copy()
|
||||
def reputationtool(row, threat_tolerance):
|
||||
df = aug_df.copy()
|
||||
|
||||
def reputationtool(row, threat_tolerance):
|
||||
if row["reputation_scannermatch"] == "N/A":
|
||||
return True
|
||||
try:
|
||||
@@ -83,11 +84,15 @@ def categorizeHashes(aug_df: pd.DataFrame, threat_tolerance: int, untrusted_publ
|
||||
pass
|
||||
return False
|
||||
|
||||
mask_needsreview = (df["publisher_y"] == "Not Signed") & df.apply(lambda row: reputationtool(row, threat_tolerance), axis=1)
|
||||
mask_approved = (df["publisher_y"] != "Not Signed") & (~df["publisher_y"].isin(untrusted_publishers))
|
||||
mask_needsreview = (df["publisher_y"] == "Not Signed") & df.apply(lambda row: reputationtool(row, threat_tolerance), axis=1)
|
||||
|
||||
needsreview_df = df[mask_needsreview]
|
||||
approved_df = df[mask_approved]
|
||||
remaining_df = df[~(mask_needsreview | mask_approved)]
|
||||
mask_approved = (
|
||||
((df["publisher_y"] != "Not Signed") & (~df["publisher_y"].isin(untrusted_publishers))) |
|
||||
((df["publisher_y"] == "Not Signed") & (~df.apply(lambda row: reputationtool(row, threat_tolerance), axis=1)))
|
||||
)
|
||||
|
||||
return needsreview_df, approved_df, remaining_df
|
||||
needsreview_df = df[mask_needsreview]
|
||||
approved_df = df[mask_approved]
|
||||
remaining_df = df[~(mask_needsreview | mask_approved)]
|
||||
|
||||
return needsreview_df, approved_df, remaining_df
|
||||
|
||||
Reference in New Issue
Block a user