Sha256: 41dbdf17e51a6acdfc5f5e49f1d4e603954fc94f09e035ff40cc91fea870b736
Contents?: true
Size: 1.34 KB
Versions: 32
Compression:
Stored size: 1.34 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'pwn' 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 )::Request else browser_obj = PWN::Plugins::TransparentBrowser.open(browser_type: :rest)::Request end if proxy public_ip_address = browser_obj.execute( method: :get, url: 'https://checkip.amazonaws.com', verify_ssl: false ).to_s.chomp else public_ip_address = browser_obj.execute( method: :get, url: 'https://checkip.amazonaws.com' ).to_s.chomp end puts "PUBLIC IP: #{public_ip_address}" puts PWN::Plugins::IPInfo.get(ip_or_host: public_ip_address) unless ipinfo.nil? rescue StandardError => e raise e ensure if browser_obj browser_obj = PWN::Plugins::TransparentBrowser.close( browser_obj: browser_obj ) end end
Version data entries
32 entries across 32 versions & 1 rubygems