-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
77 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,12 @@ | ||
{ | ||
"name": "URLhaus", | ||
"author": "ninoseki", | ||
"author": "ninoseki, Nils Kuhnert", | ||
"license": "MIT", | ||
"url": "https://github.com/ninoseki/cortex_URLhaus_analyzer", | ||
"version": "1.1", | ||
"description": "Search domains, URLs or hashes on URLhaus.", | ||
"dataTypeList": ["domain", "url", "hash"], | ||
"version": "2.0", | ||
"description": "Search domains, IPs, URLs or hashes on URLhaus.", | ||
"dataTypeList": ["domain", "url", "hash", "ip"], | ||
"command": "URLhaus/URLhaus_analyzer.py", | ||
"configurationItems": [ | ||
{ | ||
"name": "cache.duration", | ||
"description": "Define the cache duration", | ||
"type": "number", | ||
"multi": false, | ||
"required": true, | ||
"defaultValue": 300 | ||
}, | ||
{ | ||
"name": "cache.root", | ||
"description": "Define the path to the stored data", | ||
"type": "string", | ||
"multi": false, | ||
"required": false | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import requests | ||
|
||
|
||
BASEURL = 'https://urlhaus-api.abuse.ch/v1/' | ||
|
||
|
||
class URLhausClient(object): | ||
@staticmethod | ||
def __request(endpoint, key, value) -> dict: | ||
results = requests.post( | ||
BASEURL + endpoint + '/', | ||
{key: value} | ||
).json() | ||
|
||
if results['query_status'] in ['ok', 'no_results']: | ||
return results | ||
else: | ||
raise ValueError('Given value seems not to be valuid: <{}: {}>.'.format(key, value)) | ||
|
||
@staticmethod | ||
def search_url(url: str) -> dict: | ||
return URLhausClient.__request( | ||
'url', | ||
'url', | ||
url | ||
) | ||
|
||
@staticmethod | ||
def search_host(host: str) -> dict: | ||
return URLhausClient.__request( | ||
'host', | ||
'host', | ||
host | ||
) | ||
|
||
@staticmethod | ||
def search_payload(payload_hash: str) -> dict: | ||
if len(payload_hash) == 32: | ||
return URLhausClient.__request( | ||
'payload', | ||
'md5_hash', | ||
payload_hash | ||
) | ||
elif len(payload_hash) == 64: | ||
return URLhausClient.__request( | ||
'payload', | ||
'sha256_hash', | ||
payload_hash | ||
) | ||
else: | ||
raise ValueError('Only sha256 and md5 hashes are allowed.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
beautifulsoup4 | ||
cortexutils | ||
diskcache | ||
requests |
File renamed without changes.
File renamed without changes.