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'
|
greynoise_api_url = 'http://api.greynoise.io:8888/v1/query/ip'
|
||||||
default_user_agent = 'MISP-Module'
|
default_user_agent = 'MISP-Module'
|
||||||
|
|
||||||
|
|
||||||
def handler(q=False):
|
def handler(q=False):
|
||||||
if q is False:
|
if q is False:
|
||||||
return False
|
return False
|
||||||
|
@ -32,9 +33,11 @@ def handler(q=False):
|
||||||
misperrors['error'] = 'GreyNoise API not accessible (HTTP ' + str(r.status_code) + ')'
|
misperrors['error'] = 'GreyNoise API not accessible (HTTP ' + str(r.status_code) + ')'
|
||||||
return misperrors['error']
|
return misperrors['error']
|
||||||
|
|
||||||
|
|
||||||
def introspection():
|
def introspection():
|
||||||
return mispattributes
|
return mispattributes
|
||||||
|
|
||||||
|
|
||||||
def version():
|
def version():
|
||||||
moduleinfo['config'] = moduleconfig
|
moduleinfo['config'] = moduleconfig
|
||||||
return moduleinfo
|
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/'
|
haveibeenpwned_api_url = 'https://api.haveibeenpwned.com/api/v2/breachedaccount/'
|
||||||
default_user_agent = 'MISP-Module' # User agent (must be set, requiered by API))
|
default_user_agent = 'MISP-Module' # User agent (must be set, requiered by API))
|
||||||
|
|
||||||
|
|
||||||
def handler(q=False):
|
def handler(q=False):
|
||||||
if q is False:
|
if q is False:
|
||||||
return False
|
return False
|
||||||
|
@ -22,7 +23,7 @@ def handler(q=False):
|
||||||
return misperrors
|
return misperrors
|
||||||
|
|
||||||
r = requests.get(haveibeenpwned_api_url + email, headers={'user-agent': default_user_agent}) # Real request
|
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)
|
breaches = json.loads(r.text)
|
||||||
if breaches:
|
if breaches:
|
||||||
return {'results': [{'types': mispattributes['output'], 'values': 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) + ')'
|
misperrors['error'] = 'haveibeenpwned.com API not accessible (HTTP ' + str(r.status_code) + ')'
|
||||||
return misperrors['error']
|
return misperrors['error']
|
||||||
|
|
||||||
|
|
||||||
def introspection():
|
def introspection():
|
||||||
return mispattributes
|
return mispattributes
|
||||||
|
|
||||||
|
|
||||||
def version():
|
def version():
|
||||||
moduleinfo['config'] = moduleconfig
|
moduleinfo['config'] = moduleconfig
|
||||||
return moduleinfo
|
return moduleinfo
|
||||||
|
|
Loading…
Reference in New Issue