forked from ytti/oxidized
-
Notifications
You must be signed in to change notification settings - Fork 0
/
screenos.rb
44 lines (35 loc) · 892 Bytes
/
screenos.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
38
39
40
41
42
43
44
class ScreenOS < Oxidized::Model
using Refinements
# Netscreen ScreenOS model #
comment '! '
prompt /^[\w.:()-]+->\s?$/
cmd :all do |cfg|
cfg.each_line.to_a[1..-2].join
end
cmd :secret do |cfg|
cfg.gsub! /^(set admin name) .*|^(set admin password) .*/, '\\1 <removed>'
cfg.gsub! /^(set admin user .* password) .* (.*)/, '\\1 <removed> \\2'
cfg.gsub! /(secret|password|preshare) .*/, '\\1 <secret hidden>'
cfg
end
cmd 'get system' do |cfg|
cfg.gsub! /^Date .*\n/, ''
cfg.gsub! /^Up .*\n/, ''
cfg.gsub! /(current bw ).*/, '\\1 <removed>'
comment cfg
end
cmd 'get config' do |cfg|
cfg.each_line.to_a[1..-1].join
end
cfg :telnet do
username '/^login:/'
password '/^password:/'
end
cfg :telnet, :ssh do
post_login 'set console page 0'
pre_logout do
send "exit\n"
send "n"
end
end
end