

def get_firewall_credentials(session_key):
    'Given a splunk session_key returns a clear text user name and password from a splunk password container'
    try:
        logger.debug('Getting firewall credentials from Splunk')
        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 (c['username'] != 'wildfire_api_key'):
            return (c['username'], c['clear_password'])
    raise NoCredentialsFound('No credentials have been found')

dataset/ETHPy150Open PaloAltoNetworks/SplunkforPaloAltoNetworks/bin/lib/common.py get_firewall_credentials/original