public
Last active

  • Download Gist
googlitch_street_view_proxy.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/usr/bin/env ruby
 
require 'webrick'
require 'webrick/httpproxy'
 
handler = Proc.new() do |req,res|
if (req.path == '/glm/mmap' and res['content-type'] =~ /binary/) ||
(req.host =~ /^cbk\d+\.google/ and res['content-type'] =~ /jpeg/)
res.body.gsub!(/0/m, rand(10).to_s)
res['cache-control'] = 'no-cache'
end
end
 
s = WEBrick::HTTPProxyServer.new(
:BindAddress => '0.0.0.0',
:Port => 8080,
:ProxyContentHandler => handler
)
 
Signal.trap('INT') do
s.shutdown
end
 
s.start

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.