MemOpt #18
@@ -142,4 +142,3 @@ def listCategories(url):
|
|||||||
choice = int(choice) - 1
|
choice = int(choice) - 1
|
||||||
return choice, policiesnames
|
return choice, policiesnames
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,9 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# 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):
|
def addHash(policy, hash):
|
||||||
print(f"Adding the following hashes to {policy}:")
|
print(f"Adding the following hashes to {policy}:")
|
||||||
@@ -22,3 +24,43 @@ def addHash(policy, hash):
|
|||||||
def addPath(policy, hash):
|
def addPath(policy, hash):
|
||||||
print(f"Adding the following Path Exclusions to {policy}:")
|
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)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user