diff options
author | Mike Bryant <mike@mikebryant.me.uk> | 2016-01-28 00:01:21 +0000 |
---|---|---|
committer | Mike Bryant <mike@mikebryant.me.uk> | 2016-01-28 00:01:21 +0000 |
commit | 135a9123b493ea896b0719395fd1bbfdc628ffe2 (patch) | |
tree | dc2db09db54e71a0a5fab020050d83e45c166475 /lib/oxidized/model/aosw.rb | |
parent | f4483bfd63be3d74f42e027cfbb2a8929ebc9ac1 (diff) |
Enable secret handling for AOSW
Diffstat (limited to 'lib/oxidized/model/aosw.rb')
-rw-r--r-- | lib/oxidized/model/aosw.rb | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/oxidized/model/aosw.rb b/lib/oxidized/model/aosw.rb index 5135115..4f09e51 100644 --- a/lib/oxidized/model/aosw.rb +++ b/lib/oxidized/model/aosw.rb @@ -11,6 +11,20 @@ class AOSW < Oxidized::Model cfg.each_line.to_a[1..-2].join end + cmd :secret do |cfg| + cfg.gsub!(/PRE-SHARE (\S+)$/, 'PRE-SHARE <secret removed>') + cfg.gsub!(/ipsec (\S+)$/, 'ipsec <secret removed>') + cfg.gsub!(/community (\S+)$/, 'community <secret removed>') + cfg.gsub!(/ sha (\S+)/, ' sha <secret removed>') + cfg.gsub!(/ des (\S+)/, ' des <secret removed>') + cfg.gsub!(/mobility-manager (\S+) user (\S+) (\S+)/, 'mobility-manager \1 user \2 <secret removed>') + cfg.gsub!(/mgmt-user (\S+) (\S+) (\S+)$/, 'mgmt-user \1 \2 <secret removed>') + cfg.gsub!(/key (\S+)$/, 'key <secret removed>') + cfg.gsub!(/secret (\S+)$/, 'secret <secret removed>') + cfg.gsub!(/wpa-passphrase (\S+)$/, 'wpa-passphrase <secret removed>') + cfg + end + cmd 'show version' do |cfg| cfg = cfg.each_line.select { |line| not line.match /Switch uptime/i } comment cfg.join @@ -26,8 +40,15 @@ class AOSW < Oxidized::Model cmd 'show license' do |cfg| comment cfg end - cmd 'show configuration' do |cfg| - cfg + cmd 'show running-config' do |cfg| + out = [] + cfg.each_line do |line| + next if line.match /^controller config \d+$/ + next if line.match /^Building Configuration/ + out << line.strip + end + out = out.join "\n" + out << "\n" end cfg :telnet do @@ -43,6 +64,7 @@ class AOSW < Oxidized::Model end end post_login 'no paging' + post_login 'encrypt disable' if vars :enable pre_logout 'exit' end |