<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to retrieve session without passing hardcoded credentials in python script in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/327373#M39209</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;i have used,&lt;BR /&gt;
sessionKey = splunk.auth.getSessionKey(username,password)&lt;BR /&gt;
credentials = getCredentials(sessionKey)&lt;BR /&gt;
 to get the credentials where i have passed hardcoded crentials in splunk.auth.&lt;/P&gt;

&lt;P&gt;but i have to get credentials without passing the hardcoded credentials i have been tried doing&lt;/P&gt;

&lt;P&gt;results,dummyresults,settings = splunk.Intersplunk.getOrganizedResults()&lt;BR /&gt;
session_key = str(settings.get('sessionKey'))&lt;/P&gt;

&lt;P&gt;unable to get the session can anybody help me in figuring out the issue.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Mar 2018 07:27:08 GMT</pubDate>
    <dc:creator>Inayath_khan</dc:creator>
    <dc:date>2018-03-02T07:27:08Z</dc:date>
    <item>
      <title>How to retrieve session without passing hardcoded credentials in python script</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/327373#M39209</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;i have used,&lt;BR /&gt;
sessionKey = splunk.auth.getSessionKey(username,password)&lt;BR /&gt;
credentials = getCredentials(sessionKey)&lt;BR /&gt;
 to get the credentials where i have passed hardcoded crentials in splunk.auth.&lt;/P&gt;

&lt;P&gt;but i have to get credentials without passing the hardcoded credentials i have been tried doing&lt;/P&gt;

&lt;P&gt;results,dummyresults,settings = splunk.Intersplunk.getOrganizedResults()&lt;BR /&gt;
session_key = str(settings.get('sessionKey'))&lt;/P&gt;

&lt;P&gt;unable to get the session can anybody help me in figuring out the issue.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 07:27:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/327373#M39209</guid>
      <dc:creator>Inayath_khan</dc:creator>
      <dc:date>2018-03-02T07:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve session without passing hardcoded credentials in python script</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/327374#M39210</link>
      <description>&lt;P&gt;Depending on how you are executing the script. If it's triggered from within Splunk maybe something in here will help you. &lt;A href="http://www.georgestarcher.com/splunk-stored-encrypted-credentials/"&gt;http://www.georgestarcher.com/splunk-stored-encrypted-credentials/&lt;/A&gt;  If it's triggered from within Splunk such as an alert action, input etc you can get the active session key of the user that triggered the action.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Mar 2018 15:18:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/327374#M39210</guid>
      <dc:creator>starcher</dc:creator>
      <dc:date>2018-03-04T15:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve session without passing hardcoded credentials in python script</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/327375#M39211</link>
      <description>&lt;P&gt;Thanks for the  reply  starcher,&lt;/P&gt;

&lt;P&gt;I have executed below python script.. &lt;/P&gt;

&lt;P&gt;import sys, json&lt;BR /&gt;
import splunk.Intersplunk&lt;BR /&gt;
import splunklib.client as client&lt;/P&gt;

&lt;P&gt;results,dummyresults,settings = splunk.Intersplunk.getOrganizedResults()&lt;/P&gt;

&lt;P&gt;session_key = str(settings.get('sessionKey'))&lt;BR /&gt;
splunkService = client.connect(token=session_key)&lt;BR /&gt;
print session_key&lt;BR /&gt;
~&lt;/P&gt;

&lt;P&gt;I have tried this to get the session key ...whether import splunk.Intersplunk works with splunk 7.0.1 version .. I have been tried executing this ..i didn't get output it's getting strucked at the point splunk.Intersplunk.getOrganizedResults(). And iam not using any splunk-python-SDK libraries to do this task.&lt;/P&gt;

&lt;P&gt;Could please tell me is any other way of doing it.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:18:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/327375#M39211</guid>
      <dc:creator>Inayath_khan</dc:creator>
      <dc:date>2020-09-29T18:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve session without passing hardcoded credentials in python script</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/327376#M39212</link>
      <description>&lt;P&gt;I have executed below python script..&lt;/P&gt;

&lt;P&gt;import sys, json&lt;BR /&gt;
import splunk.Intersplunk&lt;BR /&gt;
import splunklib.client as client&lt;/P&gt;

&lt;P&gt;results,dummyresults,settings = splunk.Intersplunk.getOrganizedResults()&lt;/P&gt;

&lt;P&gt;session_key = str(settings.get('sessionKey'))&lt;BR /&gt;
splunkService = client.connect(token=session_key)&lt;BR /&gt;
print session_key&lt;BR /&gt;
~&lt;/P&gt;

&lt;P&gt;I have tried this to get the session key.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:18:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/327376#M39212</guid>
      <dc:creator>Inayath_khan</dc:creator>
      <dc:date>2020-09-29T18:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve session without passing hardcoded credentials in python script</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/529125#M64168</link>
      <description>&lt;P&gt;I'm also working on getting this right. My script was also getting stuck at&lt;SPAN&gt;&amp;nbsp;splunk.Intersplunk.getOrganizedResults(). The reason was that the search command I was calling the script from was not generating any results, and I believe&amp;nbsp;getOrganizedResults() was waiting for results to be generated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I fixed this by adding a generating command (&lt;/SPAN&gt;&lt;SPAN&gt;GeneratingCommand) into my script before&amp;nbsp;&lt;SPAN&gt;getOrganizedResults().&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 11:13:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-retrieve-session-without-passing-hardcoded-credentials-in/m-p/529125#M64168</guid>
      <dc:creator>BernardEAI</dc:creator>
      <dc:date>2020-11-12T11:13:49Z</dc:date>
    </item>
  </channel>
</rss>

