mirror of https://github.com/MISP/misp-modules
add: Update to support sha1 & sha256 attributes
parent
87e9238365
commit
22173c249e
|
@ -2,8 +2,8 @@ import json
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
misperrors = {'error': 'Error'}
|
misperrors = {'error': 'Error'}
|
||||||
mispattributes = {'input': ['md5'], 'output': ['text']}
|
mispattributes = {'input': ['md5', 'sha1', 'sha256'], 'output': ['text']}
|
||||||
moduleinfo = {'version': '0.1', 'author': 'Alexandre Dulaunoy', 'description': 'An expansion module to check hashes against hashdd.com including NSLR dataset.', 'module-type': ['hover']}
|
moduleinfo = {'version': '0.2', 'author': 'Alexandre Dulaunoy', 'description': 'An expansion module to check hashes against hashdd.com including NSLR dataset.', 'module-type': ['hover']}
|
||||||
moduleconfig = []
|
moduleconfig = []
|
||||||
hashddapi_url = 'https://api.hashdd.com/'
|
hashddapi_url = 'https://api.hashdd.com/'
|
||||||
|
|
||||||
|
@ -11,11 +11,15 @@ hashddapi_url = 'https://api.hashdd.com/'
|
||||||
def handler(q=False):
|
def handler(q=False):
|
||||||
if q is False:
|
if q is False:
|
||||||
return False
|
return False
|
||||||
|
v = None
|
||||||
request = json.loads(q)
|
request = json.loads(q)
|
||||||
if not request.get('md5'):
|
for input_type in mispattributes['input']:
|
||||||
misperrors['error'] = 'MD5 hash value is missing missing'
|
if request.get(input_type):
|
||||||
|
v = request[input_type].upper()
|
||||||
|
break
|
||||||
|
if v is None:
|
||||||
|
misperrors['error'] = 'Hash value is missing.'
|
||||||
return misperrors
|
return misperrors
|
||||||
v = request.get('md5').upper()
|
|
||||||
r = requests.post(hashddapi_url, data={'hash':v})
|
r = requests.post(hashddapi_url, data={'hash':v})
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
state = json.loads(r.text)
|
state = json.loads(r.text)
|
||||||
|
|
Loading…
Reference in New Issue