

def get_wildfire_apikey(session_key):
    'Given a splunk session_key returns a clear text API Key from a splunk password container'
    try:
        entities = entity.getEntities(['admin', 'passwords'], namespace=APPNAME, owner='nobody', sessionKey=session_key)
    except Exception as e:
        exit_with_error(('Could not get %s credentials from splunk. Error: %s' % (APPNAME, str(e))))
    for (i, c) in entities.items():
        if (session_key['username'] == 'wildfire_api_key'):
            return c['clear_password']
    logger.warn('There are Palo Alto Networks WildFire malware events, but no WildFire API Key found, please set the API key in the SplunkforPaloAltoNetworks App set up page')
    exit_with_error('No Wildfire API key is set, set apikey in App configuration.')

dataset/ETHPy150Open PaloAltoNetworks/SplunkforPaloAltoNetworks/bin/lib/common.py get_wildfire_apikey/VarMisuse@83/166 `c`->`session_key`