Sha256: 4fcf89ca9d664e86fe2c033bd5b3acdf28be056184fddd13c4d302f26968b485

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

# original author: Kent 'picat' Gruber

module Shodan
  module Clients
    class Scan < Base
      # Use this method to request Shodan to crawl a network.
      #
      # This method uses API scan credits: 1 IP consumes 1 scan credit. You
      # must have a paid API plan (either one-time payment or subscription)
      # in order to use this method.
      #
      # IP, IPs or netblocks (in CIDR notation) that should get crawled.
      def crawl(*ips)
        post("/shodan/scan", ips: ips.join(","))
      end

      # Use this method to request Shodan to crawl the Internet for a specific port.
      #
      # This 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.
      def crawl_for(**params)
        params[:query] = ""
        params = turn_into_query(params)
        post("/shodan/scan/internet", params)
      end

      # Check the progress of a previously submitted scan request.
      def get_by_id(id)
        get("/shodan/scan/#{id}")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shodanx-0.2.1 lib/shodan/clients/scan.rb
shodanx-0.2.0 lib/shodan/clients/scan.rb
shodanx-0.1.0 lib/shodan/clients/scan.rb