From 3bb69aaab7cf832065a29405d0e7c312d4051244 Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 10 Sep 2025 17:01:17 -0400 Subject: [PATCH] alpha version --- utils/otpfunctions.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/utils/otpfunctions.py b/utils/otpfunctions.py index d1bf05d..55e4fb4 100644 --- a/utils/otpfunctions.py +++ b/utils/otpfunctions.py @@ -80,10 +80,14 @@ def monitorOTP(url, pups): current_active_OTP = pd.read_parquet(new_otp_path) + + if 'otpid' not in current_active_OTP.columns: current_active_OTP = pd.DataFrame(columns=['otpid']) + if 'otpid' not in old_active_OTP.columns: old_active_OTP = pd.DataFrame(columns=['otpid']) newly_added = current_active_OTP[~current_active_OTP['otpid'].isin(old_active_OTP['otpid'])] still_in_OTP = old_active_OTP[old_active_OTP['otpid'].isin(current_active_OTP['otpid'])] no_longer_OTP = old_active_OTP[~old_active_OTP['otpid'].isin(current_active_OTP['otpid'])] + register_function("addhash", addOTPHashes) @@ -123,12 +127,12 @@ def monitorOTP(url, pups): if not os.path.exists(f"OTP\\PARQ\\localapprovalhistory.parquet"): df = pd.DataFrame() df.to_parquet(f"OTP\\PARQ\\localapprovalhistory.parquet") - else: - history = pd.read_parquet(f"OTP\\PARQ\\localapprovalhistory.parquet") - history = pd.concat([history, finalhashesadded], ignore_index=True) - ct.style_dataframe_dark(history, f"localapproval_history.html") + + history = pd.read_parquet(f"OTP\\PARQ\\localapprovalhistory.parquet") + history = pd.concat([history, finalhashesadded], ignore_index=True) + ct.style_dataframe_dark(history, f"localapproval_history.html") - history.to_parquet(f"OTP\\PARQ\\localapprovalhistory.parquet") + history.to_parquet(f"OTP\\PARQ\\localapprovalhistory.parquet") os.remove(f"OTP\\PARQ\\otp_activities_{pid}.parquet") del finalhashesadded @@ -156,7 +160,7 @@ def addOTPHashes(url, clientid, otpid, pups): # Add hashes to policy if hashes_to_add: - policyf.addHash(url, allowlist, hashes_to_add) + policyf.addHashReal(url, allowlist, hashes_to_add) # Update 'hash_added' column activities["hash_added"] = activities.apply(