Class: Shodan::Clients::Scan

Inherits:
Base
  • Object
show all
Defined in:
lib/shodan/clients/scan.rb

Constant Summary

Constants inherited from Base

Base::BASE_URL, Base::HOST

Instance Attribute Summary

Attributes inherited from Base

#key

Instance Method Summary collapse

Methods inherited from Base

#initialize, #key?

Constructor Details

This class inherits a constructor from Shodan::Clients::Base

Instance Method Details

#crawl(*ips) ⇒ Object

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.



15
16
17
# File 'lib/shodan/clients/scan.rb', line 15

def crawl(*ips)
  post("/shodan/scan", ips: ips.join(","))
end

#crawl_for(**params) ⇒ Object

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 [email protected] with information about your project. Access is restricted to prevent abuse.



25
26
27
28
29
# File 'lib/shodan/clients/scan.rb', line 25

def crawl_for(**params)
  params[:query] = ""
  params = turn_into_query(params)
  post("/shodan/scan/internet", params)
end

#get_by_id(id) ⇒ Object

Check the progress of a previously submitted scan request.



32
33
34
# File 'lib/shodan/clients/scan.rb', line 32

def get_by_id(id)
  get("/shodan/scan/#{id}")
end