Browse Source

fix: Fixed config field parsing for various modules

- Same as previous commit
pull/352/head
chrisr3d 2 years ago
parent
commit
393b33d02d
No known key found for this signature in database GPG Key ID: 6BBED1B63A6D639F
  1. 7
      misp_modules/modules/expansion/securitytrails.py
  2. 4
      misp_modules/modules/expansion/shodan.py
  3. 7
      misp_modules/modules/expansion/urlscan.py

7
misp_modules/modules/expansion/securitytrails.py

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

4
misp_modules/modules/expansion/shodan.py

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

7
misp_modules/modules/expansion/urlscan.py

@ -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…
Cancel
Save