Skip to content

Instantly share code, notes, and snippets.

@angelf
Created October 7, 2010 16:43
Show Gist options
  • Select an option

  • Save angelf/615429 to your computer and use it in GitHub Desktop.

Select an option

Save angelf/615429 to your computer and use it in GitHub Desktop.
ips = ["192.168.166.142","192.168.166.144", "192.168.166.159", "192.168.166.160", "192.168.166.162", "192.168.166.164", "192.168.166.131", "192.168.166.137", "192.168.166.153", "192.168.166.163", "192.168.166.158"]
etc_hosts_template = '
#
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
%s vlex.com'
ips.each do |ip|
puts ip
File.open("/etc/hosts", "w") {|fh| fh.write(etc_hosts_template % [ip])}
30.times do |i|
puts i
exit if (`curl -i "http://vlex.com/training_center" >& out; grep webrat out`).length > 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment