Skip to content

Instantly share code, notes, and snippets.

@nuke99
Created May 1, 2012 20:28
Show Gist options
  • Save nuke99/2571114 to your computer and use it in GitHub Desktop.
Save nuke99/2571114 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'net/http'
module Request
def req_get(url)
uri = URI(url)
Net::HTTP.start(uri.host, uri.port) do |http|
request = Net::HTTP::Get.new uri.request_uri
response = http.request request # Net::HTTPResponse object
return response
end
end
end
include Request
more = "+and+1=1--"
result = req_get("http://192.168.1.101/S/?id=1"+more)
puts result.body
result.gsub!(more,'')
puts result.body
# John<br />1 and 1=1--
# test.rb:21: private method `gsub!' called for #<Net::HTTPOK 200 OK readbody=true> (NoMethodError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment