Created
July 7, 2014 00:38
-
-
Save poppen/b107bc1a898fcf51ec2c to your computer and use it in GitHub Desktop.
clear dns cache script for yamaha routers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
# vim: set filetype=ruby expandtab tabstop=4 shiftwidth=4 autoindent smartindent: | |
require 'net/telnet' | |
require 'yaml' | |
routers = YAML.load_file(ARGV[0]) | |
routers.each do |router| | |
begin | |
telnet = Net::Telnet.new("Host" => router) | |
telnet.waitfor(/Password:/) | |
telnet.puts(ARGV[1]) | |
telnet.waitfor(/>/) | |
telnet.puts("administrator") | |
telnet.waitfor(/Password:/) | |
telnet.puts(ARGV[1]) | |
telnet.waitfor(/#/) | |
telnet.puts("clear dns cache") | |
telnet.close | |
rescue Net::OpenTimeout => e | |
puts router | |
puts e | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment