oxidized 0.24.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +4 -0
  3. data/.rubocop.yml +3 -0
  4. data/CHANGELOG.md +26 -2
  5. data/Dockerfile +8 -32
  6. data/README.md +17 -5
  7. data/bin/oxidized +1 -1
  8. data/docs/Configuration.md +41 -3
  9. data/docs/Hooks.md +26 -0
  10. data/docs/Model-Notes/AireOS.md +1 -2
  11. data/docs/Model-Notes/ArbOS.md +1 -2
  12. data/docs/Model-Notes/Comware.md +1 -2
  13. data/docs/Model-Notes/EOS.md +1 -2
  14. data/docs/Model-Notes/JunOS.md +1 -2
  15. data/docs/Model-Notes/Netgear.md +5 -6
  16. data/docs/Model-Notes/Nokia.md +9 -0
  17. data/docs/Model-Notes/README.md +3 -2
  18. data/docs/Model-Notes/VRP-Huawei.md +1 -2
  19. data/docs/Model-Notes/Viptela.md +12 -0
  20. data/docs/Model-Notes/XGS4600-Zyxel.md +1 -2
  21. data/docs/Ruby-API.md +54 -2
  22. data/docs/Supported-OS-Types.md +12 -0
  23. data/extra/oxidized.service +7 -0
  24. data/lib/oxidized/cli.rb +7 -0
  25. data/lib/oxidized/config.rb +3 -0
  26. data/lib/oxidized/core.rb +1 -0
  27. data/lib/oxidized/hook/ciscosparkdiff.rb +11 -17
  28. data/lib/oxidized/hook/slackdiff.rb +5 -11
  29. data/lib/oxidized/hook/xmppdiff.rb +1 -0
  30. data/lib/oxidized/input/ssh.rb +43 -27
  31. data/lib/oxidized/input/telnet.rb +1 -0
  32. data/lib/oxidized/model/acos.rb +2 -2
  33. data/lib/oxidized/model/acsw.rb +6 -6
  34. data/lib/oxidized/model/adtran.rb +22 -0
  35. data/lib/oxidized/model/aen.rb +2 -2
  36. data/lib/oxidized/model/aireos.rb +3 -2
  37. data/lib/oxidized/model/alteonos.rb +2 -2
  38. data/lib/oxidized/model/aos.rb +1 -1
  39. data/lib/oxidized/model/aos7.rb +1 -1
  40. data/lib/oxidized/model/aosw.rb +5 -3
  41. data/lib/oxidized/model/apc_aos.rb +1 -1
  42. data/lib/oxidized/model/arbos.rb +2 -2
  43. data/lib/oxidized/model/asa.rb +8 -2
  44. data/lib/oxidized/model/awplus.rb +1 -1
  45. data/lib/oxidized/model/axos.rb +16 -0
  46. data/lib/oxidized/model/c4cmts.rb +3 -5
  47. data/lib/oxidized/model/casa.rb +1 -1
  48. data/lib/oxidized/model/catos.rb +1 -1
  49. data/lib/oxidized/model/ciscosma.rb +1 -1
  50. data/lib/oxidized/model/ciscosmb.rb +10 -4
  51. data/lib/oxidized/model/comtrol.rb +41 -0
  52. data/lib/oxidized/model/comware.rb +1 -1
  53. data/lib/oxidized/model/coriantgroove.rb +4 -6
  54. data/lib/oxidized/model/cumulus.rb +14 -1
  55. data/lib/oxidized/model/datacom.rb +1 -2
  56. data/lib/oxidized/model/dcnos.rb +1 -1
  57. data/lib/oxidized/model/dellx.rb +76 -0
  58. data/lib/oxidized/model/dlink.rb +2 -2
  59. data/lib/oxidized/model/dnos.rb +3 -1
  60. data/lib/oxidized/model/eciapollo.rb +34 -0
  61. data/lib/oxidized/model/edgecos.rb +1 -0
  62. data/lib/oxidized/model/edgeos.rb +6 -1
  63. data/lib/oxidized/model/eos.rb +3 -2
  64. data/lib/oxidized/model/fiberdriver.rb +1 -1
  65. data/lib/oxidized/model/firebrick.rb +31 -0
  66. data/lib/oxidized/model/firewareos.rb +1 -1
  67. data/lib/oxidized/model/fortios.rb +5 -4
  68. data/lib/oxidized/model/ftos.rb +4 -1
  69. data/lib/oxidized/model/fujitsupy.rb +3 -3
  70. data/lib/oxidized/model/gaiaos.rb +1 -1
  71. data/lib/oxidized/model/gcombnps.rb +3 -1
  72. data/lib/oxidized/model/hatteras.rb +1 -1
  73. data/lib/oxidized/model/hirschmann.rb +2 -2
  74. data/lib/oxidized/model/hpebladesystem.rb +1 -1
  75. data/lib/oxidized/model/ios.rb +21 -13
  76. data/lib/oxidized/model/ipos.rb +3 -3
  77. data/lib/oxidized/model/ironware.rb +3 -3
  78. data/lib/oxidized/model/isam.rb +1 -1
  79. data/lib/oxidized/model/junos.rb +1 -1
  80. data/lib/oxidized/model/masteros.rb +2 -3
  81. data/lib/oxidized/model/mlnxos.rb +5 -5
  82. data/lib/oxidized/model/model.rb +3 -0
  83. data/lib/oxidized/model/ndms.rb +1 -2
  84. data/lib/oxidized/model/netgear.rb +7 -9
  85. data/lib/oxidized/model/netonix.rb +1 -1
  86. data/lib/oxidized/model/netscaler.rb +6 -1
  87. data/lib/oxidized/model/nos.rb +2 -2
  88. data/lib/oxidized/model/oneos.rb +1 -1
  89. data/lib/oxidized/model/openbsd.rb +8 -22
  90. data/lib/oxidized/model/openwrt.rb +1 -0
  91. data/lib/oxidized/model/opnsense.rb +1 -1
  92. data/lib/oxidized/model/panos.rb +9 -9
  93. data/lib/oxidized/model/pfsense.rb +2 -1
  94. data/lib/oxidized/model/planet.rb +1 -1
  95. data/lib/oxidized/model/powerconnect.rb +7 -4
  96. data/lib/oxidized/model/procurve.rb +7 -5
  97. data/lib/oxidized/model/routeros.rb +1 -1
  98. data/lib/oxidized/model/saos.rb +1 -1
  99. data/lib/oxidized/model/screenos.rb +3 -3
  100. data/lib/oxidized/model/sros.rb +2 -2
  101. data/lib/oxidized/model/stoneos.rb +1 -1
  102. data/lib/oxidized/model/tmos.rb +2 -0
  103. data/lib/oxidized/model/tplink.rb +4 -0
  104. data/lib/oxidized/model/viptela.rb +29 -0
  105. data/lib/oxidized/model/voltaire.rb +5 -5
  106. data/lib/oxidized/model/voss.rb +4 -4
  107. data/lib/oxidized/model/vrp.rb +1 -1
  108. data/lib/oxidized/model/vyatta.rb +1 -1
  109. data/lib/oxidized/model/weos.rb +1 -1
  110. data/lib/oxidized/model/xos.rb +9 -2
  111. data/lib/oxidized/node.rb +20 -31
  112. data/lib/oxidized/nodes.rb +3 -0
  113. data/lib/oxidized/output/git.rb +17 -20
  114. data/lib/oxidized/output/gitcrypt.rb +2 -1
  115. data/lib/oxidized/output/http.rb +19 -12
  116. data/lib/oxidized/source/csv.rb +15 -8
  117. data/lib/oxidized/source/http.rb +26 -22
  118. data/lib/oxidized/string.rb +9 -4
  119. data/lib/oxidized/version.rb +2 -2
  120. data/lib/oxidized/worker.rb +44 -36
  121. data/oxidized.gemspec +1 -4
  122. metadata +26 -16
@@ -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|
@@ -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.to_a[1..-2]
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
- if vars :enable
17
- post_login do
18
- send "enable\n"
19
- # Interpret enable: true as meaning we won't be prompted for a password
20
- unless vars(:enable).is_a? TrueClass
21
- expect /[pP]assword:\s?$/
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'
@@ -2,7 +2,7 @@ class Netonix < Oxidized::Model
2
2
  prompt /^[\w\s.@_\/:-]+#/
3
3
 
4
4
  cmd :all do |cfg|
5
- cfg.each_line.to_a[1..-2].join
5
+ cfg.cut_both
6
6
  end
7
7
 
8
8
  cmd 'cat config.json;echo'
@@ -1,5 +1,5 @@
1
1
  class NetScaler < Oxidized::Model
2
- prompt /^\>\s*$/
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
@@ -5,11 +5,11 @@ class NOS < Oxidized::Model
5
5
  comment '! '
6
6
 
7
7
  cmd :all do |cfg|
8
- cfg.each_line.to_a[1..-2].join
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|
@@ -18,7 +18,7 @@ class OneOS < Oxidized::Model
18
18
  cmd :all do |cfg|
19
19
  # cfg.gsub! /\cH+\s{8}/, '' # example how to handle pager
20
20
  # cfg.gsub! /\cH+/, '' # example how to handle pager
21
- cfg.each_line.to_a[1..-2].join
21
+ cfg.cut_both
22
22
  end
23
23
 
24
24
  cmd :secret do |cfg|
@@ -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('IP ROUTES PER ROUTING DOMAIN')
40
- cfg += add_small_comment('Routing Domain 0')
41
- cfg += cmd('route -T0 exec netstat -rn')
42
- cfg += add_small_comment('Routing Domain 1')
43
- cfg += cmd('route -T1 exec netstat -rn')
44
- cfg += add_small_comment('Routing Domain 2')
45
- cfg += cmd('route -T2 exec netstat -rn')
46
- cfg += add_small_comment('Routing Domain 3')
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}'")
@@ -3,7 +3,7 @@ class OpnSense < Oxidized::Model
3
3
  # must enable SSH and password-based SSH access
4
4
 
5
5
  cmd :all do |cfg|
6
- cfg.each_line.to_a[1..-1].join
6
+ cfg.cut_head
7
7
  end
8
8
 
9
9
  cmd 'cat /conf/config.xml' do |cfg|
@@ -3,21 +3,21 @@ class PanOS < Oxidized::Model
3
3
 
4
4
  comment '! '
5
5
 
6
- prompt /^[\w.\@:\(\)-]+>\s?$/
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.each_line.to_a[1..-1].join
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
 
@@ -18,7 +18,7 @@ class Planet < Oxidized::Model
18
18
  cmd :all do |cfg|
19
19
  # cfg.gsub! /\cH+\s{8}/, '' # example how to handle pager
20
20
  # cfg.gsub! /\cH+/, '' # example how to handle pager
21
- cfg.each_line.to_a[1..-2].join
21
+ cfg.cut_both
22
22
  end
23
23
 
24
24
  cmd :secret do |cfg|
@@ -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
- if vars :enable
44
- post_login do
45
- send "enable\n"
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.each_line.to_a[1..-2].join
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).*/, '\\1 <configuration removed>'
35
- cfg.gsub! /^(snmp-server host).*/, '\\1 <configuration removed>'
36
- cfg.gsub! /^(radius-server host).*/, '\\1 <configuration removed>'
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[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] }
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
@@ -5,7 +5,7 @@ class SAOS < Oxidized::Model
5
5
  comment '! '
6
6
 
7
7
  cmd :all do |cfg|
8
- cfg.each_line.to_a[1..-2].join
8
+ cfg.cut_both
9
9
  end
10
10
 
11
11
  cmd 'configuration show' do |cfg|
@@ -3,7 +3,7 @@ class ScreenOS < Oxidized::Model
3
3
 
4
4
  comment '! '
5
5
 
6
- prompt /^[\w.:\(\)-]+->\s?$/
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\ .*\n/, ''
21
- cfg.gsub! /^Up\ .*\n/, ''
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
@@ -6,11 +6,11 @@ class SROS < Oxidized::Model
6
6
 
7
7
  comment '# '
8
8
 
9
- prompt /^([-\w\.:>\*]+\s?[#>]\s?)$/
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.each_line.to_a[1..-2].join
13
+ new_cfg << cfg.cut_both
14
14
  end
15
15
 
16
16
  #
@@ -10,7 +10,7 @@ class StoneOS < Oxidized::Model
10
10
  end
11
11
 
12
12
  cmd :all do |cfg|
13
- cfg.each_line.to_a[1..-2].join
13
+ cfg.cut_both
14
14
  end
15
15
 
16
16
  cmd 'show configuration running'
@@ -42,6 +42,8 @@ class TMOS < Oxidized::Model
42
42
  comment cfg
43
43
  end
44
44
 
45
+ cmd('[ -d "/config/zebos" ] && cat /config/zebos/*/ZebOS.conf') { |cfg| comment cfg }
46
+
45
47
  cmd('cat /config/partitions/*/bigip.conf') { |cfg| comment cfg }
46
48
 
47
49
  cfg :ssh do
@@ -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+\-\d+([\s]|\/\d+\s\(END\)\s).+$/ do |data, re|
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\ 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
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