oxidized 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +5 -5
  2. data/.github/no-response.yml +13 -0
  3. data/.gitignore +3 -0
  4. data/.rubocop.yml +37 -0
  5. data/.rubocop_todo.yml +714 -0
  6. data/.travis.yml +7 -1
  7. data/CHANGELOG.md +341 -243
  8. data/Dockerfile +44 -16
  9. data/LICENSE +201 -0
  10. data/README.md +114 -82
  11. data/Rakefile +19 -0
  12. data/TODO.md +29 -23
  13. data/bin/oxidized +1 -2
  14. data/docs/Configuration.md +71 -31
  15. data/docs/Creating-Models.md +78 -0
  16. data/docs/Hooks.md +145 -41
  17. data/docs/Model-Notes/AireOS.md +12 -0
  18. data/docs/Model-Notes/ArbOS.md +12 -0
  19. data/docs/Model-Notes/Comware.md +14 -0
  20. data/docs/Model-Notes/EOS.md +9 -0
  21. data/docs/Model-Notes/JunOS.md +34 -0
  22. data/docs/Model-Notes/Netgear.md +68 -0
  23. data/docs/Model-Notes/README.md +19 -0
  24. data/docs/{VRP-Huawei.md → Model-Notes/VRP-Huawei.md} +10 -2
  25. data/docs/Model-Notes/XGS4600-Zyxel.md +39 -0
  26. data/docs/Outputs.md +27 -28
  27. data/docs/Ruby-API.md +38 -18
  28. data/docs/Sources.md +78 -16
  29. data/docs/Supported-OS-Types.md +171 -148
  30. data/extra/oxidized.logrotate +7 -0
  31. data/extra/oxidized.service +1 -1
  32. data/extra/rest_client.rb +4 -5
  33. data/extra/syslog.rb +16 -16
  34. data/lib/oxidized/cli.rb +3 -3
  35. data/lib/oxidized/config.rb +7 -4
  36. data/lib/oxidized/core.rb +3 -3
  37. data/lib/oxidized/hook.rb +64 -65
  38. data/lib/oxidized/hook/awssns.rb +2 -3
  39. data/lib/oxidized/hook/ciscosparkdiff.rb +49 -0
  40. data/lib/oxidized/hook/exec.rb +5 -5
  41. data/lib/oxidized/hook/githubrepo.rb +20 -14
  42. data/lib/oxidized/hook/slackdiff.rb +38 -19
  43. data/lib/oxidized/hook/xmppdiff.rb +58 -0
  44. data/lib/oxidized/input/cli.rb +5 -6
  45. data/lib/oxidized/input/ftp.rb +8 -7
  46. data/lib/oxidized/input/http.rb +39 -0
  47. data/lib/oxidized/input/ssh.rb +24 -22
  48. data/lib/oxidized/input/telnet.rb +38 -32
  49. data/lib/oxidized/jobs.rb +3 -4
  50. data/lib/oxidized/manager.rb +9 -4
  51. data/lib/oxidized/model/acos.rb +15 -16
  52. data/lib/oxidized/model/acsw.rb +3 -8
  53. data/lib/oxidized/model/aen.rb +1 -2
  54. data/lib/oxidized/model/aireos.rb +3 -5
  55. data/lib/oxidized/model/alteonos.rb +16 -18
  56. data/lib/oxidized/model/alvarion.rb +0 -4
  57. data/lib/oxidized/model/aos.rb +2 -4
  58. data/lib/oxidized/model/aos7.rb +2 -3
  59. data/lib/oxidized/model/aosw.rb +13 -15
  60. data/lib/oxidized/model/apc_aos.rb +0 -3
  61. data/lib/oxidized/model/arbos.rb +26 -0
  62. data/lib/oxidized/model/aricentiss.rb +51 -0
  63. data/lib/oxidized/model/asa.rb +33 -35
  64. data/lib/oxidized/model/asyncos.rb +41 -44
  65. data/lib/oxidized/model/audiocodes.rb +4 -8
  66. data/lib/oxidized/model/awplus.rb +84 -0
  67. data/lib/oxidized/model/boss.rb +6 -5
  68. data/lib/oxidized/model/br6910.rb +43 -45
  69. data/lib/oxidized/model/c4cmts.rb +3 -5
  70. data/lib/oxidized/model/cambium.rb +22 -0
  71. data/lib/oxidized/model/catos.rb +0 -2
  72. data/lib/oxidized/model/cisconga.rb +1 -3
  73. data/lib/oxidized/model/ciscosma.rb +37 -40
  74. data/lib/oxidized/model/ciscosmb.rb +7 -4
  75. data/lib/oxidized/model/comnetms.rb +43 -0
  76. data/lib/oxidized/model/comware.rb +9 -9
  77. data/lib/oxidized/model/coriant8600.rb +3 -5
  78. data/lib/oxidized/model/coriantgroove.rb +3 -5
  79. data/lib/oxidized/model/corianttmos.rb +1 -3
  80. data/lib/oxidized/model/cumulus.rb +26 -32
  81. data/lib/oxidized/model/datacom.rb +0 -2
  82. data/lib/oxidized/model/dcnos.rb +46 -0
  83. data/lib/oxidized/model/dlink.rb +1 -1
  84. data/lib/oxidized/model/dnos.rb +9 -5
  85. data/lib/oxidized/model/edgecos.rb +45 -0
  86. data/lib/oxidized/model/edgeos.rb +5 -3
  87. data/lib/oxidized/model/edgeswitch.rb +1 -3
  88. data/lib/oxidized/model/enterasys.rb +1 -3
  89. data/lib/oxidized/model/eos.rb +6 -8
  90. data/lib/oxidized/model/fabricos.rb +3 -5
  91. data/lib/oxidized/model/firewareos.rb +2 -5
  92. data/lib/oxidized/model/fortios.rb +21 -17
  93. data/lib/oxidized/model/ftos.rb +2 -4
  94. data/lib/oxidized/model/fujitsupy.rb +2 -4
  95. data/lib/oxidized/model/gaiaos.rb +6 -10
  96. data/lib/oxidized/model/gcombnps.rb +82 -0
  97. data/lib/oxidized/model/hatteras.rb +8 -5
  98. data/lib/oxidized/model/hirschmann.rb +8 -10
  99. data/lib/oxidized/model/hpebladesystem.rb +19 -17
  100. data/lib/oxidized/model/hpemsa.rb +0 -3
  101. data/lib/oxidized/model/ios.rb +54 -55
  102. data/lib/oxidized/model/iosxe.rb +5 -0
  103. data/lib/oxidized/model/iosxr.rb +1 -3
  104. data/lib/oxidized/model/ipos.rb +1 -3
  105. data/lib/oxidized/model/ironware.rb +12 -15
  106. data/lib/oxidized/model/isam.rb +4 -5
  107. data/lib/oxidized/model/junos.rb +8 -7
  108. data/lib/oxidized/model/masteros.rb +1 -3
  109. data/lib/oxidized/model/mlnxos.rb +3 -4
  110. data/lib/oxidized/model/model.rb +15 -7
  111. data/lib/oxidized/model/mtrlrfs.rb +1 -4
  112. data/lib/oxidized/model/ndms.rb +24 -0
  113. data/lib/oxidized/model/netgear.rb +3 -4
  114. data/lib/oxidized/model/netscaler.rb +0 -2
  115. data/lib/oxidized/model/nos.rb +1 -3
  116. data/lib/oxidized/model/nxos.rb +13 -3
  117. data/lib/oxidized/model/oneos.rb +6 -8
  118. data/lib/oxidized/model/openbsd.rb +76 -0
  119. data/lib/oxidized/model/opengear.rb +3 -5
  120. data/lib/oxidized/model/openwrt.rb +77 -0
  121. data/lib/oxidized/model/opnsense.rb +19 -0
  122. data/lib/oxidized/model/outputs.rb +1 -3
  123. data/lib/oxidized/model/panos.rb +1 -2
  124. data/lib/oxidized/model/pfsense.rb +9 -5
  125. data/lib/oxidized/model/planet.rb +8 -12
  126. data/lib/oxidized/model/powerconnect.rb +6 -9
  127. data/lib/oxidized/model/procurve.rb +18 -4
  128. data/lib/oxidized/model/quantaos.rb +3 -5
  129. data/lib/oxidized/model/routeros.rb +3 -2
  130. data/lib/oxidized/model/saos.rb +0 -1
  131. data/lib/oxidized/model/screenos.rb +3 -5
  132. data/lib/oxidized/model/sgos.rb +2 -3
  133. data/lib/oxidized/model/siklu.rb +0 -2
  134. data/lib/oxidized/model/slxos.rb +59 -0
  135. data/lib/oxidized/model/sros.rb +117 -0
  136. data/lib/oxidized/model/stoneos.rb +32 -0
  137. data/lib/oxidized/model/supermicro.rb +6 -41
  138. data/lib/oxidized/model/timos.rb +6 -114
  139. data/lib/oxidized/model/tmos.rb +1 -3
  140. data/lib/oxidized/model/tplink.rb +7 -11
  141. data/lib/oxidized/model/trango.rb +6 -7
  142. data/lib/oxidized/model/ucs.rb +0 -1
  143. data/lib/oxidized/model/voltaire.rb +3 -6
  144. data/lib/oxidized/model/voss.rb +1 -2
  145. data/lib/oxidized/model/vrp.rb +4 -5
  146. data/lib/oxidized/model/vyatta.rb +6 -4
  147. data/lib/oxidized/model/weos.rb +1 -3
  148. data/lib/oxidized/model/xos.rb +6 -5
  149. data/lib/oxidized/model/zhoneolt.rb +2 -2
  150. data/lib/oxidized/model/zynos.rb +1 -3
  151. data/lib/oxidized/model/zynoscli.rb +36 -0
  152. data/lib/oxidized/node.rb +11 -11
  153. data/lib/oxidized/node/stats.rb +15 -2
  154. data/lib/oxidized/nodes.rb +8 -8
  155. data/lib/oxidized/output/file.rb +41 -42
  156. data/lib/oxidized/output/git.rb +113 -115
  157. data/lib/oxidized/output/gitcrypt.rb +241 -242
  158. data/lib/oxidized/output/http.rb +23 -27
  159. data/lib/oxidized/output/output.rb +1 -2
  160. data/lib/oxidized/source/csv.rb +44 -45
  161. data/lib/oxidized/source/http.rb +52 -49
  162. data/lib/oxidized/source/source.rb +6 -7
  163. data/lib/oxidized/source/sql.rb +55 -51
  164. data/lib/oxidized/string.rb +3 -4
  165. data/lib/oxidized/version.rb +17 -1
  166. data/lib/oxidized/worker.rb +12 -3
  167. data/oxidized.gemspec +19 -13
  168. metadata +139 -51
  169. data/.ruby-version +0 -1
  170. data/Gemfile.lock +0 -44
@@ -1,8 +1,7 @@
1
1
  class OpenGear < Oxidized::Model
2
+ comment '# '
2
3
 
3
- comment '# '
4
-
5
- prompt /^(\$\s)?$/
4
+ prompt /^(\$\s)$/
6
5
 
7
6
  cmd :secret do |cfg|
8
7
  cfg.gsub!(/password (\S+)/, 'password <secret removed>')
@@ -15,7 +14,6 @@ class OpenGear < Oxidized::Model
15
14
  cmd 'config -g config'
16
15
 
17
16
  cfg :ssh do
18
- exec true # don't run shell, run each command in exec channel
17
+ exec true # don't run shell, run each command in exec channel
19
18
  end
20
-
21
19
  end
@@ -0,0 +1,77 @@
1
+ class OpenWrt < Oxidized::Model
2
+ prompt /^[^#]+#/
3
+ comment '#'
4
+
5
+ cmd 'cat /etc/banner' do |cfg|
6
+ comment "#### Info: /etc/banner #####\n#{cfg}"
7
+ end
8
+
9
+ cmd 'cat /proc/cpuinfo' do |cfg|
10
+ comment "#### Info: /proc/cpuinfo #####\n#{cfg}"
11
+ end
12
+
13
+ cmd 'cat /etc/openwrt_release' do |cfg|
14
+ comment "#### Info: /etc/openwrt_release #####\n#{cfg}"
15
+ end
16
+
17
+ cmd 'sysupgrade -l' do |cfg|
18
+ @sysupgradefiles = cfg
19
+ comment "#### Info: sysupgrade -l #####\n#{cfg}"
20
+ end
21
+
22
+ cmd 'cat /proc/mtd' do |cfg|
23
+ @mtdpartitions = cfg
24
+ comment "#### Info: /proc/mtd #####\n#{cfg}"
25
+ end
26
+
27
+ post do
28
+ cfg = []
29
+ binary_files = vars(:openwrt_binary_files) || %w[/etc/dropbear/dropbear_rsa_host_key]
30
+ non_sensitive_files = vars(:openwrt_non_sensitive_files) || %w[rpcd uhttpd]
31
+ partitions_to_backup = vars(:openwrt_partitions_to_backup) || %w[art devinfo u_env config caldata]
32
+ @sysupgradefiles.lines.each do |sysupgradefile|
33
+ sysupgradefile = sysupgradefile.strip
34
+ if sysupgradefile.start_with?('/etc/config/')
35
+ unless sysupgradefile.end_with?('-opkg')
36
+ filename = sysupgradefile.split('/')[-1]
37
+ cfg << comment("#### File: #{sysupgradefile} #####")
38
+ uciexport = cmd("uci export #{filename}")
39
+ Oxidized.logger.debug "Exporting uci config - #{filename}"
40
+ if vars(:remove_secret) && !(non_sensitive_files.include? filename)
41
+ Oxidized.logger.debug "Scrubbing uci config - #{filename}"
42
+ uciexport.gsub!(/^(\s+option\s+(password|key)\s+')[^']+'/, '\\1<secret hidden>\'')
43
+ end
44
+ cfg << uciexport
45
+ end
46
+ elsif binary_files.include? sysupgradefile
47
+ Oxidized.logger.debug "Exporting binary file - #{sysupgradefile}"
48
+ cfg << comment("#### Binary file: #{sysupgradefile} #####")
49
+ cfg << comment("Decode using 'echo -en <data> | gzip -dc > #{sysupgradefile}'")
50
+ cfg << cmd("gzip -c #{sysupgradefile} | hexdump -ve '1/1 \"_x%.2x\"' | tr _ \\")
51
+ elsif vars(:remove_secret) && sysupgradefile == '/etc/shadow'
52
+ Oxidized.logger.debug 'Exporting and scrubbing /etc/shadow'
53
+ cfg << comment("#### File: #{sysupgradefile} #####")
54
+ shadow = cmd("cat #{sysupgradefile}")
55
+ shadow.gsub!(/^([^:]+:)[^:]*(:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:)/, '\\1\\2')
56
+ cfg << shadow
57
+ else
58
+ Oxidized.logger.debug "Exporting file - #{sysupgradefile}"
59
+ cfg << comment("#### File: #{sysupgradefile} #####")
60
+ cfg << cmd("cat #{sysupgradefile}")
61
+ end
62
+ end
63
+ @mtdpartitions.scan(/(\w+):\s+\w+\s+\w+\s+"(.*)"/).each do |partition, name|
64
+ next unless vars(:openwrt_backup_partitions) && partitions_to_backup.include?(name)
65
+ Oxidized.logger.debug "Exporting partition - #{name}(#{partition})"
66
+ cfg << comment("#### Partition: #{name} /dev/#{partition} #####")
67
+ cfg << comment("Decode using 'echo -en <data> | gzip -dc > #{name}'")
68
+ cfg << cmd("dd if=/dev/#{partition} 2>/dev/null | gzip -c | hexdump -ve '1/1 \"%.2x\"'")
69
+ end
70
+ cfg.join "\n"
71
+ end
72
+
73
+ cfg :ssh do
74
+ exec true
75
+ pre_logout 'exit'
76
+ end
77
+ end
@@ -0,0 +1,19 @@
1
+ class OpnSense < Oxidized::Model
2
+ # minimum required permissions: "System: Shell account access"
3
+ # must enable SSH and password-based SSH access
4
+
5
+ cmd :all do |cfg|
6
+ cfg.each_line.to_a[1..-1].join
7
+ end
8
+
9
+ cmd 'cat /conf/config.xml' do |cfg|
10
+ cfg.gsub! /\s<revision>\s*<time>\d*<\/time>\s*.*\s*.*\s*<\/revision>/, ''
11
+ cfg.gsub! /\s<last_rule_upd_time>\d*<\/last_rule_upd_time>/, ''
12
+ cfg
13
+ end
14
+
15
+ cfg :ssh do
16
+ exec true
17
+ pre_logout 'exit'
18
+ end
19
+ end
@@ -1,7 +1,6 @@
1
1
  module Oxidized
2
2
  class Model
3
3
  class Outputs
4
-
5
4
  def to_cfg
6
5
  type_to_str(nil)
7
6
  end
@@ -23,7 +22,7 @@ module Oxidized
23
22
  end
24
23
 
25
24
  def type type
26
- @outputs.select { |out| out.type==type }
25
+ @outputs.select { |out| out.type == type }
27
26
  end
28
27
 
29
28
  def types
@@ -35,7 +34,6 @@ module Oxidized
35
34
  def initialize
36
35
  @outputs = []
37
36
  end
38
-
39
37
  end
40
38
  end
41
39
  end
@@ -1,8 +1,7 @@
1
1
  class PanOS < Oxidized::Model
2
-
3
2
  # PaloAlto PAN-OS model #
4
3
 
5
- comment '! '
4
+ comment '! '
6
5
 
7
6
  prompt /^[\w.\@:\(\)-]+>\s?$/
8
7
 
@@ -1,20 +1,24 @@
1
1
  class PfSense < Oxidized::Model
2
-
3
2
  # use other use than 'admin' user, 'admin' user cannot get ssh/exec. See issue #535
4
-
3
+
5
4
  cmd :all do |cfg|
6
5
  cfg.each_line.to_a[1..-1].join
7
6
  end
8
-
7
+
8
+ cmd :secret do |cfg|
9
+ cfg.gsub! /(\s+<bcrypt-hash>)[^<]+(<\/bcrypt-hash>)/, '\\1<secret hidden>\\2'
10
+ cfg.gsub! /(\s+<password>)[^<]+(<\/password>)/, '\\1<secret hidden>\\2'
11
+ cfg
12
+ end
13
+
9
14
  cmd 'cat /cf/conf/config.xml' do |cfg|
10
15
  cfg.gsub! /\s<revision>\s*<time>\d*<\/time>\s*.*\s*.*\s*<\/revision>/, ''
11
16
  cfg.gsub! /\s<last_rule_upd_time>\d*<\/last_rule_upd_time>/, ''
12
17
  cfg
13
18
  end
14
-
19
+
15
20
  cfg :ssh do
16
21
  exec true
17
22
  pre_logout 'exit'
18
23
  end
19
-
20
24
  end
@@ -1,24 +1,23 @@
1
1
  class Planet < Oxidized::Model
2
-
3
2
  prompt /^\r?([\w.@()-]+[#>]\s?)$/
4
3
  comment '! '
5
4
 
6
5
  # example how to handle pager
7
- #expect /^\s--More--\s+.*$/ do |data, re|
6
+ # expect /^\s--More--\s+.*$/ do |data, re|
8
7
  # send ' '
9
8
  # data.sub re, ''
10
- #end
9
+ # end
11
10
 
12
11
  # non-preferred way to handle additional PW prompt
13
- #expect /^[\w.]+>$/ do |data|
12
+ # expect /^[\w.]+>$/ do |data|
14
13
  # send "enable\n"
15
14
  # send vars(:enable) + "\n"
16
15
  # data
17
- #end
16
+ # end
18
17
 
19
18
  cmd :all do |cfg|
20
- #cfg.gsub! /\cH+\s{8}/, '' # example how to handle pager
21
- #cfg.gsub! /\cH+/, '' # example how to handle pager
19
+ # cfg.gsub! /\cH+\s{8}/, '' # example how to handle pager
20
+ # cfg.gsub! /\cH+/, '' # example how to handle pager
22
21
  cfg.each_line.to_a[1..-2].join
23
22
  end
24
23
 
@@ -39,7 +38,7 @@ class Planet < Oxidized::Model
39
38
 
40
39
  cfg = cfg.each_line.to_a[0...-2]
41
40
 
42
- # Strip system (up)time and temperature
41
+ # Strip system (up)time and temperature
43
42
  cfg = cfg.reject { |line| line.match /System Time\s*:.*/ }
44
43
  cfg = cfg.reject { |line| line.match /System Uptime\s*:.*/ }
45
44
  cfg = cfg.reject { |line| line.match /Temperature\s*:.*/ }
@@ -47,13 +46,12 @@ class Planet < Oxidized::Model
47
46
  comment cfg.join
48
47
  end
49
48
 
50
-
51
49
  cmd 'show running-config' do |cfg|
52
50
  cfg.gsub! "\n\r", "\n"
53
51
  cfg = cfg.each_line.to_a
54
52
 
55
53
  cfg = cfg.reject { |line| line.match "Building configuration..." }
56
-
54
+
57
55
  if @planetsgs
58
56
  cfg << cmd('show transceiver detail | include transceiver detail information|found|Type|length|Nominal|wavelength|Base information') do |cfg|
59
57
  comment cfg
@@ -62,7 +60,6 @@ class Planet < Oxidized::Model
62
60
 
63
61
  cfg.join
64
62
  end
65
-
66
63
 
67
64
  cfg :telnet do
68
65
  username /^Username:/
@@ -80,5 +77,4 @@ class Planet < Oxidized::Model
80
77
  end
81
78
  pre_logout 'exit'
82
79
  end
83
-
84
80
  end
@@ -1,12 +1,11 @@
1
1
  class PowerConnect < Oxidized::Model
2
-
3
2
  prompt /^([\w\s.@-]+[#>]\s?)$/ # allow spaces in hostname..dell does not limit it.. #
4
3
 
5
- comment '! '
4
+ comment '! '
6
5
 
7
6
  expect /^\s*--More--\s+.*$/ do |data, re|
8
- send ' '
9
- data.sub re, ''
7
+ send ' '
8
+ data.sub re, ''
10
9
  end
11
10
 
12
11
  cmd :all do |cfg|
@@ -14,7 +13,7 @@ class PowerConnect < Oxidized::Model
14
13
  end
15
14
 
16
15
  cmd :secret do |cfg|
17
- cfg.gsub! /^username (\S+) password \S+ (.*)/, 'username \1 password <hidden> \2'
16
+ cfg.gsub! /^(username \S+ password (?:encrypted )?)\S+(.*)/, '\1<hidden>\2'
18
17
  cfg
19
18
  end
20
19
 
@@ -22,7 +21,7 @@ class PowerConnect < Oxidized::Model
22
21
  if (@stackable.nil?)
23
22
  @stackable = true if cfg.match /(U|u)nit\s/
24
23
  end
25
- cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] }
24
+ cfg = cfg.split("\n").reject { |line| line[/Up\sTime/] }
26
25
  comment cfg.join("\n") + "\n"
27
26
  end
28
27
 
@@ -52,7 +51,6 @@ class PowerConnect < Oxidized::Model
52
51
  post_login "terminal length 0"
53
52
  pre_logout "logout"
54
53
  pre_logout "exit"
55
-
56
54
  end
57
55
 
58
56
  def clean cfg
@@ -72,9 +70,8 @@ class PowerConnect < Oxidized::Model
72
70
  end
73
71
  out << line.strip
74
72
  end
75
- out = out.select { |line| not line[/Up\sTime/] }
73
+ out = out.reject { |line| line[/Up\sTime/] }
76
74
  out = comment out.join "\n"
77
75
  out << "\n"
78
76
  end
79
-
80
77
  end
@@ -1,10 +1,9 @@
1
1
  class Procurve < Oxidized::Model
2
-
3
2
  # some models start lines with \r
4
3
  # previous command is repeated followed by "\eE", which sometimes ends up on last line
5
4
  prompt /^\r?([\w.-]+# )$/
6
5
 
7
- comment '! '
6
+ comment '! '
8
7
 
9
8
  # replace next line control sequence with a new line
10
9
  expect /(\e\[1M\e\[\??\d+(;\d+)*[A-Za-z]\e\[1L)|(\eE)/ do |data, re|
@@ -21,6 +20,11 @@ class Procurve < Oxidized::Model
21
20
  ""
22
21
  end
23
22
 
23
+ expect /Enter switch number/ do
24
+ send "\n"
25
+ ""
26
+ end
27
+
24
28
  cmd :all do |cfg|
25
29
  cfg = cfg.each_line.to_a[1..-2].join
26
30
  cfg = cfg.gsub /^\r/, ''
@@ -42,6 +46,10 @@ class Procurve < Oxidized::Model
42
46
  comment cfg
43
47
  end
44
48
 
49
+ cmd 'show system power-supply' do |cfg|
50
+ comment cfg
51
+ end
52
+
45
53
  cmd 'show interfaces transceiver' do |cfg|
46
54
  comment cfg
47
55
  end
@@ -58,7 +66,7 @@ class Procurve < Oxidized::Model
58
66
 
59
67
  # not supported on all models
60
68
  cmd 'show system information' do |cfg|
61
- cfg = cfg.each_line.select { |line| not line.match /(.*CPU.*)|(.*Up Time.*)|(.*Total.*)|(.*Free.*)|(.*Lowest.*)|(.*Missed.*)/ }
69
+ cfg = cfg.each_line.reject { |line| line.match /(.*CPU.*)|(.*Up Time.*)|(.*Total.*)|(.*Free.*)|(.*Lowest.*)|(.*Missed.*)/ }
62
70
  cfg = cfg.join
63
71
  comment cfg
64
72
  end
@@ -71,6 +79,13 @@ class Procurve < Oxidized::Model
71
79
  end
72
80
 
73
81
  cfg :telnet, :ssh do
82
+ # preferred way to handle additional passwords
83
+ if vars :enable
84
+ post_login do
85
+ send "enable\n"
86
+ cmd vars(:enable)
87
+ end
88
+ end
74
89
  post_login 'no page'
75
90
  pre_logout "logout\ny\nn"
76
91
  end
@@ -78,5 +93,4 @@ class Procurve < Oxidized::Model
78
93
  cfg :ssh do
79
94
  pty_options({ chars_wide: 1000 })
80
95
  end
81
-
82
96
  end
@@ -1,13 +1,12 @@
1
1
  class QuantaOS < Oxidized::Model
2
-
3
2
  prompt /^\((\w|\S)+\) (>|#)$/
4
3
  comment '! '
5
-
4
+
6
5
  cmd 'show run' do |cfg|
7
6
  cfg.each_line.select do |line|
8
7
  not line.match /^!.*$/ and
9
- not line.match /^\((\w|\S)+\) (>|#)$/ and
10
- not line.match /^show run$/
8
+ not line.match /^\((\w|\S)+\) (>|#)$/ and
9
+ not line.match /^show run$/
11
10
  end.join
12
11
  end
13
12
 
@@ -31,5 +30,4 @@ class QuantaOS < Oxidized::Model
31
30
  send "n\n"
32
31
  end
33
32
  end
34
-
35
33
  end
@@ -18,8 +18,9 @@ class RouterOS < Oxidized::Model
18
18
  run_cmd = vars(:remove_secret) ? '/export hide-sensitive' : '/export'
19
19
  cmd run_cmd do |cfg|
20
20
  cfg.gsub! /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/, '' # strip ANSI colours
21
- cfg.gsub! /\\\r\n\s+/, '' # strip new line
22
- cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] }
21
+ cfg.gsub! /\\\r\n\s+/, '' # strip new line
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
24
  cfg.join("\n") + "\n"
24
25
  end
25
26
  end
@@ -1,5 +1,4 @@
1
1
  class SAOS < Oxidized::Model
2
-
3
2
  # Ciena SAOS switch
4
3
  # used for 6.x devices
5
4
 
@@ -1,8 +1,7 @@
1
- class ScreenOS < Oxidized::Model
2
-
1
+ class ScreenOS < Oxidized::Model
3
2
  # Netscreen ScreenOS model #
4
3
 
5
- comment '! '
4
+ comment '! '
6
5
 
7
6
  prompt /^[\w.:\(\)-]+->\s?$/
8
7
 
@@ -10,7 +9,7 @@ class ScreenOS < Oxidized::Model
10
9
  cfg.each_line.to_a[2..-2].join
11
10
  end
12
11
 
13
- cmd :secret do |cfg|
12
+ cmd :secret do |cfg|
14
13
  cfg.gsub! /^(set admin name) .*|^(set admin password) .*/, '\\1 <removed>'
15
14
  cfg.gsub! /^(set admin user .* password) .* (.*)/, '\\1 <removed> \\2'
16
15
  cfg.gsub! /(secret|password|preshare) .*/, '\\1 <secret hidden>'
@@ -41,5 +40,4 @@ class ScreenOS < Oxidized::Model
41
40
  send "n"
42
41
  end
43
42
  end
44
-
45
43
  end
@@ -1,5 +1,4 @@
1
1
  class SGOS < Oxidized::Model
2
-
3
2
  comment '!- '
4
3
  prompt /\w+>|#/
5
4
 
@@ -20,14 +19,14 @@ class SGOS < Oxidized::Model
20
19
  comment cfg
21
20
  end
22
21
 
23
- cmd :secret do |cfg|
22
+ cmd :secret do |cfg|
24
23
  cfg.gsub! /^(security hashed-enable-password).*/, '\\1 <secret hidden>'
25
24
  cfg.gsub! /^(security hashed-password).*/, '\\1 <secret hidden>'
26
25
  cfg
27
26
  end
28
27
 
29
28
  cmd 'show configuration expanded noprompts with-keyrings unencrypted' do |cfg|
30
- cfg.gsub! /^(!- Local time).*/,""
29
+ cfg.gsub! /^(!- Local time).*/, ""
31
30
  cfg.gsub! /^(archive-configuration encrypted-password).*/, ""
32
31
  cfg.gsub! /^(download encrypted-password).*/, ""
33
32
  cfg