Sha256: 9b4f373df4ed92489515cf3084593eb0295f93dd7f6f9b210536071d1364e02a
Contents?: true
Size: 1.96 KB
Versions: 1
Compression:
Stored size: 1.96 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('-tIP_HOST', '--target=IP_HOST', '<Optional - IP or Host to Check (Default - Your Public IP)>') do |t| opts[:target] = t end options.on('-PPORT', '--tls-port=PORT', '<Optional - TLS Port to Check (Default - 443). Will not execute if --proxy parameter is set.>') do |p| opts[:tls_port] = p end options.on('-i', '--[no-]ipinfo', '<Optional - Return Details about Public IP Returned from CheckIP>') do |i| opts[:ipinfo] = i end options.on('-pPROXY', '--proxy=PROXY', '<Optional - HTTP or Socks Proxy || tor>') do |p| opts[:proxy] = p end end.parse! target = opts[:target] tls_port = opts[:tls_port] ipinfo = opts[:ipinfo] proxy = opts[:proxy].to_s.scrub.strip.chomp unless opts[:proxy].nil? begin if proxy && opts[:target].nil? browser_obj = PWN::Plugins::TransparentBrowser.open( browser_type: :rest, proxy: proxy ) browser = browser_obj[:browser]::Request target = browser.execute( method: :get, url: 'https://checkip.amazonaws.com', verify_ssl: false ).to_s.chomp elsif opts[:target].nil? browser_obj = PWN::Plugins::TransparentBrowser.open(browser_type: :rest) browser = browser_obj[:browser]::Request target = browser.execute( method: :get, url: 'https://checkip.amazonaws.com' ).to_s.chomp end puts "[ { \"public_ip\": \"#{target}\" } ]" if ipinfo.nil? && opts[:target].nil? ipinfo = true if ipinfo.nil? && opts[:target] if ipinfo ip_info_obj = PWN::Plugins::IPInfo.get( target: target, proxy: proxy, tls_port: tls_port ) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pwn-0.4.909 | bin/pwn_www_checkip |