Reverting Back to Working Branch

This commit is contained in:
brotoskyj
2025-08-25 12:12:34 -04:00
parent c7b26f171b
commit 1691bc67be
6 changed files with 205 additions and 1 deletions
+26
View File
@@ -90,15 +90,22 @@ def categorizeHashes(aug_df: pd.DataFrame, threat_tolerance: int, untrusted_publ
df = aug_df.copy()
<<<<<<< HEAD
def reputationtool(row):
val = row["reputation_scannermatch"]
if pd.isna(val) or val == "N/A":
return row["publisher_y"] == "Not Signed"
=======
def reputationtool(row, threat_tolerance):
if row["reputation_scannermatch"] == "N/A":
return True
>>>>>>> ccbf716 (Zar-Branch (#6))
try:
return int(val) > threat_tolerance
except (ValueError, TypeError):
return row["publisher_y"] == "Not Signed"
<<<<<<< HEAD
df["reputation_flag"] = df.apply(reputationtool, axis=1)
mask_needsreview = (
@@ -125,3 +132,22 @@ def categorizeHashes(aug_df: pd.DataFrame, threat_tolerance: int, untrusted_publ
unapproved_df = df[~(mask_needsreview | mask_approved)]
return needsreview_df, approved_df, unapproved_df
=======
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))) &
(df["publisher_y"] != "Not Signed") # explicitly signed
) | (
(df["publisher_y"] == "Not Signed") &
(~df.apply(lambda row: reputationtool(row, threat_tolerance), axis=1)) &
(~df["publisher_y"].isin(untrusted_publishers)) # exclude untrusted even if unsigned
)
needsreview_df = df[mask_needsreview]
approved_df = df[mask_approved]
remaining_df = df[~(mask_needsreview | mask_approved)]
return needsreview_df, approved_df, remaining_df
>>>>>>> ccbf716 (Zar-Branch (#6))