forked from ytti/oxidized
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvyatta.rb
37 lines (29 loc) · 942 Bytes
/
vyatta.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class Vyatta < Oxidized::Model
using Refinements
# Brocade Vyatta / VyOS model #
prompt /@.*(:~\$|>)\s/
cmd :all do |cfg|
cfg.lines.to_a[1..-2].join
end
cmd :secret do |cfg|
cfg.gsub! /encrypted-password (\S+).*/, 'encrypted-password <secret removed>'
cfg.gsub! /plaintext-password (\S+).*/, 'plaintext-password <secret removed>'
cfg.gsub! /password (\S+).*/, 'password <secret removed>'
cfg.gsub! /pre-shared-secret (\S+).*/, 'pre-shared-secret <secret removed>'
cfg.gsub! /community (\S+)/, 'community <hidden>'
cfg.gsub! /private-key (\S+).*/, 'private-key <secret removed>'
cfg.gsub! /preshared-key (\S+).*/, 'preshared-key <secret removed>'
cfg
end
cmd 'show version' do |cfg|
comment cfg
end
cmd 'show configuration commands | no-more'
cfg :telnet do
username /login:\s/
password /^Password:\s/
end
cfg :telnet, :ssh do
pre_logout 'exit'
end
end