From 38151b82d2df294bdfcb2876120d0ca23462dca3 Mon Sep 17 00:00:00 2001 From: boudreau Date: Tue, 14 Feb 2017 10:18:35 -0500 Subject: Update opengear.rb With new update : OpenGear/CM71xx Version 3.16.6u1 e02e2d59 -- Mon Nov 14 17:44:05 EST 2016 the backup wasn't working anymore, needed a prompt --- lib/oxidized/model/opengear.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/oxidized/model') diff --git a/lib/oxidized/model/opengear.rb b/lib/oxidized/model/opengear.rb index 7f801f8..b7c697f 100644 --- a/lib/oxidized/model/opengear.rb +++ b/lib/oxidized/model/opengear.rb @@ -1,6 +1,8 @@ class OpenGear < Oxidized::Model comment '# ' + + prompt /^(\$\s)?$/ cmd :secret do |cfg| cfg.gsub!(/password (\S+)/, 'password ') -- cgit v1.2.1 From 4a6a7a98a4101320c429235d15f637e370f0ce94 Mon Sep 17 00:00:00 2001 From: Tim Pozar Date: Tue, 14 Feb 2017 17:57:06 -0800 Subject: Updated timos.rb to ignore "Generated" and "Finished" lines so it doesn't look like a new config each time to crawls the box. --- lib/oxidized/model/timos.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/oxidized/model') diff --git a/lib/oxidized/model/timos.rb b/lib/oxidized/model/timos.rb index d40e845..c230a8f 100644 --- a/lib/oxidized/model/timos.rb +++ b/lib/oxidized/model/timos.rb @@ -18,6 +18,8 @@ class TiMOS < Oxidized::Model # Show the boot options file. # cmd 'show bof' do |cfg| + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' comment cfg end @@ -29,6 +31,8 @@ class TiMOS < Oxidized::Model # Strip uptime. # cfg.sub! /^System Up Time.*\n/, '' + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' comment cfg end @@ -36,6 +40,8 @@ class TiMOS < Oxidized::Model # Show the card state. # cmd 'show card state' do |cfg| + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' comment cfg end @@ -48,6 +54,8 @@ class TiMOS < Oxidized::Model # cfg.gsub! /\r/, '' cfg.gsub! /[\b][\b][\b]/, "\n" + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' comment cfg end @@ -55,6 +63,8 @@ class TiMOS < Oxidized::Model # Show the running debug configuration. # cmd 'show debug' do |cfg| + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' comment cfg end @@ -66,6 +76,8 @@ class TiMOS < Oxidized::Model # Strip carriage returns. # cfg.gsub! /\r/, '' + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' comment cfg end @@ -77,6 +89,8 @@ class TiMOS < Oxidized::Model # Strip carriage returns. # cfg.gsub! /\r/, '' + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' comment cfg end @@ -88,6 +102,8 @@ class TiMOS < Oxidized::Model # Strip carriage returns. # cfg.gsub! /\r/, '' + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' end cfg :telnet do -- cgit v1.2.1 From c89503a8b2c53d9ee2a1fc8020ecc5fba600a891 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Feb 2017 09:08:08 +0100 Subject: added psk and private-key removal to secret section --- lib/oxidized/model/fortios.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/oxidized/model') diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index cdb50d5..3cfd102 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -15,7 +15,8 @@ class FortiOS < Oxidized::Model end cmd :secret do |cfg| - cfg.gsub! /(set (?:passwd|password)).*/, '\\1 ' + cfg.gsub! /(set (?:passwd|password|psksecret)).*/, '\\1 ' + cfg.gsub! /(set private-key).*-+END ENCRYPTED PRIVATE KEY-*"$/m , '\\1 ' cfg end -- cgit v1.2.1 From 98c7fc45c983b9e424e32bc2f426e395e1ec98bc Mon Sep 17 00:00:00 2001 From: root Date: Tue, 7 Feb 2017 16:38:47 +0100 Subject: added tplink model --- lib/oxidized/model/tplink.rb | 65 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 lib/oxidized/model/tplink.rb (limited to 'lib/oxidized/model') diff --git a/lib/oxidized/model/tplink.rb b/lib/oxidized/model/tplink.rb new file mode 100644 index 0000000..9286ea4 --- /dev/null +++ b/lib/oxidized/model/tplink.rb @@ -0,0 +1,65 @@ +class TPLink < Oxidized::Model + + # tp-link prompt + prompt /^\r?([\w.@()-]+[#>]\s?)$/ + comment '! ' + + # handle paging + # workaround for sometimes missing whitespaces with "\s?" + expect /Press\s?any\s?key\s?to\s?continue\s?\(Q\s?to\s?quit\)/ do |data, re| + send ' ' + data.sub re, '' + end + + # send carriage return because \n with the command is not enough + # checks if line ends with prompt >,# or \r,\nm otherwise send \r + expect /[^>#\r\n]$/ do |data, re| + send "\r" + data.sub re, '' + end + + cmd :all do |cfg| + # normalize linefeeds + cfg.gsub! /(\r|\r\n|\n\r)/,"\n" + # remove empty lines + cfg.each_line.reject { |line| line.match /^[\r\n\s\u0000#]+$/ }.join + end + + cmd :secret do |cfg| + cfg.gsub! /^(snmp-server community).*/, '\\1 ' + cfg.gsub! /secret (\d+) (\S+).*/, '