mirror of https://github.com/MISP/misp-modules
fix: pep8 foobar.
parent
9cb21f98e1
commit
f82933779f
|
@ -9,6 +9,7 @@ moduleconfig = ['user-agent']#TODO take this into account in the code
|
|||
greynoise_api_url = 'http://api.greynoise.io:8888/v1/query/ip'
|
||||
default_user_agent = 'MISP-Module'
|
||||
|
||||
|
||||
def handler(q=False):
|
||||
if q is False:
|
||||
return False
|
||||
|
@ -32,9 +33,11 @@ def handler(q=False):
|
|||
misperrors['error'] = 'GreyNoise API not accessible (HTTP ' + str(r.status_code) + ')'
|
||||
return misperrors['error']
|
||||
|
||||
|
||||
def introspection():
|
||||
return mispattributes
|
||||
|
||||
|
||||
def version():
|
||||
moduleinfo['config'] = moduleconfig
|
||||
return moduleinfo
|
||||
|
|
|
@ -9,6 +9,7 @@ moduleconfig = ['user-agent']#TODO take this into account in the code
|
|||
haveibeenpwned_api_url = 'https://api.haveibeenpwned.com/api/v2/breachedaccount/'
|
||||
default_user_agent = 'MISP-Module' # User agent (must be set, requiered by API))
|
||||
|
||||
|
||||
def handler(q=False):
|
||||
if q is False:
|
||||
return False
|
||||
|
@ -22,7 +23,7 @@ def handler(q=False):
|
|||
return misperrors
|
||||
|
||||
r = requests.get(haveibeenpwned_api_url + email, headers={'user-agent': default_user_agent}) # Real request
|
||||
if r.status_code == 200:##OK (record found)
|
||||
if r.status_code == 200: # OK (record found)
|
||||
breaches = json.loads(r.text)
|
||||
if breaches:
|
||||
return {'results': [{'types': mispattributes['output'], 'values': breaches}]}
|
||||
|
@ -32,9 +33,11 @@ def handler(q=False):
|
|||
misperrors['error'] = 'haveibeenpwned.com API not accessible (HTTP ' + str(r.status_code) + ')'
|
||||
return misperrors['error']
|
||||
|
||||
|
||||
def introspection():
|
||||
return mispattributes
|
||||
|
||||
|
||||
def version():
|
||||
moduleinfo['config'] = moduleconfig
|
||||
return moduleinfo
|
||||
|
|
Loading…
Reference in New Issue