Sha256: 429f4682aeb5527c1087d67bfee88311bb1f6b7ca27b75324044ce894b9e7d20
Contents?: true
Size: 1.46 KB
Versions: 22
Compression:
Stored size: 1.46 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'pwn' require 'json' require 'optparse' opts = {} OptionParser.new do |options| options.banner = "USAGE: #{$PROGRAM_NAME} [opts] " options.on('-pPROXY', '--proxy=PROXY', '<Optional - HTTP or Socks Proxy || tor>') do |p| opts[:proxy] = p end options.on('-i', '--[no-]ipinfo', '<Optional - Return Details about Public IP Returned from CheckIP>') do |i| opts[:ipinfo] = i end end.parse! proxy = opts[:proxy].to_s.scrub.strip.chomp unless opts[:proxy].nil? ipinfo = opts[:ipinfo] begin if proxy browser_obj = PWN::Plugins::TransparentBrowser.open( browser_type: :rest, proxy: proxy ) else browser_obj = PWN::Plugins::TransparentBrowser.open(browser_type: :rest) end browser = browser_obj[:browser]::Request if proxy public_ip_address = browser.execute( method: :get, url: 'https://checkip.amazonaws.com', verify_ssl: false ).to_s.chomp else public_ip_address = browser.execute( method: :get, url: 'https://checkip.amazonaws.com' ).to_s.chomp end puts "PUBLIC IP: #{public_ip_address}" unless ipinfo if ipinfo ip_info_obj = PWN::Plugins::IPInfo.get( target: public_ip_address, proxy: proxy ) puts JSON.pretty_generate(ip_info_obj) end rescue StandardError => e raise e ensure if browser_obj browser_obj = PWN::Plugins::TransparentBrowser.close( browser_obj: browser_obj ) end end
Version data entries
22 entries across 22 versions & 1 rubygems