Skip to content

Commit a473676

Browse files
committed
fix: [urlhaus] Added missing auth_key argument to all parsers
1 parent 6c48d49 commit a473676

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

misp_modules/modules/expansion/urlhaus.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def __init__(self, attribute):
6868
self.attribute.from_dict(**attribute)
6969
self.url = "https://urlhaus-api.abuse.ch/v1/host/"
7070

71-
def query_api(self):
72-
response = requests.post(self.url, data={"host": self.attribute.value}).json()
71+
def query_api(self, auth_key):
72+
response = requests.post(self.url, headers={'Auth-Key': auth_key}, data={"host": self.attribute.value}).json()
7373
if response["query_status"] != "ok":
7474
return self.parse_error(response["query_status"])
7575
if "urls" in response and response["urls"]:
@@ -85,7 +85,7 @@ def __init__(self, attribute):
8585
self.attribute.from_dict(**attribute)
8686
self.url = "https://urlhaus-api.abuse.ch/v1/payload/"
8787

88-
def query_api(self):
88+
def query_api(self, auth_key):
8989
hash_type = self.attribute.type
9090
file_object = MISPObject("file")
9191
if (
@@ -94,7 +94,7 @@ def query_api(self):
9494
and self.attribute.event_id != "0"
9595
):
9696
file_object.id = self.attribute.object_id
97-
response = requests.post(self.url, data={"{}_hash".format(hash_type): self.attribute.value}).json()
97+
response = requests.post(self.url, headers={'Auth-Key': auth_key}, data={"{}_hash".format(hash_type): self.attribute.value}).json()
9898
if response["query_status"] != "ok":
9999
return self.parse_error(response["query_status"])
100100
other_hash_type = "md5" if hash_type == "sha256" else "sha256"

0 commit comments

Comments
 (0)