{"id":15323316,"url":"https://github.com/krishpranav/rbshodan","last_synced_at":"2025-03-27T18:17:16.525Z","repository":{"id":109907983,"uuid":"380241406","full_name":"krishpranav/rbshodan","owner":"krishpranav","description":"A shodan library written in ruby","archived":false,"fork":false,"pushed_at":"2021-06-26T04:15:16.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T13:46:29.138Z","etag":null,"topics":["ruby","ruby-gem","ruby-library","shodan","shodan-client"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krishpranav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-25T13:08:47.000Z","updated_at":"2021-06-26T04:15:18.000Z","dependencies_parsed_at":"2023-03-21T09:17:37.976Z","dependency_job_id":null,"html_url":"https://github.com/krishpranav/rbshodan","commit_stats":{"total_commits":79,"total_committers":2,"mean_commits":39.5,"dds":0.03797468354430378,"last_synced_commit":"aded8d67f7597947effe7ae8d5e9ab4755a2e160"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishpranav%2Frbshodan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishpranav%2Frbshodan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishpranav%2Frbshodan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krishpranav%2Frbshodan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krishpranav","download_url":"https://codeload.github.com/krishpranav/rbshodan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245898331,"owners_count":20690466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby","ruby-gem","ruby-library","shodan","shodan-client"],"created_at":"2024-10-01T09:19:32.431Z","updated_at":"2025-03-27T18:17:16.509Z","avatar_url":"https://github.com/krishpranav.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rbshodan\nA shodan library written in ruby\n\n[![forthebadge](https://forthebadge.com/images/badges/made-with-ruby.svg)](https://forthebadge.com)\n\n# Installation\n```\n$ gem install rbshodan\n```\n\n# Usage\n```ruby\nrequire \"rbshodan\"\n\nclient = rbshodan.client.new(key: \"YOUR_API_KEY\")\n```\n\n- shodan search methods\n\n- host search\n```ruby\nclient.host_search(\"mongodb\")\nclient.host_search(\"nginx\")\nclient.host_search(\"apache\", after: \"1/12/16\")\nclient.host_search(\"ssh\", port: 22, page: 1)\nclient.host_search(\"ssh\", port: 22, page: 2)\nclient.host_search(\"ftp\", port: 21, facets: { link: \"Ethernet or modem\" })\n````\n\n#### Host Information\n\nReturns all services that have been found on the given host IP.\n\n```ruby\nclient.host(\"0.0.0.0\")                \nclient.host(\"0.0.0.0\", history: true) \nclient.host(\"0.0.0.0\", minify: true)  \n```\n\n#### Host Search\n\nSearch Shodan using the same query syntax as the website and use facets to get summary information for different properties.\n\n```ruby\nclient.host_search(\"mongodb\")\nclient.host_search(\"nginx\")\nclient.host_search(\"apache\", after: \"1/12/16\")\nclient.host_search(\"ssh\", port: 22, page: 1)\nclient.host_search(\"ssh\", port: 22, page: 2)\nclient.host_search(\"ftp\", port: 21, facets: { link: \"Ethernet or modem\" })\n```\n\n#### Scan Targets\n\nUse this method to request Shodan to crawl an IP or netblock.\n\n```ruby\nclient.scan(\"0.0.0.0\")\n```\n\n#### Crawl Internet for Port\n\nUse this method to request Shodan to crawl the Internet for a specific port.\n\nThis method is restricted to security researchers and companies with a Shodan Data license. To apply for access to this method as a researcher, please email `jmath@shodan.io` with information about your project. Access is restricted to prevent abuse.\n\n```ruby\nclient.crawl_for(port: 80, protocol: \"http\")\n```\n\n#### List Community Queries\n\nUse this method to obtain a list of search queries that users have saved in Shodan.\n\n```ruby\nclient.community_queries\nclient.community_queries(page: 2)\nclient.community_queries(sort: \"votes\")\nclient.community_queries(sort: \"votes\", page: 2)\nclient.community_queries(order: \"asc\")\nclient.community_queries(order: \"desc\")\n```\n\n#### DNS Lookup\n\nLook up the IP address for the provided list of hostnames.\n\n```ruby\nclient.resolve(\"google.com\")\nclient.resolve(\"google.com\", \"bing.com\")\n```\n\n#### Reverse DNS Lookup\n\nLook up the hostnames that have been defined for the given list of IP addresses.\n\n```ruby\nclient.reverse_lookup(\"74.125.227.230\")\nclient.reverse_lookup(\"74.125.227.230\", \"204.79.197.200\")\n```\n\n#### HTTP Headers\n\nShows the HTTP headers that your client sends when connecting to a webserver.\n\n```ruby\nclient.http_headers\n```\n\n#### Your IP Address\n\nGet your current IP address as seen from the Internet.\n\n```ruby\nclient.my_ip\n```\n\n#### Honeypot Score\n\nCalculates a honeypot probability score ranging from 0 (not a honeypot) to 1.0 (is a honeypot).\n\n```ruby\nclient.honeypot_score('0.0.0.0')\n```\n\n#### Banners Filtered by ASN\n\nThis stream provides a filtered, bandwidth-saving view of the Banners stream in case you are only interested in devices located in certain ASNs.\n\n```ruby\nclient.banners_within_asns(3303, 32475) do |data|\n  # do something with banner data\n  puts data\nend\n```\n\n#### Banners Filtered by Country\n\nThis stream provides a filtered, bandwidth-saving view of the Banners stream in case you are only interested in devices located in certain countries.\n\n```ruby\nclient.banners_within_countries(\"DE\", \"US\", \"JP\") do |data|\n  # do something with banner data\n  puts data\nend\n```\n\n#### Banners Filtered by Ports\n\nOnly returns banner data for the list of specified ports. This stream provides a filtered, bandwidth-saving view of the Banners stream in case you are only interested in a specific list of ports.\n\n```ruby\nclient.banners_on_ports(21, 22, 80) do |data|\n  # do something with banner data\n  puts data\nend\n```\n\n#### Banners by Network Alerts\n\nSubscribe to banners discovered on all IP ranges described in the network alerts.\n\n```ruby\nclient.alerts do |data|\n  # do something with banner data\n  puts data\nend\n```\n\n#### Banner Filtered by Alert ID\n\nSubscribe to banners discovered on the IP range defined in a specific network alert.\n\n```ruby\nclient.alert(\"HKVGAIRWD79Z7W2T\") do |data|\n  # do something with banner data\n  puts data\nend\n```\n\n# Exploits\n\n#### Search\n\nSearch across a variety of data sources for exploits and use facets to get summary information.\n\n```ruby\nclient.exploits_api.search(\"python\")             # Search for python vulns.\nclient.exploits_api.search(port: 22)             # Port number for the affected service if the exploit is remote.\nclient.exploits_api.search(type: \"shellcode\")    # A category of exploit to search for.\nclient.exploits_api.search(osvdb: \"100007\")      # Open Source Vulnerability Database ID for the exploit.\n```\n\n#### Count\n\nThis method behaves identical to the Exploits API `search` method with the difference that it doesn't return any results.\n\n```ruby\nclient.exploits_api.count(\"python\")             # Count python vulns.\nclient.exploits_api.count(port: 22)             # Port number for the affected service if the exploit is remote.\nclient.exploits_api.count(type: \"shellcode\")    # A category of exploit to search for.\nclient.exploits_api.count(osvdb: \"100007\")      # Open Source Vulnerability Database ID for the exploit.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrishpranav%2Frbshodan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrishpranav%2Frbshodan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrishpranav%2Frbshodan/lists"}