RustImplementation #23
+10
-6
@@ -80,10 +80,14 @@ def monitorOTP(url, pups):
|
|||||||
|
|
||||||
current_active_OTP = pd.read_parquet(new_otp_path)
|
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'])]
|
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'])]
|
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'])]
|
no_longer_OTP = old_active_OTP[~old_active_OTP['otpid'].isin(current_active_OTP['otpid'])]
|
||||||
|
|
||||||
|
|
||||||
register_function("addhash", addOTPHashes)
|
register_function("addhash", addOTPHashes)
|
||||||
|
|
||||||
@@ -123,12 +127,12 @@ def monitorOTP(url, pups):
|
|||||||
if not os.path.exists(f"OTP\\PARQ\\localapprovalhistory.parquet"):
|
if not os.path.exists(f"OTP\\PARQ\\localapprovalhistory.parquet"):
|
||||||
df = pd.DataFrame()
|
df = pd.DataFrame()
|
||||||
df.to_parquet(f"OTP\\PARQ\\localapprovalhistory.parquet")
|
df.to_parquet(f"OTP\\PARQ\\localapprovalhistory.parquet")
|
||||||
else:
|
|
||||||
history = pd.read_parquet(f"OTP\\PARQ\\localapprovalhistory.parquet")
|
history = pd.read_parquet(f"OTP\\PARQ\\localapprovalhistory.parquet")
|
||||||
history = pd.concat([history, finalhashesadded], ignore_index=True)
|
history = pd.concat([history, finalhashesadded], ignore_index=True)
|
||||||
ct.style_dataframe_dark(history, f"localapproval_history.html")
|
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")
|
os.remove(f"OTP\\PARQ\\otp_activities_{pid}.parquet")
|
||||||
del finalhashesadded
|
del finalhashesadded
|
||||||
@@ -156,7 +160,7 @@ def addOTPHashes(url, clientid, otpid, pups):
|
|||||||
|
|
||||||
# Add hashes to policy
|
# Add hashes to policy
|
||||||
if hashes_to_add:
|
if hashes_to_add:
|
||||||
policyf.addHash(url, allowlist, hashes_to_add)
|
policyf.addHashReal(url, allowlist, hashes_to_add)
|
||||||
|
|
||||||
# Update 'hash_added' column
|
# Update 'hash_added' column
|
||||||
activities["hash_added"] = activities.apply(
|
activities["hash_added"] = activities.apply(
|
||||||
|
|||||||
Reference in New Issue
Block a user