fix: Fixed config field parsing for various modules

- Same as previous commit
pull/603/head
chrisr3d 2019-10-30 16:31:57 +01:00
parent d0ddfb3355
commit 393b33d02d
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
3 changed files with 9 additions and 9 deletions

View File

@ -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)

View File

@ -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'))

View File

@ -31,9 +31,8 @@ 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'
if not request.get('config') or not request['config'].get('apikey'):
misperrors['error'] = 'Urlscan apikey is missing'
return misperrors
client = urlscanAPI(request['config']['apikey'])