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