shodan-ruby icon indicating copy to clipboard operation
shodan-ruby copied to clipboard

502 Bad Gateway when searching for exploits

Open dguido opened this issue 12 years ago • 6 comments

From irb with a fresh install of the shodan gem:

>> api = Shodan::WebAPI.new(SHODAN_API_KEY)
=> #<:webapi:0x10fb4b490 ...>>, @base_url="http://www.shodanhq.com/api/", @exploitdb=#<:exploitdb:0x10fb4b3f0 ...>>, @api_key="xxx", @msf=#<:msf:0x10fb4b3c8 ...>>>
>> api.exploitdb.search('cve-2011-1255')
JSON::ParserError: 757: unexpected token at '

... snipped a bunch of HTML that wouldn't render on GitHub ...

> 

dguido avatar Aug 24 '13 20:08 dguido

The significant portion was: <title>www.shodanhq.com | 502: Bad gateway</title> and the whole error page is in this gist.

As a side note @dguido, html wrapped in triple back ticks ``` would've allowed you to paste it on GitHub (or better yet into a gist).

erran avatar Aug 24 '13 22:08 erran

Ah, yeah I was using pre tags. Thanks for the tip!

dguido avatar Aug 24 '13 22:08 dguido

Are you able to execute a normal search? I'm getting a Net::ReadTimeout exception raised. I can't connect through the URL when used via the browser either. The info function's still working. I'll create a pull request with some error handling for the Shodan gem now. I'll give you a link to install the gem via GitHub (until @achillean releases a new version).

erran avatar Aug 24 '13 22:08 erran

Oh, and if you check out @achillean's twitter account. You'll seen there were some problems going on in the last few days.

erran avatar Aug 24 '13 22:08 erran

Regular search works. ExploitDB and MSF search return 502, with both the Python and Ruby libraries.

dguido avatar Aug 24 '13 22:08 dguido

I rewrote the Exploits search, put it on a separate domain and in the process also normalized the data (so there isn't a need for different classes for ExploitDB and Metasploit). But I didn't yet update the API to make use of the new Exploits website. The new endpoint for the API calls is https://exploits.shodan.io/api and I'm in the process of updating the wrapper classes to use that new URL. Note that the search results now contain the contents of the files, so you don't need to do a separate call anymore to grab/ download the contents of a script.

achillean avatar Aug 25 '13 03:08 achillean