Skip to content

Instantly share code, notes, and snippets.

@karuna
Forked from masaki925/local_proxy.rb
Created December 11, 2016 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karuna/9295e8cf7aa46d9f6409c68f37fe584d to your computer and use it in GitHub Desktop.
Save karuna/9295e8cf7aa46d9f6409c68f37fe584d to your computer and use it in GitHub Desktop.
require "net/http"
require "uri"
proxy_addr = "localhost"
proxy_port = 3128
uri = URI.parse "http://www.ugtop.com/spill.shtml"
Net::HTTP.new(uri.host, uri.port, proxy_addr, proxy_port).start do |http|
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
puts response.body.scan(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment