Note - Path exclusions have to be applied to the policy, hash exclusions to allowlists - I will need to update step 5 to accomodate

This commit is contained in:
=
2025-08-28 17:17:57 -04:00
parent 6a06bba3fb
commit 0287475090
2 changed files with 44 additions and 3 deletions
-1
View File
@@ -142,4 +142,3 @@ def listCategories(url):
choice = int(choice) - 1
return choice, policiesnames
+44 -2
View File
@@ -13,7 +13,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import requests
import json
import utils.pretty as ct
def addHash(policy, hash):
print(f"Adding the following hashes to {policy}:")
@@ -21,4 +23,44 @@ def addHash(policy, hash):
def addPath(policy, hash):
print(f"Adding the following Path Exclusions to {policy}:")
print(hash)
print(hash)
def addHashReal(url, allowlistID, hashlist):
endpoint = url + '/v1/hash/application/add'
print(ct.colorText("[+] Grabbing All Categories", "cyan"))
payload = {
"applicationid" : allowlistID
"hashes" : hashlist
}
headers = {
"X-APIKey": os.getenv('APIKEY')
}
try:
response = requests.request("POST", endpoint, headers=headers, data=payload, verify=False)
response.raise_for_status() # Raise an error for bad status codes
parse_text = json.loads(response.text)
print(parse_text)
except requests.exceptions.RequestException as e:
return {"error": str(e)}
def addPathReal(url, grouplistID, pathlist):
endpoint = url + '/v1/group/path/add'
print(ct.colorText("[+] Grabbing All Categories", "cyan"))
payload = {
"applicationid" : grouplistID
"hashes" : pathlist
}
headers = {
"X-APIKey": os.getenv('APIKEY')
}
try:
response = requests.request("POST", endpoint, headers=headers, data=payload, verify=False)
response.raise_for_status() # Raise an error for bad status codes
parse_text = json.loads(response.text)
print(parse_text)
except requests.exceptions.RequestException as e:
return {"error": str(e)}