Exclusion Divide added

This commit is contained in:
=
2025-09-19 10:04:21 -04:00
parent f4d27b4e64
commit 2c5a3de437
4 changed files with 161 additions and 4 deletions
+44
View File
@@ -22,11 +22,13 @@ from AirlockTools import tryToReadCSV
#Standard Libary Imports:
import ast
import gc
import json
import os
import re
#3rd Party Imports:
import pandas as pd
import requests
def split_filepaths_grouped(df, col="filename", group_parts=4, min_parts=4):
def clean_split(path):
@@ -321,3 +323,45 @@ def mergeTesting():
merged_df.to_csv("merged_output.csv", index=False)
print(f"Merged DataFrame saved with {len(merged_df)} rows.")
def listPaths(url, group):
endpoint = url + '/v1/group/policies'
print(ct.colorText("[+] Grabbing All Paths", "cyan"))
payload = {
"groupid": [group],
}
headers = {
"X-APIKey": os.getenv('APIKEY')
}
try:
response = requests.post(endpoint, headers=headers, data=payload, verify=False)
response.raise_for_status()
parse_text = response.json()
pathnames = []
print(parse_text) # Optional: for debugging
for item in parse_text.get('response', {}).get('paths', []):
path = item.get('name')
if path:
pathnames.append(path)
return pathnames
except requests.exceptions.RequestException as e:
print(ct.colorText(f"[!] Request failed: {e}", "red"))
return []
except (KeyError, json.JSONDecodeError) as e:
print(ct.colorText(f"[!] Failed to parse response: {e}", "red"))
return []
def wildcardRegex(pattern):
pattern = pattern.replace("\\", "\\\\")
pattern = pattern.replace("**", "___RECURSIVE___")
pattern = pattern.replace("*", "[^\\\\]*")
pattern = pattern.replace("?", ".")
pattern = pattern.replace("___RECURSIVE___", ".*")
return re.compile(f"^{pattern}$", re.IGNORECASE)
+2 -1
View File
@@ -352,4 +352,5 @@ def sendToPolicyTest(url, first_policy, second_policy, destination_name, destina
print(ct.colorText(f"These hashes would be added to {allowlist_child_name}", "yellow"))
allowlist_childhashlist = allowbyhash[allowbyhash['reputation_status'] == 'UNKNOWN']['sha256'].unique().tolist()
addHash(url, allowlist_child_id, allowlist_childhashlist)
addHash(url, allowlist_child_id, allowlist_childhashlist)