<?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 Re: Shodan App, Proxy and Query Rate Limit in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Shodan-App-Proxy-and-Query-Rate-Limit/m-p/419790#M51188</link>
    <description>&lt;P&gt;The WA works like a charm and fixes the second issue.&lt;BR /&gt;
I also suggest you to add some detailed documentation about App, to better understand all the functionalities.&lt;/P&gt;

&lt;P&gt;Thank you for quick WA and for this awesome App.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2019 14:52:48 GMT</pubDate>
    <dc:creator>morganfw</dc:creator>
    <dc:date>2019-06-12T14:52:48Z</dc:date>
    <item>
      <title>Shodan App, Proxy and Query Rate Limit</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Shodan-App-Proxy-and-Query-Rate-Limit/m-p/419788#M51186</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I've installed &lt;STRONG&gt;Hurricane Labs App for Shodan v2.0.1&lt;/STRONG&gt;  on &lt;STRONG&gt;Splunk Enterprise v7.2.4&lt;/STRONG&gt; and I've found some issues in App usage and functionality.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;- First Issue&lt;/STRONG&gt;:&lt;BR /&gt;
I need to use a Proxy for exit on Internet, and when I set Proxy globally on OS, I can contact all sites, but Shodan App cannot contact Shodan API through Proxy, App contact Shodan API directly (I've done some tcpdumps to hit the problem).&lt;/P&gt;

&lt;P&gt;After some debugging, I've found the issue and modified line 173 on &lt;STRONG&gt;$SPLUNK_HOME/etc/apps/Hurricane_Labs_App_for_Shodan/bin/shodan/client.py&lt;/STRONG&gt; file that reports&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;def __init__(self, key, proxies=None):
    """Initializes the API object.

    :param key: The Shodan API key.
    :type key: str
    :param proxies: A proxies array for the requests library, e.g. {'https': 'your proxy'}
    :type proxies: dict
    """
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;now I can contact Shodan API through Proxy.&lt;BR /&gt;
&lt;STRONG&gt;&lt;EM&gt;I suggest to make a modification on next App version, and add option to allow the user to modify Proxy Settings through App Web Interface on Splunk&lt;/EM&gt;&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;- Second Issue&lt;/STRONG&gt;:&lt;BR /&gt;
I need to add several subnets starting from &lt;STRONG&gt;/24&lt;/STRONG&gt; ending to &lt;STRONG&gt;/29&lt;/STRONG&gt;, and after adding almost 20 subnets on "Configure Subnets" section, I receive a message that indicate the App cannot sync with Shodan:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;No IPs to use. Add an IP above.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I try to execute manual command to force list refresh:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| getshodan [|inputlookup shodan_my_subnets | stats values(ipAddress) AS ips | eval netlist=mvjoin(ips, ",")  | table netlist] | outputlookup shodan_output
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and after some seconds it answer with Request rate limit reached:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;APIError at "$SPLUNK_HOME/etc/apps/Hurricane_Labs_App_for_Shodan/bin/shodan/client.py", line 255 : Request rate limit reached (1 request/ second). Please wait a second before trying again and slow down your API calls.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that's a problem, because App don't consider Shodan API Request rate limit, and this is a big problem.&lt;BR /&gt;
&lt;STRONG&gt;Also I suggest to modify next App version with Shodan API Requests rate limit&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;Any suggestion for quick resolve with a WA?&lt;BR /&gt;
Regards&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:53:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Shodan-App-Proxy-and-Query-Rate-Limit/m-p/419788#M51186</guid>
      <dc:creator>morganfw</dc:creator>
      <dc:date>2020-09-30T00:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Shodan App, Proxy and Query Rate Limit</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Shodan-App-Proxy-and-Query-Rate-Limit/m-p/419789#M51187</link>
      <description>&lt;P&gt;@morganfw thanks for reaching out. In regards to the second issue: as a potential quick fix you could modify getshodan.py on line 109 and add a time.sleep(1) to pause for 1 second before resuming with the next request.&lt;/P&gt;

&lt;P&gt;So, it would look like:&lt;BR /&gt;
        for net in self.netlist:&lt;BR /&gt;
            time.sleep(1)&lt;BR /&gt;
            query = "net:%s" % net&lt;BR /&gt;
            results += api.search(query)['matches']&lt;/P&gt;

&lt;P&gt;Let us know if that fixes the second issue for you. &lt;/P&gt;

&lt;P&gt;Then we can work on implementing a permanent fix for the next release, as well as addressing the first issue.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Shodan-App-Proxy-and-Query-Rate-Limit/m-p/419789#M51187</guid>
      <dc:creator>hurricanelabs</dc:creator>
      <dc:date>2019-06-12T14:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Shodan App, Proxy and Query Rate Limit</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Shodan-App-Proxy-and-Query-Rate-Limit/m-p/419790#M51188</link>
      <description>&lt;P&gt;The WA works like a charm and fixes the second issue.&lt;BR /&gt;
I also suggest you to add some detailed documentation about App, to better understand all the functionalities.&lt;/P&gt;

&lt;P&gt;Thank you for quick WA and for this awesome App.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 14:52:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Shodan-App-Proxy-and-Query-Rate-Limit/m-p/419790#M51188</guid>
      <dc:creator>morganfw</dc:creator>
      <dc:date>2019-06-12T14:52:48Z</dc:date>
    </item>
  </channel>
</rss>

