@@ -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