mirror of https://github.com/MISP/misp-modules
fix: Fixed config field parsing for various modules
- Same as previous commitnew_module
parent
d0ddfb3355
commit
393b33d02d
|
@ -37,14 +37,15 @@ def handler(q=False):
|
||||||
|
|
||||||
request = json.loads(q)
|
request = json.loads(q)
|
||||||
|
|
||||||
if not request.get('config') and not (request['config'].get('apikey')):
|
if not request.get('config') or not (request['config'].get('apikey')):
|
||||||
misperrors['error'] = 'DNS authentication is missing'
|
misperrors['error'] = 'SecurityTrails authentication is missing'
|
||||||
return misperrors
|
return misperrors
|
||||||
|
|
||||||
api = DnsTrails(request['config'].get('apikey'))
|
api = DnsTrails(request['config'].get('apikey'))
|
||||||
|
|
||||||
if not api:
|
if not api:
|
||||||
misperrors['error'] = 'Onyphe Error instance api'
|
misperrors['error'] = 'SecurityTrails Error instance api'
|
||||||
|
return misperrors
|
||||||
if request.get('ip-src'):
|
if request.get('ip-src'):
|
||||||
ip = request['ip-src']
|
ip = request['ip-src']
|
||||||
return handle_ip(api, ip, misperrors)
|
return handle_ip(api, ip, misperrors)
|
||||||
|
|
|
@ -27,8 +27,8 @@ def handler(q=False):
|
||||||
misperrors['error'] = "Unsupported attributes type"
|
misperrors['error'] = "Unsupported attributes type"
|
||||||
return misperrors
|
return misperrors
|
||||||
|
|
||||||
if not request.get('config') and not (request['config'].get('apikey')):
|
if not request.get('config') or not request['config'].get('apikey'):
|
||||||
misperrors['error'] = 'shodan authentication is missing'
|
misperrors['error'] = 'Shodan authentication is missing'
|
||||||
return misperrors
|
return misperrors
|
||||||
api = shodan.Shodan(request['config'].get('apikey'))
|
api = shodan.Shodan(request['config'].get('apikey'))
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,9 @@ def handler(q=False):
|
||||||
if q is False:
|
if q is False:
|
||||||
return False
|
return False
|
||||||
request = json.loads(q)
|
request = json.loads(q)
|
||||||
if (request.get('config')):
|
if not request.get('config') or not request['config'].get('apikey'):
|
||||||
if (request['config'].get('apikey') is None):
|
misperrors['error'] = 'Urlscan apikey is missing'
|
||||||
misperrors['error'] = 'urlscan apikey is missing'
|
return misperrors
|
||||||
return misperrors
|
|
||||||
client = urlscanAPI(request['config']['apikey'])
|
client = urlscanAPI(request['config']['apikey'])
|
||||||
|
|
||||||
r = {'results': []}
|
r = {'results': []}
|
||||||
|
|
Loading…
Reference in New Issue