oxidized 0.24.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +4 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +26 -2
- data/Dockerfile +8 -32
- data/README.md +17 -5
- data/bin/oxidized +1 -1
- data/docs/Configuration.md +41 -3
- data/docs/Hooks.md +26 -0
- data/docs/Model-Notes/AireOS.md +1 -2
- data/docs/Model-Notes/ArbOS.md +1 -2
- data/docs/Model-Notes/Comware.md +1 -2
- data/docs/Model-Notes/EOS.md +1 -2
- data/docs/Model-Notes/JunOS.md +1 -2
- data/docs/Model-Notes/Netgear.md +5 -6
- data/docs/Model-Notes/Nokia.md +9 -0
- data/docs/Model-Notes/README.md +3 -2
- data/docs/Model-Notes/VRP-Huawei.md +1 -2
- data/docs/Model-Notes/Viptela.md +12 -0
- data/docs/Model-Notes/XGS4600-Zyxel.md +1 -2
- data/docs/Ruby-API.md +54 -2
- data/docs/Supported-OS-Types.md +12 -0
- data/extra/oxidized.service +7 -0
- data/lib/oxidized/cli.rb +7 -0
- data/lib/oxidized/config.rb +3 -0
- data/lib/oxidized/core.rb +1 -0
- data/lib/oxidized/hook/ciscosparkdiff.rb +11 -17
- data/lib/oxidized/hook/slackdiff.rb +5 -11
- data/lib/oxidized/hook/xmppdiff.rb +1 -0
- data/lib/oxidized/input/ssh.rb +43 -27
- data/lib/oxidized/input/telnet.rb +1 -0
- data/lib/oxidized/model/acos.rb +2 -2
- data/lib/oxidized/model/acsw.rb +6 -6
- data/lib/oxidized/model/adtran.rb +22 -0
- data/lib/oxidized/model/aen.rb +2 -2
- data/lib/oxidized/model/aireos.rb +3 -2
- data/lib/oxidized/model/alteonos.rb +2 -2
- data/lib/oxidized/model/aos.rb +1 -1
- data/lib/oxidized/model/aos7.rb +1 -1
- data/lib/oxidized/model/aosw.rb +5 -3
- data/lib/oxidized/model/apc_aos.rb +1 -1
- data/lib/oxidized/model/arbos.rb +2 -2
- data/lib/oxidized/model/asa.rb +8 -2
- data/lib/oxidized/model/awplus.rb +1 -1
- data/lib/oxidized/model/axos.rb +16 -0
- data/lib/oxidized/model/c4cmts.rb +3 -5
- data/lib/oxidized/model/casa.rb +1 -1
- data/lib/oxidized/model/catos.rb +1 -1
- data/lib/oxidized/model/ciscosma.rb +1 -1
- data/lib/oxidized/model/ciscosmb.rb +10 -4
- data/lib/oxidized/model/comtrol.rb +41 -0
- data/lib/oxidized/model/comware.rb +1 -1
- data/lib/oxidized/model/coriantgroove.rb +4 -6
- data/lib/oxidized/model/cumulus.rb +14 -1
- data/lib/oxidized/model/datacom.rb +1 -2
- data/lib/oxidized/model/dcnos.rb +1 -1
- data/lib/oxidized/model/dellx.rb +76 -0
- data/lib/oxidized/model/dlink.rb +2 -2
- data/lib/oxidized/model/dnos.rb +3 -1
- data/lib/oxidized/model/eciapollo.rb +34 -0
- data/lib/oxidized/model/edgecos.rb +1 -0
- data/lib/oxidized/model/edgeos.rb +6 -1
- data/lib/oxidized/model/eos.rb +3 -2
- data/lib/oxidized/model/fiberdriver.rb +1 -1
- data/lib/oxidized/model/firebrick.rb +31 -0
- data/lib/oxidized/model/firewareos.rb +1 -1
- data/lib/oxidized/model/fortios.rb +5 -4
- data/lib/oxidized/model/ftos.rb +4 -1
- data/lib/oxidized/model/fujitsupy.rb +3 -3
- data/lib/oxidized/model/gaiaos.rb +1 -1
- data/lib/oxidized/model/gcombnps.rb +3 -1
- data/lib/oxidized/model/hatteras.rb +1 -1
- data/lib/oxidized/model/hirschmann.rb +2 -2
- data/lib/oxidized/model/hpebladesystem.rb +1 -1
- data/lib/oxidized/model/ios.rb +21 -13
- data/lib/oxidized/model/ipos.rb +3 -3
- data/lib/oxidized/model/ironware.rb +3 -3
- data/lib/oxidized/model/isam.rb +1 -1
- data/lib/oxidized/model/junos.rb +1 -1
- data/lib/oxidized/model/masteros.rb +2 -3
- data/lib/oxidized/model/mlnxos.rb +5 -5
- data/lib/oxidized/model/model.rb +3 -0
- data/lib/oxidized/model/ndms.rb +1 -2
- data/lib/oxidized/model/netgear.rb +7 -9
- data/lib/oxidized/model/netonix.rb +1 -1
- data/lib/oxidized/model/netscaler.rb +6 -1
- data/lib/oxidized/model/nos.rb +2 -2
- data/lib/oxidized/model/oneos.rb +1 -1
- data/lib/oxidized/model/openbsd.rb +8 -22
- data/lib/oxidized/model/openwrt.rb +1 -0
- data/lib/oxidized/model/opnsense.rb +1 -1
- data/lib/oxidized/model/panos.rb +9 -9
- data/lib/oxidized/model/pfsense.rb +2 -1
- data/lib/oxidized/model/planet.rb +1 -1
- data/lib/oxidized/model/powerconnect.rb +7 -4
- data/lib/oxidized/model/procurve.rb +7 -5
- data/lib/oxidized/model/routeros.rb +1 -1
- data/lib/oxidized/model/saos.rb +1 -1
- data/lib/oxidized/model/screenos.rb +3 -3
- data/lib/oxidized/model/sros.rb +2 -2
- data/lib/oxidized/model/stoneos.rb +1 -1
- data/lib/oxidized/model/tmos.rb +2 -0
- data/lib/oxidized/model/tplink.rb +4 -0
- data/lib/oxidized/model/viptela.rb +29 -0
- data/lib/oxidized/model/voltaire.rb +5 -5
- data/lib/oxidized/model/voss.rb +4 -4
- data/lib/oxidized/model/vrp.rb +1 -1
- data/lib/oxidized/model/vyatta.rb +1 -1
- data/lib/oxidized/model/weos.rb +1 -1
- data/lib/oxidized/model/xos.rb +9 -2
- data/lib/oxidized/node.rb +20 -31
- data/lib/oxidized/nodes.rb +3 -0
- data/lib/oxidized/output/git.rb +17 -20
- data/lib/oxidized/output/gitcrypt.rb +2 -1
- data/lib/oxidized/output/http.rb +19 -12
- data/lib/oxidized/source/csv.rb +15 -8
- data/lib/oxidized/source/http.rb +26 -22
- data/lib/oxidized/string.rb +9 -4
- data/lib/oxidized/version.rb +2 -2
- data/lib/oxidized/worker.rb +44 -36
- data/oxidized.gemspec +1 -4
- metadata +26 -16
data/lib/oxidized/model/model.rb
CHANGED
@@ -17,6 +17,7 @@ module Oxidized
|
|
17
17
|
|
18
18
|
def comment _comment = '# '
|
19
19
|
return @comment if @comment
|
20
|
+
|
20
21
|
@comment = block_given? ? yield : _comment
|
21
22
|
end
|
22
23
|
|
@@ -102,6 +103,7 @@ module Oxidized
|
|
102
103
|
Oxidized.logger.debug "lib/oxidized/model/model.rb Executing #{string}"
|
103
104
|
out = @input.cmd(string)
|
104
105
|
return false unless out
|
106
|
+
|
105
107
|
out = out.b unless Oxidized.config.input.utf8_encoded?
|
106
108
|
self.class.cmds[:all].each do |all_block|
|
107
109
|
out = instance_exec Oxidized::String.new(out), string, &all_block
|
@@ -155,6 +157,7 @@ module Oxidized
|
|
155
157
|
self.class.cmds[:cmd].each do |command, block|
|
156
158
|
out = cmd command, &block
|
157
159
|
return false unless out
|
160
|
+
|
158
161
|
outputs << out
|
159
162
|
end
|
160
163
|
procs[:pre].each do |pre_proc|
|
data/lib/oxidized/model/ndms.rb
CHANGED
@@ -11,8 +11,7 @@ class NDMS < Oxidized::Model
|
|
11
11
|
end
|
12
12
|
|
13
13
|
cmd 'show running-config' do |cfg|
|
14
|
-
cfg = cfg.each_line.
|
15
|
-
cfg = cfg.reject { |line| line.match /(clock date|checksum)/ }.join
|
14
|
+
cfg = cfg.cut_both.each_line.reject { |line| line.match /(clock date|checksum)/ }.join
|
16
15
|
cfg
|
17
16
|
end
|
18
17
|
|
@@ -10,18 +10,16 @@ class Netgear < Oxidized::Model
|
|
10
10
|
|
11
11
|
cfg :telnet do
|
12
12
|
username /^(User:|Applying Interface configuration, please wait ...)/
|
13
|
+
password /^Password:/i
|
13
14
|
end
|
14
15
|
|
15
16
|
cfg :telnet, :ssh do
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
send vars(:enable) + "\n"
|
23
|
-
end
|
24
|
-
expect /^.+[#]$/
|
17
|
+
post_login do
|
18
|
+
if vars(:enable) == true
|
19
|
+
cmd "enable"
|
20
|
+
elsif vars(:enable)
|
21
|
+
cmd "enable", /[pP]assword:\s?$/
|
22
|
+
cmd vars(:enable)
|
25
23
|
end
|
26
24
|
end
|
27
25
|
post_login 'terminal length 0'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class NetScaler < Oxidized::Model
|
2
|
-
prompt
|
2
|
+
prompt /^>\s*$/
|
3
3
|
comment '# '
|
4
4
|
|
5
5
|
cmd :all do |cfg|
|
@@ -14,6 +14,11 @@ class NetScaler < Oxidized::Model
|
|
14
14
|
comment cfg
|
15
15
|
end
|
16
16
|
|
17
|
+
cmd :secret do |cfg|
|
18
|
+
cfg.gsub! /\w+\s(-encrypted)/, '<secret hidden> \\1'
|
19
|
+
cfg
|
20
|
+
end
|
21
|
+
|
17
22
|
cmd 'show ns ns.conf'
|
18
23
|
|
19
24
|
cfg :ssh do
|
data/lib/oxidized/model/nos.rb
CHANGED
@@ -5,11 +5,11 @@ class NOS < Oxidized::Model
|
|
5
5
|
comment '! '
|
6
6
|
|
7
7
|
cmd :all do |cfg|
|
8
|
-
cfg.
|
8
|
+
cfg.cut_both
|
9
9
|
end
|
10
10
|
|
11
11
|
cmd 'show version' do |cfg|
|
12
|
-
comment cfg
|
12
|
+
comment cfg.each_line.reject { |line| line.match /([Ss]ystem [Uu]p\s?[Tt]ime|[Uu]p\s?[Tt]ime is \d)/ }.join
|
13
13
|
end
|
14
14
|
|
15
15
|
cmd 'show inventory' do |cfg|
|
data/lib/oxidized/model/oneos.rb
CHANGED
@@ -24,38 +24,24 @@ class Openbsd < Oxidized::Model
|
|
24
24
|
cfg = add_comment('HOSTNAME FILE')
|
25
25
|
cfg += cmd('cat /etc/myname')
|
26
26
|
|
27
|
-
cfg += add_comment('HOSTS FILE')
|
28
|
-
cfg += cmd('cat /etc/hosts')
|
29
|
-
|
30
|
-
cfg += add_comment('INTERFACE FILES')
|
31
|
-
cfg += cmd('tail -n +1 /etc/hostname.*')
|
32
|
-
|
33
27
|
cfg += add_comment('RESOLV.CONF FILE')
|
34
28
|
cfg += cmd('cat /etc/resolv.conf')
|
35
29
|
|
36
30
|
cfg += add_comment('NTP.CONF FILE')
|
37
31
|
cfg += cmd('cat /etc/ntp.conf')
|
38
32
|
|
39
|
-
cfg += add_comment('
|
40
|
-
cfg +=
|
41
|
-
|
42
|
-
cfg +=
|
43
|
-
cfg += cmd('
|
44
|
-
|
45
|
-
cfg +=
|
46
|
-
cfg +=
|
47
|
-
cfg += cmd('route -T3 exec netstat -rn')
|
48
|
-
cfg += add_small_comment('Routing Domain 4')
|
49
|
-
cfg += cmd('route -T4 exec netstat -rn')
|
50
|
-
cfg += add_small_comment('Routing Domain 5')
|
51
|
-
cfg += cmd('route -T5 exec netstat -rn')
|
33
|
+
cfg += add_comment('PF FILE')
|
34
|
+
cfg += cmd('cat /etc/pf.conf')
|
35
|
+
|
36
|
+
cfg += add_comment('HOSTS FILE')
|
37
|
+
cfg += cmd('cat /etc/hosts')
|
38
|
+
|
39
|
+
cfg += add_comment('INTERFACE FILES')
|
40
|
+
cfg += cmd('tail -n +1 /etc/hostname.*')
|
52
41
|
|
53
42
|
cfg += add_comment('SNMP FILE')
|
54
43
|
cfg += cmd('cat /etc/snmpd.conf')
|
55
44
|
|
56
|
-
cfg += add_comment('PF FILE')
|
57
|
-
cfg += cmd('cat /etc/pf.conf')
|
58
|
-
|
59
45
|
cfg += add_comment('MOTD FILE')
|
60
46
|
cfg += cmd('cat /etc/motd')
|
61
47
|
|
@@ -62,6 +62,7 @@ class OpenWrt < Oxidized::Model
|
|
62
62
|
end
|
63
63
|
@mtdpartitions.scan(/(\w+):\s+\w+\s+\w+\s+"(.*)"/).each do |partition, name|
|
64
64
|
next unless vars(:openwrt_backup_partitions) && partitions_to_backup.include?(name)
|
65
|
+
|
65
66
|
Oxidized.logger.debug "Exporting partition - #{name}(#{partition})"
|
66
67
|
cfg << comment("#### Partition: #{name} /dev/#{partition} #####")
|
67
68
|
cfg << comment("Decode using 'echo -en <data> | gzip -dc > #{name}'")
|
data/lib/oxidized/model/panos.rb
CHANGED
@@ -3,21 +3,21 @@ class PanOS < Oxidized::Model
|
|
3
3
|
|
4
4
|
comment '! '
|
5
5
|
|
6
|
-
prompt /^[\w
|
6
|
+
prompt /^[\w.@:()-]+>\s?$/
|
7
7
|
|
8
8
|
cmd :all do |cfg|
|
9
9
|
cfg.each_line.to_a[2..-3].join
|
10
10
|
end
|
11
11
|
|
12
12
|
cmd 'show system info' do |cfg|
|
13
|
-
cfg.gsub! /^(up)?time
|
14
|
-
cfg.gsub! /^app
|
15
|
-
cfg.gsub! /^av
|
16
|
-
cfg.gsub! /^threat
|
17
|
-
cfg.gsub! /^wildfire
|
18
|
-
cfg.gsub! /^wf-private
|
19
|
-
cfg.gsub! /^url-filtering
|
20
|
-
cfg.gsub! /^global
|
13
|
+
cfg.gsub! /^(up)?time: .*$/, ''
|
14
|
+
cfg.gsub! /^app-.*?: .*$/, ''
|
15
|
+
cfg.gsub! /^av-.*?: .*$/, ''
|
16
|
+
cfg.gsub! /^threat-.*?: .*$/, ''
|
17
|
+
cfg.gsub! /^wildfire-.*?: .*$/, ''
|
18
|
+
cfg.gsub! /^wf-private.*?: .*$/, ''
|
19
|
+
cfg.gsub! /^url-filtering.*?: .*$/, ''
|
20
|
+
cfg.gsub! /^global-.*?: .*$/, ''
|
21
21
|
comment cfg
|
22
22
|
end
|
23
23
|
|
@@ -2,12 +2,13 @@ class PfSense < Oxidized::Model
|
|
2
2
|
# use other use than 'admin' user, 'admin' user cannot get ssh/exec. See issue #535
|
3
3
|
|
4
4
|
cmd :all do |cfg|
|
5
|
-
cfg.
|
5
|
+
cfg.cut_head
|
6
6
|
end
|
7
7
|
|
8
8
|
cmd :secret do |cfg|
|
9
9
|
cfg.gsub! /(\s+<bcrypt-hash>)[^<]+(<\/bcrypt-hash>)/, '\\1<secret hidden>\\2'
|
10
10
|
cfg.gsub! /(\s+<password>)[^<]+(<\/password>)/, '\\1<secret hidden>\\2'
|
11
|
+
cfg.gsub! /(\s+<lighttpd_ls_password>)[^<]+(<\/lighttpd_ls_password>)/, '\\1<secret hidden>\\2'
|
11
12
|
cfg
|
12
13
|
end
|
13
14
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class PowerConnect < Oxidized::Model
|
2
|
-
prompt /^([\w\s.@-]+[#>]\s?)$/ # allow spaces in hostname..dell does not limit it.. #
|
2
|
+
prompt /^([\w\s.@-]+(\(\S*\))?[#>]\s?)$/ # allow spaces in hostname..dell does not limit it.. #
|
3
3
|
|
4
4
|
comment '! '
|
5
5
|
|
@@ -14,6 +14,7 @@ class PowerConnect < Oxidized::Model
|
|
14
14
|
|
15
15
|
cmd :secret do |cfg|
|
16
16
|
cfg.gsub! /^(username \S+ password (?:encrypted )?)\S+(.*)/, '\1<hidden>\2'
|
17
|
+
cfg.gsub! /^(tacacs-server key) \S+/, '\\1 <secret hidden>'
|
17
18
|
cfg
|
18
19
|
end
|
19
20
|
|
@@ -40,9 +41,11 @@ class PowerConnect < Oxidized::Model
|
|
40
41
|
end
|
41
42
|
|
42
43
|
cfg :telnet, :ssh do
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
post_login do
|
45
|
+
if vars(:enable) == true
|
46
|
+
cmd "enable"
|
47
|
+
elsif vars(:enable)
|
48
|
+
cmd "enable", /^[pP]assword:/
|
46
49
|
cmd vars(:enable)
|
47
50
|
end
|
48
51
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Procurve < Oxidized::Model
|
2
2
|
# some models start lines with \r
|
3
3
|
# previous command is repeated followed by "\eE", which sometimes ends up on last line
|
4
|
-
prompt /^\r?([\w.-]+# )$/
|
4
|
+
prompt /^\r?([\w\s.-]+# )$/
|
5
5
|
|
6
6
|
comment '! '
|
7
7
|
|
@@ -26,15 +26,17 @@ class Procurve < Oxidized::Model
|
|
26
26
|
end
|
27
27
|
|
28
28
|
cmd :all do |cfg|
|
29
|
-
cfg = cfg.
|
29
|
+
cfg = cfg.cut_both
|
30
30
|
cfg = cfg.gsub /^\r/, ''
|
31
31
|
end
|
32
32
|
|
33
33
|
cmd :secret do |cfg|
|
34
|
-
cfg.gsub! /^(snmp-server community)
|
35
|
-
cfg.gsub! /^(snmp-server host)
|
36
|
-
cfg.gsub! /^(radius-server host)
|
34
|
+
cfg.gsub! /^(snmp-server community) \S+(.*)/, '\\1 <secret hidden> \\2'
|
35
|
+
cfg.gsub! /^(snmp-server host \S+) \S+(.*)/, '\\1 <secret hidden> \\2'
|
36
|
+
cfg.gsub! /^(radius-server host \S+ key) \S+(.*)/, '\\1 <secret hidden> \\2'
|
37
37
|
cfg.gsub! /^(radius-server key).*/, '\\1 <configuration removed>'
|
38
|
+
cfg.gsub! /^(tacacs-server host \S+ key) \S+(.*)/, '\\1 <secret hidden> \\2'
|
39
|
+
cfg.gsub! /^(tacacs-server key).*/, '\\1 <secret hidden>'
|
38
40
|
cfg
|
39
41
|
end
|
40
42
|
|
@@ -20,7 +20,7 @@ class RouterOS < Oxidized::Model
|
|
20
20
|
cfg.gsub! /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/, '' # strip ANSI colours
|
21
21
|
cfg.gsub! /\\\r\n\s+/, '' # strip new line
|
22
22
|
cfg.gsub! /# inactive time\r\n/, '' # Remove time based system comment
|
23
|
-
cfg = cfg.split("\n").reject { |line| line[
|
23
|
+
cfg = cfg.split("\n").reject { |line| line[/^#\s\w{3}\/\d{2}\/\d{4}.*$/] }
|
24
24
|
cfg.join("\n") + "\n"
|
25
25
|
end
|
26
26
|
end
|
data/lib/oxidized/model/saos.rb
CHANGED
@@ -3,7 +3,7 @@ class ScreenOS < Oxidized::Model
|
|
3
3
|
|
4
4
|
comment '! '
|
5
5
|
|
6
|
-
prompt /^[\w
|
6
|
+
prompt /^[\w.:()-]+->\s?$/
|
7
7
|
|
8
8
|
cmd :all do |cfg|
|
9
9
|
cfg.each_line.to_a[2..-2].join
|
@@ -17,8 +17,8 @@ class ScreenOS < Oxidized::Model
|
|
17
17
|
end
|
18
18
|
|
19
19
|
cmd 'get system' do |cfg|
|
20
|
-
cfg.gsub! /^Date
|
21
|
-
cfg.gsub! /^Up
|
20
|
+
cfg.gsub! /^Date .*\n/, ''
|
21
|
+
cfg.gsub! /^Up .*\n/, ''
|
22
22
|
cfg.gsub! /(current bw ).*/, '\\1 <removed>'
|
23
23
|
comment cfg
|
24
24
|
end
|
data/lib/oxidized/model/sros.rb
CHANGED
@@ -6,11 +6,11 @@ class SROS < Oxidized::Model
|
|
6
6
|
|
7
7
|
comment '# '
|
8
8
|
|
9
|
-
prompt /^([-\w
|
9
|
+
prompt /^([-\w.:>*]+\s?[#>]\s?)$/
|
10
10
|
|
11
11
|
cmd :all do |cfg, cmdstring|
|
12
12
|
new_cfg = comment "COMMAND: #{cmdstring}\n"
|
13
|
-
new_cfg << cfg.
|
13
|
+
new_cfg << cfg.cut_both
|
14
14
|
end
|
15
15
|
|
16
16
|
#
|
data/lib/oxidized/model/tmos.rb
CHANGED
@@ -18,6 +18,8 @@ class TPLink < Oxidized::Model
|
|
18
18
|
end
|
19
19
|
|
20
20
|
cmd :all do |cfg|
|
21
|
+
# remove unwanted paging line
|
22
|
+
cfg.gsub! /^Press any key to contin.*/, ''
|
21
23
|
# normalize linefeeds
|
22
24
|
cfg.gsub! /(\r|\r\n|\n\r)/, "\n"
|
23
25
|
# remove empty lines
|
@@ -25,6 +27,8 @@ class TPLink < Oxidized::Model
|
|
25
27
|
end
|
26
28
|
|
27
29
|
cmd :secret do |cfg|
|
30
|
+
cfg.gsub! /^enable password (\S+)/, 'enable password <secret hidden>'
|
31
|
+
cfg.gsub! /^user (\S+) password (\S+) (.*)/, 'user \1 password <secret hidden> \3'
|
28
32
|
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
|
29
33
|
cfg.gsub! /secret (\d+) (\S+).*/, '<secret hidden>'
|
30
34
|
cfg
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Viptela < Oxidized::Model
|
2
|
+
# Cisco Vipetla
|
3
|
+
|
4
|
+
prompt /[-\w]+#\s$/
|
5
|
+
comment '! '
|
6
|
+
|
7
|
+
cmd :all do |cfg|
|
8
|
+
cfg.each_line.to_a[1..-2].join
|
9
|
+
end
|
10
|
+
|
11
|
+
cmd :secret do |cfg|
|
12
|
+
cfg.gsub! /(^\s+secret-key|password|auth-password|priv-password)\s+.*$/, '\\1 <secret hidden>'
|
13
|
+
cfg.gsub! /(^\s+community)\s.*$/, '\\1 <secret hidden>'
|
14
|
+
cfg
|
15
|
+
end
|
16
|
+
|
17
|
+
cmd 'show running-config' do |cfg|
|
18
|
+
cfg
|
19
|
+
end
|
20
|
+
|
21
|
+
cmd 'show version' do |cfg|
|
22
|
+
comment cfg
|
23
|
+
end
|
24
|
+
|
25
|
+
cfg :ssh do
|
26
|
+
post_login 'paginate false'
|
27
|
+
pre_logout 'exit'
|
28
|
+
end
|
29
|
+
end
|
@@ -3,7 +3,7 @@ class VOLTAIRE < Oxidized::Model
|
|
3
3
|
comment '## '
|
4
4
|
|
5
5
|
# Pager Handling
|
6
|
-
expect /.+lines\s\d
|
6
|
+
expect /.+lines\s\d+-\d+([\s]|\/\d+\s\(END\)\s).+$/ do |data, re|
|
7
7
|
send ' '
|
8
8
|
data.sub re, ''
|
9
9
|
end
|
@@ -12,10 +12,10 @@ class VOLTAIRE < Oxidized::Model
|
|
12
12
|
cfg.gsub! /\[\?1h=\r/, '' # Pager Handling
|
13
13
|
cfg.gsub! /\r\[K/, '' # Pager Handling
|
14
14
|
cfg.gsub! /\s/, '' # Linebreak Handling
|
15
|
-
cfg.gsub! /^CPU
|
16
|
-
cfg.gsub! /^System
|
17
|
-
cfg.gsub! /^Uptime
|
18
|
-
cfg.gsub! /.+Generated
|
15
|
+
cfg.gsub! /^CPU load averages:\s.+/, '' # Omit constantly changing CPU info
|
16
|
+
cfg.gsub! /^System memory:\s.+/, '' # Omit constantly changing memory info
|
17
|
+
cfg.gsub! /^Uptime:\s.+/, '' # Omit constantly changing uptime info
|
18
|
+
cfg.gsub! /.+Generated at\s\d+.+/, '' # Omit constantly changing generation time info
|
19
19
|
cfg = cfg.lines.to_a[2..-3].join
|
20
20
|
end
|
21
21
|
|