Think i fixed the signed package issue
This commit is contained in:
+17
-5
@@ -78,19 +78,31 @@ def categorizeHashes(aug_df: pd.DataFrame, threat_tolerance: int, untrusted_publ
|
|||||||
def reputationtool(row):
|
def reputationtool(row):
|
||||||
val = row["reputation_scannermatch"]
|
val = row["reputation_scannermatch"]
|
||||||
if pd.isna(val) or val == "N/A":
|
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:
|
try:
|
||||||
return int(val) > threat_tolerance
|
return int(val) > threat_tolerance
|
||||||
except (ValueError, TypeError):
|
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)
|
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 = (
|
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]
|
needsreview_df = df[mask_needsreview]
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ def filepathInitialGroup(df: pd.DataFrame):
|
|||||||
path_eligible = grouped_df[grouped_df["depth"] > 2].drop(columns=["depth"])
|
path_eligible = grouped_df[grouped_df["depth"] > 2].drop(columns=["depth"])
|
||||||
path_ineligible = 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)
|
mask = path_eligible["grouped_directory"].str.contains(r"(?i)(?:\\Users|\\c\$\\Users|inetpub\\wwwroot|windows\\temp)", na=False)
|
||||||
move_to_ineligible = path_eligible[mask]
|
move_to_ineligible = path_eligible[mask]
|
||||||
path_eligible = path_eligible[~mask]
|
path_eligible = path_eligible[~mask]
|
||||||
|
|||||||
Reference in New Issue
Block a user