Guest User

youhavedownloaded script

a guest
Dec 16th, 2011
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 1.37 KB | None | 0 0
  1.     require 'net/http'
  2.     require 'ipaddr'
  3.    
  4.     BLOCKS = {
  5.       # Ministerio de Cultura
  6.       '193.145.12.0' => '193.145.12.255',#
  7.       '193.145.16.0' => '193.145.16.255',
  8.       '193.145.22.0' => '193.145.22.255',
  9.       '193.145.24.0' => '193.145.24.255',
  10.       '193.145.27.0' => '193.145.27.255',
  11.       '213.4.125.48' => '213.4.125.55',
  12.       '213.4.125.16' => '213.4.125.23',
  13.       '193.145.7.0' => '193.145.7.255',
  14.       # SGAE
  15.       '195.76.238.0' => '195.76.238.255',
  16.       '212.101.75.88' => '212.101.75.95',
  17.       # Moncloa
  18.       '194.179.32.0' => '194.179.32.255',
  19.       '193.146.153.128' => '193.146.153.255',
  20.       # Embajada EEUU
  21.       '212.0.119.168' => '212.0.119.175',
  22.       '213.27.135.224' => '213.27.135.231'
  23.     }
  24.    
  25.     uri = URI.parse('http://www.youhavedownloaded.com/')
  26.     http = Net::HTTP.new(uri.host, uri.port)
  27.  
  28.     BLOCKS.each do |begin_ip, end_ip|
  29.       begin_ip = IPAddr.new(begin_ip)
  30.       end_ip = IPAddr.new(end_ip)
  31.       while begin_ip.to_i <= end_ip.to_i do
  32.         uri.query = 'q=' << begin_ip.to_s
  33.        
  34.         puts begin_ip.to_s
  35.         content = nil
  36.         http.start { content = http.request_get(uri.route_from('http://www.youhavedownloaded.com').to_s).body }
  37.         puts "BINGO!!" if content !~ /this IP in the clear/
  38.        
  39.         begin_ip = IPAddr.new(begin_ip.to_i + 1, Socket::AF_INET)
  40.       end
  41.     end
Add Comment
Please, Sign In to add comment