Quick Fix - added filepath to csv reads

This commit is contained in:
=
2025-08-22 14:15:48 -04:00
parent ac57773a9a
commit 56de83478e
+7 -7
View File
@@ -147,8 +147,8 @@ def menu_prepare_to_enforce():
elif choice == "5": elif choice == "5":
if history_pol1_staged == True & history_pol2_staged == True: if history_pol1_staged == True & history_pol2_staged == True:
df1 = tryToReadCSV(f"df_aggregated_{first_policy}.csv") df1 = tryToReadCSV(f"dataframe_csv\\df_aggregated_{first_policy}.csv")
df2 = tryToReadCSV(f"df_aggregated_{second_policy}.csv") df2 = tryToReadCSV(f"dataframe_csv\\df_aggregated_{second_policy}.csv")
df_aggregated_combo= pd.concat([df1 , df2], ignore_index=True) df_aggregated_combo= pd.concat([df1 , df2], ignore_index=True)
df_aggregated_combo.to_html(f"dataframe_html\\df_aggregated_combo_{first_policy}_{second_policy}.html", index=False) df_aggregated_combo.to_html(f"dataframe_html\\df_aggregated_combo_{first_policy}_{second_policy}.html", index=False)
df_aggregated_combo.to_csv(f"dataframe_csv\\df_aggregated_combo_{first_policy}_{second_policy}.csv", index=False) df_aggregated_combo.to_csv(f"dataframe_csv\\df_aggregated_combo_{first_policy}_{second_policy}.csv", index=False)
@@ -158,7 +158,7 @@ def menu_prepare_to_enforce():
elif choice == "6": elif choice == "6":
if history_staged == True: if history_staged == True:
df_augmented = utils.hashfunctions.augmentAggregatedHashes(url,tryToReadCSV(f"df_aggregated_combo_{first_policy}_{second_policy}.csv")) df_augmented = utils.hashfunctions.augmentAggregatedHashes(url,tryToReadCSV(f"dataframe_csv\\df_aggregated_combo_{first_policy}_{second_policy}.csv"))
df_augmented.to_html(f"dataframe_html\\df_augmented_combo_{first_policy}_{second_policy}.html", index=False) df_augmented.to_html(f"dataframe_html\\df_augmented_combo_{first_policy}_{second_policy}.html", index=False)
df_augmented.to_csv(f"dataframe_csv\\df_augmented_combo_{first_policy}_{second_policy}.csv", index=False) df_augmented.to_csv(f"dataframe_csv\\df_augmented_combo_{first_policy}_{second_policy}.csv", index=False)
hashes_threat_pulled = True hashes_threat_pulled = True
@@ -167,7 +167,7 @@ def menu_prepare_to_enforce():
elif choice == "7": elif choice == "7":
if hashes_threat_pulled == True: if hashes_threat_pulled == True:
path_eligible, path_ineligible = utils.pathfunctions.filepathInitialGroup(pd.read_csv(f"df_augmented_combo_{first_policy}_{second_policy}.csv")) path_eligible, path_ineligible = utils.pathfunctions.filepathInitialGroup(pd.read_csv(f"dataframe_csv\\df_augmented_combo_{first_policy}_{second_policy}.csv"))
path_eligible.to_html(f"dataframe_html\\df_path_eligible_{first_policy}_{second_policy}.html", index=False) path_eligible.to_html(f"dataframe_html\\df_path_eligible_{first_policy}_{second_policy}.html", index=False)
path_eligible.to_csv(f"dataframe_csv\\df_path_eligible_{first_policy}_{second_policy}.csv", index=False) path_eligible.to_csv(f"dataframe_csv\\df_path_eligible_{first_policy}_{second_policy}.csv", index=False)
path_ineligible.to_html(f"dataframe_html\\df_path_ineligible_{first_policy}_{second_policy}.html", index=False) path_ineligible.to_html(f"dataframe_html\\df_path_ineligible_{first_policy}_{second_policy}.html", index=False)
@@ -178,7 +178,7 @@ def menu_prepare_to_enforce():
elif choice == "8": elif choice == "8":
if path_exclusions_calculated == True: if path_exclusions_calculated == True:
categorized = utils.hashfunctions.categorizeHashes(pd.read_csv(f"df_augmented_combo_{first_policy}_{second_policy}.csv"), treat_tolerance_constant, badpublisherlist) categorized = utils.hashfunctions.categorizeHashes(pd.read_csv(f"dataframe_csv\\df_augmented_combo_{first_policy}_{second_policy}.csv"), treat_tolerance_constant, badpublisherlist)
categorized[0].to_html(f"dataframe_html\\df_hashes_needing_approval_{first_policy}_{second_policy}.html", index=False) categorized[0].to_html(f"dataframe_html\\df_hashes_needing_approval_{first_policy}_{second_policy}.html", index=False)
categorized[0].to_csv(f"dataframe_csv\\df_hashes_needing_approval_{first_policy}_{second_policy}.csv", index=False) categorized[0].to_csv(f"dataframe_csv\\df_hashes_needing_approval_{first_policy}_{second_policy}.csv", index=False)
categorized[1].to_html(f"dataframe_html\\df_automatically_approved_hashes_{first_policy}_{second_policy}.html", index=False) categorized[1].to_html(f"dataframe_html\\df_automatically_approved_hashes_{first_policy}_{second_policy}.html", index=False)
@@ -191,7 +191,7 @@ def menu_prepare_to_enforce():
elif choice == "9": elif choice == "9":
if hashes_categorized == True: if hashes_categorized == True:
allowpaths = utils.allowfunctions.filter_and_drop(pd.read_csv(f"df_automatically_approved_hashes_{first_policy}_{second_policy}.csv"),tryToReadCSV(f"df_path_eligible_{first_policy}_{second_policy}.csv"), path_exclusion_constant) allowpaths = utils.allowfunctions.filter_and_drop(pd.read_csv(f"dataframe_csv\\df_automatically_approved_hashes_{first_policy}_{second_policy}.csv"),tryToReadCSV(f"dataframe_csv\\df_path_eligible_{first_policy}_{second_policy}.csv"), path_exclusion_constant)
allowpaths.to_html(f"dataframe_html\\df_allowed_paths_{first_policy}_{second_policy}.html", index=False) allowpaths.to_html(f"dataframe_html\\df_allowed_paths_{first_policy}_{second_policy}.html", index=False)
allowpaths.to_csv(f"dataframe_csv\\df_allowed_paths_{first_policy}_{second_policy}.csv", index=False) allowpaths.to_csv(f"dataframe_csv\\df_allowed_paths_{first_policy}_{second_policy}.csv", index=False)
allowed_paths_determined = True allowed_paths_determined = True
@@ -204,7 +204,7 @@ def menu_prepare_to_enforce():
def tryToReadCSV(csv): def tryToReadCSV(csv):
try: try:
df =tryToReadCSV(csv) df =pd.read_csv(csv)
if df.empty: if df.empty:
print("CSV file has headers but no data rows.") print("CSV file has headers but no data rows.")
else: else: