From ab6ee644c7d246ac1bc152f9bae44771eef941db Mon Sep 17 00:00:00 2001 From: = <=> Date: Fri, 22 Aug 2025 16:19:59 -0400 Subject: [PATCH] Think i fixed the signed package issue --- utils/hashfunctions.py | 22 +++++++++++++++++----- utils/pathfunctions.py | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/utils/hashfunctions.py b/utils/hashfunctions.py index 5ea3dfa..0bb484d 100644 --- a/utils/hashfunctions.py +++ b/utils/hashfunctions.py @@ -78,19 +78,31 @@ def categorizeHashes(aug_df: pd.DataFrame, threat_tolerance: int, untrusted_publ def reputationtool(row): val = row["reputation_scannermatch"] if pd.isna(val) or val == "N/A": - return True if row["publisher_y"] == "Not Signed" else False + return row["publisher_y"] == "Not Signed" try: return int(val) > threat_tolerance except (ValueError, TypeError): - return True if row["publisher_y"] == "Not Signed" else False + return row["publisher_y"] == "Not Signed" df["reputation_flag"] = df.apply(reputationtool, axis=1) - mask_needsreview = (df["publisher_y"] == "Not Signed") & df["reputation_flag"] + mask_needsreview = ( + ((df["publisher_y"] == "Not Signed") & df["reputation_flag"]) | + (df["reputation_status"] == "UNKNOWN") + ) mask_approved = ( - ((df["publisher_y"] != "Not Signed") & ~df["publisher_y"].isin(untrusted_publishers)) | - ((df["publisher_y"] == "Not Signed") & ~df["reputation_flag"] & ~df["publisher_y"].isin(untrusted_publishers)) + ( + (df["publisher_y"] != "Not Signed") & + ~df["publisher_y"].isin(untrusted_publishers) & + ~df["reputation_status"].isna() + ) | + ( + (df["publisher_y"] == "Not Signed") & + ~df["reputation_flag"] & + ~df["publisher_y"].isin(untrusted_publishers) & + ~df["reputation_status"].isna() + ) ) needsreview_df = df[mask_needsreview] diff --git a/utils/pathfunctions.py b/utils/pathfunctions.py index 128da2a..7c01eec 100644 --- a/utils/pathfunctions.py +++ b/utils/pathfunctions.py @@ -106,7 +106,7 @@ def filepathInitialGroup(df: pd.DataFrame): path_eligible = grouped_df[grouped_df["depth"] > 2].drop(columns=["depth"]) path_ineligible = grouped_df[grouped_df["depth"] <= 2].drop(columns=["depth"]) - # Step 10: Move entries from eligible to ineligible if grouped_directory contains 'C:\Users' or 'c$\Users' + # Step 10: Move entries from eligible to ineligible if grouped_directory contains excluded directories' mask = path_eligible["grouped_directory"].str.contains(r"(?i)(?:\\Users|\\c\$\\Users|inetpub\\wwwroot|windows\\temp)", na=False) move_to_ineligible = path_eligible[mask] path_eligible = path_eligible[~mask]