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

Version Path
pwn-0.4.700 bin/pwn_www_checkip
pwn-0.4.699 bin/pwn_www_checkip
pwn-0.4.698 bin/pwn_www_checkip
pwn-0.4.697 bin/pwn_www_checkip
pwn-0.4.696 bin/pwn_www_checkip
pwn-0.4.695 bin/pwn_www_checkip
pwn-0.4.694 bin/pwn_www_checkip
pwn-0.4.693 bin/pwn_www_checkip
pwn-0.4.692 bin/pwn_www_checkip
pwn-0.4.691 bin/pwn_www_checkip
pwn-0.4.690 bin/pwn_www_checkip
pwn-0.4.689 bin/pwn_www_checkip
pwn-0.4.688 bin/pwn_www_checkip
pwn-0.4.687 bin/pwn_www_checkip
pwn-0.4.686 bin/pwn_www_checkip
pwn-0.4.685 bin/pwn_www_checkip
pwn-0.4.684 bin/pwn_www_checkip
pwn-0.4.683 bin/pwn_www_checkip
pwn-0.4.682 bin/pwn_www_checkip
pwn-0.4.681 bin/pwn_www_checkip