Sha256: 4565946f594dcb7e2eb4eca2f9b0e51dc162679a4d0dba1bab3b6c781023add7
Contents?: true
Size: 1.88 KB
Versions: 1
Compression:
Stored size: 1.88 KB
Contents
class LinksysSRW < Oxidized::Model comment '! ' prompt /^([\r\w.@-]+[#>]\s?)$/ # Graphical login screen # Just login to get to Main Menu expect /Login Screen/ do Oxidized.logger.send(:debug, "#{self.class.name}: Login Screen") # This is to ensure the whole thing have rendered before we send stuff sleep 0.2 send 0x18.chr # CAN Cancel send @node.auth[:username] send "\t" send @node.auth[:password] send "\r" '' end # Main menu, escape into Pre-cli-shell expect /Switch Main Menu/ do Oxidized.logger.send(:debug, "#{self.class.name}: Switch menu") send 0x1a.chr # SUB Substitite ^z '' end # Pre-cli-shell, start lcli which is ios-ish expect />/ do Oxidized.logger.send(:debug, "#{self.class.name}: >") send "lcli\r" '' end cmd :all do |cfg| # Remove \r from first response row cfg.gsub! /^\r/, '' cfg.cut_tail + "\n" end cmd :secret do |cfg| cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>' cfg.gsub! /^(enable (password|secret)( level \d+)? \d) .+/, '\\1 <secret hidden>' end cmd 'show startup-config' do |cfg| # Repair some linewraps which terminal datadump doesn't take care of # and there's no terminal width either. cfg.gsub! /(lldpPortConfigT)\n(LVsTxEnable)/, '\\1\\2' cfg.gsub! /(lldpPortConfigTL)\n(VsTxEnable)/, '\\1\\2' # And comment out the echo of the command "#{comment cfg.lines.first}#{cfg.cut_head}" end cmd 'show version' do |cfg| comment cfg end cmd 'show system' do |cfg| cfg.gsub! /(System Up Time \(days,hour:min:sec\):\s+).*/, '\\1 <uptime removed>' comment cfg end cfg :telnet, :ssh do # Some pre-cli-shell just expects a username, who its going to log in. username /^User Name:/ password /Password:/ post_login 'terminal datadump' pre_logout 'exit' pre_logout 'logout' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oxidized-0.29.0 | lib/oxidized/model/linksyssrw.rb |