#!/usr/bin/ruby
require 'open-uri'
File.readlines("/home/bob/avg/tunnels.txt").map do |line|
open "https://admin:pass@192.168.10.10/nph-vpn.cgi?name=#{line}&cmd=status", &:read
end
if tunnel.include? "active"
puts "The tunnel is ACTIVE"
elsif
tunnel.include? "down"
puts "The tunnels is DOWN"
elsif
tunnel.include? "unknown"
puts "The Status of the tunnel is currently UNKNOWN"
else
puts "The Tunnel has reported the status of #{tunnel}"
end
###OUTPUT####
/usr/lib/ruby/1.9.1/uri/common.rb:176:in `split': bad URI(is not URI?): https://admin:pass!@192.168.10.10/nph-vpn.cgi?name=CloudServer (URI::InvalidURIError)
&cmd=status
from /usr/lib/ruby/1.9.1/uri/common.rb:211:in `parse'
from /usr/lib/ruby/1.9.1/uri/common.rb:747:in `parse'
from /usr/lib/ruby/1.9.1/open-uri.rb:32:in `open'
from ./sesw-vpn-1.rb:6:in `block in <main>'
from ./sesw-vpn-1.rb:5:in `map'
from ./sesw-vpn-1.rb:5:in `<main>'