Module: PWN::Plugins::IPInfo
- Defined in:
- lib/pwn/plugins/ip_info.rb
Overview
This plugin leverages ip-api.com’s REST API to discover information about IP addresses 1,000 daily requests are allowed for free
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
-
0day Inc.
-
.get(opts = {}) ⇒ Object
- Supported Method Parameters
-
ip_info_struc = PWN::Plugins::IPInfo.get( ip_or_host: ‘required - IP or Host to lookup’, proxy: ‘optional - use a proxy’ ).
-
.help ⇒ Object
Display Usage for this Module.
Class Method Details
.authors ⇒ Object
- Author(s)
-
0day Inc. <[email protected]>
80 81 82 83 84 |
# File 'lib/pwn/plugins/ip_info.rb', line 80 public_class_method def self. "AUTHOR(S): 0day Inc. <[email protected]> " end |
.get(opts = {}) ⇒ Object
- Supported Method Parameters
-
ip_info_struc = PWN::Plugins::IPInfo.get(
ip_or_host: 'required - IP or Host to lookup', proxy: 'optional - use a proxy')
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/pwn/plugins/ip_info.rb', line 51 public_class_method def self.get(opts = {}) ip_or_host = opts[:ip_or_host].to_s.scrub.strip.chomp proxy = opts[:proxy] if IPAddress.valid?(ip_or_host) if proxy ip_resp_json = ip_info_rest_call(ip: ip_or_host, proxy: proxy) else ip_resp_json = ip_info_rest_call(ip: ip_or_host) end ip_resp_json else host_resp_json = [] Resolv::DNS.new.each_address(ip_or_host) do |ip| host_resp_json.push(ip_info_rest_call(ip: ip)) end if host_resp_json.length == 1 host_resp_json[0] else host_resp_json end end rescue StandardError => e raise e end |
.help ⇒ Object
Display Usage for this Module
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/pwn/plugins/ip_info.rb', line 88 public_class_method def self.help puts "USAGE: ip_info_struc = #{self}.get( ip_or_host: 'required - IP or Host to lookup', proxy: 'optional - use a proxy' ) #{self}.authors " end |