oxidized 0.28.0 → 0.29.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +31 -0
  3. data/.github/workflows/codeql.yml +76 -0
  4. data/.github/workflows/publishdocker.yml +11 -2
  5. data/.github/workflows/ruby.yml +42 -0
  6. data/.github/workflows/stale.yml +16 -0
  7. data/.rubocop.yml +30 -10
  8. data/.rubocop_todo.yml +97 -43
  9. data/CHANGELOG.md +149 -2
  10. data/Dockerfile +15 -9
  11. data/README.md +63 -32
  12. data/Rakefile +2 -0
  13. data/docs/Configuration.md +49 -7
  14. data/docs/Creating-Models.md +24 -19
  15. data/docs/Hooks.md +35 -6
  16. data/docs/Model-Notes/ADVA.md +12 -0
  17. data/docs/Model-Notes/Cumulus.md +7 -1
  18. data/docs/Model-Notes/IOS.md +36 -0
  19. data/docs/Model-Notes/JunOS.md +3 -3
  20. data/docs/Model-Notes/LenovoNOS.md +29 -0
  21. data/docs/Model-Notes/LinksysSRW.md +15 -0
  22. data/docs/Model-Notes/Nokia.md +3 -0
  23. data/docs/Model-Notes/OS10.md +33 -0
  24. data/docs/Model-Notes/PanOS_API.md +28 -0
  25. data/docs/Model-Notes/README.md +2 -0
  26. data/docs/Ruby-API.md +12 -8
  27. data/docs/Sources.md +18 -0
  28. data/docs/Supported-OS-Types.md +51 -6
  29. data/docs/Troubleshooting.md +1 -1
  30. data/extra/gitdiff-msteams.sh +91 -0
  31. data/extra/nagios_check_failing_nodes.rb +6 -9
  32. data/extra/oxidized-report-git-commits +71 -14
  33. data/extra/oxidized.init +2 -5
  34. data/extra/oxidized.logrotate +1 -0
  35. data/extra/oxidized.runit +4 -1
  36. data/extra/oxidized.service +5 -8
  37. data/extra/rest_client.rb +1 -1
  38. data/extra/syslog.rb +2 -2
  39. data/lib/oxidized/cli.rb +1 -1
  40. data/lib/oxidized/config/vars.rb +5 -2
  41. data/lib/oxidized/config.rb +6 -3
  42. data/lib/oxidized/core.rb +1 -1
  43. data/lib/oxidized/hook/exec.rb +6 -6
  44. data/lib/oxidized/hook/githubrepo.rb +42 -11
  45. data/lib/oxidized/hook/slackdiff.rb +2 -2
  46. data/lib/oxidized/hook/xmppdiff.rb +45 -25
  47. data/lib/oxidized/hook.rb +4 -8
  48. data/lib/oxidized/input/exec.rb +1 -1
  49. data/lib/oxidized/input/input.rb +1 -0
  50. data/lib/oxidized/input/ssh.rb +23 -20
  51. data/lib/oxidized/input/telnet.rb +52 -44
  52. data/lib/oxidized/job.rb +1 -0
  53. data/lib/oxidized/jobs.rb +11 -6
  54. data/lib/oxidized/manager.rb +1 -0
  55. data/lib/oxidized/model/acmepacket.rb +40 -0
  56. data/lib/oxidized/model/acos.rb +3 -1
  57. data/lib/oxidized/model/acsw.rb +2 -0
  58. data/lib/oxidized/model/adtran.rb +7 -3
  59. data/lib/oxidized/model/adva.rb +68 -0
  60. data/lib/oxidized/model/aen.rb +2 -0
  61. data/lib/oxidized/model/aireos.rb +2 -0
  62. data/lib/oxidized/model/airfiber.rb +3 -1
  63. data/lib/oxidized/model/airos.rb +2 -0
  64. data/lib/oxidized/model/alteonos.rb +2 -0
  65. data/lib/oxidized/model/alvarion.rb +2 -0
  66. data/lib/oxidized/model/aos.rb +2 -0
  67. data/lib/oxidized/model/aos7.rb +2 -0
  68. data/lib/oxidized/model/aoscx.rb +98 -0
  69. data/lib/oxidized/model/aosw.rb +4 -2
  70. data/lib/oxidized/model/apc_aos.rb +2 -0
  71. data/lib/oxidized/model/arbos.rb +2 -0
  72. data/lib/oxidized/model/aricentiss.rb +2 -0
  73. data/lib/oxidized/model/asa.rb +4 -0
  74. data/lib/oxidized/model/asyncos.rb +2 -0
  75. data/lib/oxidized/model/audiocodes.rb +2 -0
  76. data/lib/oxidized/model/audiocodesmp.rb +2 -0
  77. data/lib/oxidized/model/awplus.rb +3 -1
  78. data/lib/oxidized/model/axos.rb +2 -0
  79. data/lib/oxidized/model/bdcom.rb +51 -0
  80. data/lib/oxidized/model/boss.rb +3 -1
  81. data/lib/oxidized/model/br6910.rb +2 -0
  82. data/lib/oxidized/model/c4cmts.rb +2 -0
  83. data/lib/oxidized/model/cambium.rb +2 -0
  84. data/lib/oxidized/model/cambiumepmp.rb +19 -0
  85. data/lib/oxidized/model/casa.rb +6 -1
  86. data/lib/oxidized/model/catos.rb +2 -0
  87. data/lib/oxidized/model/ciscoce.rb +14 -0
  88. data/lib/oxidized/model/cisconga.rb +2 -0
  89. data/lib/oxidized/model/ciscosma.rb +2 -0
  90. data/lib/oxidized/model/ciscosmb.rb +4 -0
  91. data/lib/oxidized/model/ciscovpn3k.rb +2 -0
  92. data/lib/oxidized/model/cnos.rb +2 -0
  93. data/lib/oxidized/model/comnetms.rb +2 -0
  94. data/lib/oxidized/model/comtrol.rb +2 -0
  95. data/lib/oxidized/model/comware.rb +17 -1
  96. data/lib/oxidized/model/coriant8600.rb +2 -0
  97. data/lib/oxidized/model/coriantgroove.rb +2 -0
  98. data/lib/oxidized/model/corianttmos.rb +2 -0
  99. data/lib/oxidized/model/cumulus.rb +60 -44
  100. data/lib/oxidized/model/datacom.rb +2 -0
  101. data/lib/oxidized/model/dcnos.rb +2 -0
  102. data/lib/oxidized/model/dellx.rb +3 -3
  103. data/lib/oxidized/model/dlink.rb +4 -1
  104. data/lib/oxidized/model/dnos.rb +2 -0
  105. data/lib/oxidized/model/eciapollo.rb +2 -0
  106. data/lib/oxidized/model/edgecos.rb +24 -2
  107. data/lib/oxidized/model/edgeos.rb +2 -0
  108. data/lib/oxidized/model/edgeswitch.rb +6 -4
  109. data/lib/oxidized/model/eltex.rb +50 -0
  110. data/lib/oxidized/model/enterasys.rb +20 -3
  111. data/lib/oxidized/model/enterasys800.rb +31 -0
  112. data/lib/oxidized/model/eos.rb +4 -1
  113. data/lib/oxidized/model/fabricos.rb +3 -1
  114. data/lib/oxidized/model/fastiron.rb +5 -2
  115. data/lib/oxidized/model/fiberdriver.rb +2 -0
  116. data/lib/oxidized/model/firebrick.rb +2 -0
  117. data/lib/oxidized/model/firelinuxos.rb +2 -0
  118. data/lib/oxidized/model/firewareos.rb +2 -0
  119. data/lib/oxidized/model/fortios.rb +26 -11
  120. data/lib/oxidized/model/fortiwlc.rb +26 -0
  121. data/lib/oxidized/model/ftos.rb +2 -0
  122. data/lib/oxidized/model/fujitsupy.rb +2 -0
  123. data/lib/oxidized/model/gaiaos.rb +42 -3
  124. data/lib/oxidized/model/gcombnps.rb +2 -0
  125. data/lib/oxidized/model/grandstream.rb +2 -0
  126. data/lib/oxidized/model/h3c.rb +42 -0
  127. data/lib/oxidized/model/hatteras.rb +4 -2
  128. data/lib/oxidized/model/hios.rb +40 -0
  129. data/lib/oxidized/model/hirschmann.rb +2 -0
  130. data/lib/oxidized/model/hpebladesystem.rb +3 -1
  131. data/lib/oxidized/model/hpemsa.rb +2 -0
  132. data/lib/oxidized/model/hpmsm.rb +2 -0
  133. data/lib/oxidized/model/ibos.rb +2 -0
  134. data/lib/oxidized/model/icotera.rb +2 -0
  135. data/lib/oxidized/model/ios.rb +15 -10
  136. data/lib/oxidized/model/iosxe.rb +1 -1
  137. data/lib/oxidized/model/iosxr.rb +2 -0
  138. data/lib/oxidized/model/ipos.rb +2 -0
  139. data/lib/oxidized/model/ironware.rb +10 -4
  140. data/lib/oxidized/model/isam.rb +2 -0
  141. data/lib/oxidized/model/junos.rb +7 -1
  142. data/lib/oxidized/model/lancom.rb +25 -0
  143. data/lib/oxidized/model/lenovonos.rb +84 -0
  144. data/lib/oxidized/model/linksyssrw.rb +73 -0
  145. data/lib/oxidized/model/linuxgeneric.rb +2 -0
  146. data/lib/oxidized/model/masteros.rb +2 -0
  147. data/lib/oxidized/model/mlnxos.rb +4 -0
  148. data/lib/oxidized/model/model.rb +35 -8
  149. data/lib/oxidized/model/mtrlrfs.rb +2 -0
  150. data/lib/oxidized/model/ndms.rb +3 -1
  151. data/lib/oxidized/model/necix.rb +32 -0
  152. data/lib/oxidized/model/netgear.rb +7 -2
  153. data/lib/oxidized/model/netonix.rb +2 -0
  154. data/lib/oxidized/model/netscaler.rb +40 -1
  155. data/lib/oxidized/model/nodegrid.rb +25 -0
  156. data/lib/oxidized/model/nos.rb +2 -0
  157. data/lib/oxidized/model/nsxconfig.rb +2 -0
  158. data/lib/oxidized/model/nsxfirewall.rb +2 -0
  159. data/lib/oxidized/model/nxos.rb +5 -2
  160. data/lib/oxidized/model/oneos.rb +2 -0
  161. data/lib/oxidized/model/openbsd.rb +11 -0
  162. data/lib/oxidized/model/opengear.rb +3 -1
  163. data/lib/oxidized/model/openwrt.rb +2 -0
  164. data/lib/oxidized/model/opnsense.rb +14 -4
  165. data/lib/oxidized/model/os10.rb +2 -0
  166. data/lib/oxidized/model/outputs.rb +2 -0
  167. data/lib/oxidized/model/panos.rb +2 -0
  168. data/lib/oxidized/model/panos_api.rb +73 -0
  169. data/lib/oxidized/model/pfsense.rb +14 -7
  170. data/lib/oxidized/model/planet.rb +2 -0
  171. data/lib/oxidized/model/powerconnect.rb +3 -3
  172. data/lib/oxidized/model/procurve.rb +4 -2
  173. data/lib/oxidized/model/purityos.rb +10 -1
  174. data/lib/oxidized/model/qtech.rb +2 -0
  175. data/lib/oxidized/model/quantaos.rb +3 -5
  176. data/lib/oxidized/model/raisecom.rb +2 -0
  177. data/lib/oxidized/model/routeros.rb +17 -2
  178. data/lib/oxidized/model/saos.rb +2 -0
  179. data/lib/oxidized/model/screenos.rb +2 -0
  180. data/lib/oxidized/model/sgos.rb +2 -0
  181. data/lib/oxidized/model/siklu.rb +2 -0
  182. data/lib/oxidized/model/slxos.rb +3 -0
  183. data/lib/oxidized/model/smartax.rb +2 -0
  184. data/lib/oxidized/model/smartcs.rb +42 -0
  185. data/lib/oxidized/model/sonicos.rb +11 -1
  186. data/lib/oxidized/model/speedtouch.rb +2 -0
  187. data/lib/oxidized/model/sros.rb +3 -1
  188. data/lib/oxidized/model/srosmd.rb +99 -0
  189. data/lib/oxidized/model/stoneos.rb +8 -2
  190. data/lib/oxidized/model/supermicro.rb +1 -1
  191. data/lib/oxidized/model/swos.rb +11 -0
  192. data/lib/oxidized/model/tdre.rb +2 -0
  193. data/lib/oxidized/model/telco.rb +2 -0
  194. data/lib/oxidized/model/timos.rb +1 -1
  195. data/lib/oxidized/model/tmos.rb +5 -2
  196. data/lib/oxidized/model/tplink.rb +4 -0
  197. data/lib/oxidized/model/trango.rb +13 -11
  198. data/lib/oxidized/model/truenas.rb +22 -0
  199. data/lib/oxidized/model/ucs.rb +2 -0
  200. data/lib/oxidized/model/viptela.rb +2 -0
  201. data/lib/oxidized/model/voltaire.rb +2 -0
  202. data/lib/oxidized/model/voss.rb +2 -0
  203. data/lib/oxidized/model/vrp.rb +3 -1
  204. data/lib/oxidized/model/vyatta.rb +2 -0
  205. data/lib/oxidized/model/weos.rb +2 -0
  206. data/lib/oxidized/model/xos.rb +6 -3
  207. data/lib/oxidized/model/yamaha.rb +59 -0
  208. data/lib/oxidized/model/zhoneolt.rb +2 -0
  209. data/lib/oxidized/model/zteolt.rb +54 -0
  210. data/lib/oxidized/model/zy1308.rb +13 -0
  211. data/lib/oxidized/model/zynos.rb +2 -0
  212. data/lib/oxidized/model/zynoscli.rb +2 -0
  213. data/lib/oxidized/model/zynosgs.rb +2 -0
  214. data/lib/oxidized/node/stats.rb +1 -0
  215. data/lib/oxidized/node.rb +16 -11
  216. data/lib/oxidized/nodes.rb +7 -6
  217. data/lib/oxidized/output/file.rb +2 -1
  218. data/lib/oxidized/output/git.rb +5 -3
  219. data/lib/oxidized/output/gitcrypt.rb +5 -8
  220. data/lib/oxidized/output/http.rb +2 -0
  221. data/lib/oxidized/source/csv.rb +1 -0
  222. data/lib/oxidized/source/http.rb +4 -0
  223. data/lib/oxidized/source/source.rb +7 -2
  224. data/lib/oxidized/source/sql.rb +15 -5
  225. data/lib/oxidized/version.rb +2 -2
  226. data/lib/oxidized/worker.rb +5 -5
  227. data/lib/oxidized.rb +1 -1
  228. data/lib/refinements.rb +43 -0
  229. data/oxidized.gemspec +22 -16
  230. metadata +120 -31
  231. data/.github/no-response.yml +0 -13
  232. data/.travis.yml +0 -10
  233. data/lib/oxidized/string.rb +0 -36
@@ -0,0 +1,68 @@
1
+ # Oxidized model for ADVA devices
2
+ #
3
+ # IMPORTANT: To get this working, cli-paging must be disabled
4
+ # for the user that is used to fetch the configuration.
5
+
6
+ class ADVA < Oxidized::Model
7
+ using Refinements
8
+
9
+ prompt /\w+\-+[#>]\s?$/
10
+ comment '# '
11
+
12
+ cmd :secret do |cfg|
13
+ cfg.gsub! /community "[^"]+"/, 'community "<hidden>"'
14
+ cfg
15
+ end
16
+
17
+ cmd :all do |cfg|
18
+ cfg.cut_both
19
+ end
20
+
21
+ cmd 'show running-config current' do |cfg|
22
+ cfg.each_line.reject { |line| line.match /^Preparing configuration file.*/ }.join
23
+ end
24
+
25
+ cmd 'show system' do |cfg|
26
+ cfg = cfg.each_line.reject { |line| line.match /(up time|local time)/i }.join
27
+
28
+ cfg = "COMMAND: show system\n\n" + cfg
29
+ cfg = comment cfg
30
+ "\n\n" + cfg
31
+ end
32
+
33
+ cmd 'network-element ne-1'
34
+
35
+ cmd 'show shelf-info' do |cfg|
36
+ cfg = "COMMAND: show shelf-info\n\n" + cfg
37
+ cfg = comment cfg
38
+ "\n\n" + cfg
39
+ end
40
+
41
+ post do
42
+ ports = []
43
+ ports_output = ''
44
+
45
+ cmd 'show ports' do |cfg|
46
+ cfg.each_line do |line|
47
+ port = line.match(/\|((access|network)[^\|]+)\|/)
48
+ ports << port if port
49
+ end
50
+ end
51
+
52
+ ports.each do |port|
53
+ port_command = 'show ' + port[2] + '-port ' + port[1]
54
+
55
+ ports_output << cmd(port_command) do |cfg|
56
+ cfg = "COMMAND: " + port_command + "\n\n" + cfg
57
+ cfg = comment cfg
58
+ "\n\n" + cfg
59
+ end
60
+ end
61
+
62
+ ports_output
63
+ end
64
+
65
+ cfg :ssh do
66
+ pre_logout 'logout'
67
+ end
68
+ end
@@ -1,4 +1,6 @@
1
1
  class AEN < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Accedian
3
5
 
4
6
  comment '# '
@@ -1,4 +1,6 @@
1
1
  class Aireos < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # AireOS (at least I think that is what it's called, hard to find data)
3
5
  # Used in Cisco WLC 5500
4
6
 
@@ -1,7 +1,9 @@
1
1
  class Airfiber < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Ubiquiti Airfiber (tested with Airfiber 11FX)
3
5
 
4
- prompt /^AF[\w\.]+#/
6
+ prompt /^AF[\w\.-]+#/i
5
7
 
6
8
  cmd :all do |cfg|
7
9
  cfg.cut_both
@@ -1,4 +1,6 @@
1
1
  class Airos < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Ubiquiti AirOS circa 5.x
3
5
 
4
6
  prompt /^[^#]+# /
@@ -1,4 +1,6 @@
1
1
  class ALTEONOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  prompt /^\(?.+\)?\s?[#>]/
3
5
 
4
6
  comment '! '
@@ -1,4 +1,6 @@
1
1
  class Alvarion < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Used in Alvarion wisp equipment
3
5
 
4
6
  # Run this command as an instance of Model so we can access node
@@ -1,4 +1,6 @@
1
1
  class AOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Alcatel-Lucent Operating System
3
5
  # used in OmniSwitch
4
6
 
@@ -1,4 +1,6 @@
1
1
  class AOS7 < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Alcatel-Lucent Operating System Version 7 (Linux based)
3
5
  # used in OmniSwitch 6900/10k
4
6
 
@@ -0,0 +1,98 @@
1
+ class Aoscx < Oxidized::Model
2
+ using Refinements
3
+
4
+ # previous command is repeated followed by "\eE", which sometimes ends up on last line
5
+ # ssh switches prompt may start with \r, followed by the prompt itself, regex ([\w\s.-]+[#>] ), which ends the line
6
+ # telnet switchs may start with various vt100 control characters, regex (\e\[24;[0-9][hH]), follwed by the prompt, followed
7
+ # by at least 3 other vt100 characters
8
+ prompt /(^\r|\e\[24;[0-9][hH])?([\w\s.-]+[#>] )($|(\e\[24;[0-9][0-9]?[hH]){3})/
9
+
10
+ comment '! '
11
+
12
+ # replace next line control sequence with a new line
13
+ expect /(\e\[1M\e\[\??\d+(;\d+)*[A-Za-z]\e\[1L)|(\eE)/ do |data, re|
14
+ data.gsub re, "\n"
15
+ end
16
+
17
+ # replace all used vt100 control sequences
18
+ expect /\e\[\??\d+(;\d+)*[A-Za-z]/ do |data, re|
19
+ data.gsub re, ''
20
+ end
21
+
22
+ expect /Press any key to continue(\e\[\??\d+(;\d+)*[A-Za-z])*$/ do
23
+ send ' '
24
+ ""
25
+ end
26
+
27
+ expect /Enter switch number/ do
28
+ send "\n"
29
+ ""
30
+ end
31
+
32
+ cmd :all do |cfg|
33
+ cfg = cfg.cut_both
34
+ cfg = cfg.gsub /^\r/, ''
35
+ # Additional filtering for elder switches sending vt100 control chars via telnet
36
+ cfg.gsub! /\e\[\??\d+(;\d+)*[A-Za-z]/, ''
37
+ # Additional filtering for power usage reporting which obviously changes over time
38
+ cfg.gsub! /^(.*AC [0-9]{3}V\/?([0-9]{3}V)?) *([0-9]{1,3}) (.*)/, '\\1 <removed> \\4'
39
+ cfg
40
+ end
41
+
42
+ cmd :secret do |cfg|
43
+ cfg.gsub! /^(snmp-server community) \S+(.*)/, '\\1 <secret hidden> \\2'
44
+ cfg.gsub! /^(snmp-server host \S+) \S+(.*)/, '\\1 <secret hidden> \\2'
45
+ cfg.gsub! /^(radius-server host \S+ key) \S+(.*)/, '\\1 <secret hidden> \\2'
46
+ cfg.gsub! /^(radius-server key).*/, '\\1 <configuration removed>'
47
+ cfg.gsub! /^(tacacs-server host \S+ key) \S+(.*)/, '\\1 <secret hidden> \\2'
48
+ cfg.gsub! /^(tacacs-server key).*/, '\\1 <secret hidden>'
49
+ cfg
50
+ end
51
+
52
+ cmd 'show version' do |cfg|
53
+ comment cfg
54
+ end
55
+
56
+ cmd 'show environment' do |cfg|
57
+ cfg.gsub! /^(LC.*\s+)\d+\s+$/, '\\1<hidden>'
58
+ cfg.gsub! /^(\d\/\d\/\d.*\s+)\d+\s+$/, '\\1<hidden>'
59
+ cfg.gsub! /^(\d+\/\S+\s+\S+\s+)\d+\.\d+\s+C(.*)/, '\\1<hidden>\\2'
60
+ cfg.gsub! /^(LC.*\s+)\d+\.\d+\s+(C.*)$/, '\\1 <hidden> \\2'
61
+ comment cfg
62
+ end
63
+
64
+ cmd 'show module' do |cfg|
65
+ comment cfg
66
+ end
67
+
68
+ cmd 'show interface transceiver' do |cfg|
69
+ comment cfg
70
+ end
71
+
72
+ cmd 'show system | exclude "Up Time" | exclude "CPU" | exclude "Memory"' do |cfg|
73
+ comment cfg
74
+ end
75
+
76
+ cmd 'show running-config'
77
+
78
+ cfg :telnet do
79
+ username /Username:/
80
+ password /Password:/
81
+ end
82
+
83
+ cfg :telnet, :ssh do
84
+ # preferred way to handle additional passwords
85
+ if vars :enable
86
+ post_login do
87
+ send "enable\n"
88
+ cmd vars(:enable)
89
+ end
90
+ end
91
+ post_login 'no page'
92
+ pre_logout "exit"
93
+ end
94
+
95
+ cfg :ssh do
96
+ pty_options(chars_wide: 1000)
97
+ end
98
+ end
@@ -1,4 +1,6 @@
1
1
  class AOSW < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # AOSW Aruba Wireless, IAP, Instant Controller and Mobility Access Switches
3
5
  # Used in Alcatel OAW-4750 WLAN controller
4
6
  # Also Dell controllers
@@ -9,7 +11,7 @@ class AOSW < Oxidized::Model
9
11
  # Support for Mobility Access Switches tested with S2500-48P & S2500-24P running 7.4.1.4_54199 and S2500-24P running 7.4.1.7_57823
10
12
  # All IAPs connected to a Instant Controller will have the same config output. Only the controller needs to be monitored.
11
13
 
12
- comment '# '
14
+ comment '# '
13
15
  prompt /^([\w\(:.@-]+(\)?\s?)[#>]\s?)$/
14
16
 
15
17
  cmd :all do |cfg|
@@ -39,7 +41,7 @@ class AOSW < Oxidized::Model
39
41
  end
40
42
 
41
43
  cmd 'show version' do |cfg|
42
- cfg = cfg.each_line.reject { |line| line.match /(Switch|AP) uptime/i }
44
+ cfg = cfg.each_line.reject { |line| line.match(/(Switch|AP) uptime/i) || line.match(/Reboot Time and Cause/i) }
43
45
  rstrip_cfg comment cfg.join
44
46
  end
45
47
 
@@ -1,4 +1,6 @@
1
1
  class Apc_aos < Oxidized::Model # rubocop:disable Naming/ClassAndModuleCamelCase
2
+ using Refinements
3
+
2
4
  cmd 'config.ini' do |cfg|
3
5
  cfg.gsub! /^; Configuration file, generated on.*/, ''
4
6
  end
@@ -1,4 +1,6 @@
1
1
  class ARBOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Arbor OS model #
3
5
 
4
6
  prompt /^[\S\s]+\n([\w.@-]+[:\/#>]+)\s?$/
@@ -4,6 +4,8 @@
4
4
  # 0 SSE-G48-TG4 (P2-01) 1.0.16-9
5
5
 
6
6
  class AricentISS < Oxidized::Model
7
+ using Refinements
8
+
7
9
  prompt /^(\e\[27m)?[ \r]*[\w-]+# ?$/
8
10
 
9
11
  cfg :ssh do
@@ -1,4 +1,6 @@
1
1
  class ASA < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Cisco ASA model #
3
5
  # Only SSH supported for the sake of security
4
6
 
@@ -34,6 +36,8 @@ class ASA < Oxidized::Model
34
36
  # avoid commits due to uptime / ixo-router01 up 2 mins 28 secs / ixo-router01 up 1 days 2 hours
35
37
  cfg = cfg.each_line.reject { |line| line.match /(\s+up\s+\d+\s+)|(.*days.*)/ }
36
38
  cfg = cfg.join
39
+ cfg.gsub! /^Configuration has not been modified since last system restart.*\n/, ''
40
+ cfg.gsub! /^Configuration last modified by.*\n/, ''
37
41
  comment cfg
38
42
  end
39
43
 
@@ -1,4 +1,6 @@
1
1
  class AsyncOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # ESA prompt "(mail.example.com)> " or "mail.example.com> "
3
5
  prompt /^\r*([(]?[\w. ]+[)]?[#>]\s+)$/
4
6
  comment '! '
@@ -1,4 +1,6 @@
1
1
  class AudioCodes < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Pull config from AudioCodes Mediant devices from version > 7.0
3
5
 
4
6
  prompt /^\r?([\w.@() -]+[#>]\s?)$/
@@ -1,4 +1,6 @@
1
1
  class AudioCodesMP < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # AudioCodes MediaPack MP1xx and Mediant 1000 devices (firmware v4.xx, v5.xx, v6.xx) by pedjajks@gmail.com
3
5
 
4
6
  prompt /^\/\w*>/
@@ -1,4 +1,6 @@
1
1
  class AWPlus < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Allied Telesis Alliedware Plus Model#
3
5
  # https://www.alliedtelesis.com/products/software/AlliedWare-Plus
4
6
 
@@ -51,7 +53,7 @@ class AWPlus < Oxidized::Model
51
53
  line.match(/Current software\s*:.*/) ||
52
54
  line.match(/Software version\s*:.*/) ||
53
55
  line.match(/Build date\s*:.*/)
54
- } .join
56
+ }.join
55
57
  end
56
58
 
57
59
  # Actually get the devices running config#
@@ -1,4 +1,6 @@
1
1
  class AxOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  prompt /(\x1b\[\?7h)?([\w.@()-]+[#]\s?)$/
3
5
  comment '! '
4
6
 
@@ -0,0 +1,51 @@
1
+ class BDCOM < Oxidized::Model
2
+ using Refinements
3
+
4
+ comment '! '
5
+
6
+ cmd :secret do |cfg|
7
+ cfg.gsub!(/password \d+ (\S+).*/, '<secret removed>')
8
+ cfg.gsub!(/community (\S+)/, 'community <hidden>')
9
+ cfg
10
+ end
11
+
12
+ cmd :all do |cfg|
13
+ cfg.each_line.to_a[0..-2].join
14
+ end
15
+
16
+ cmd 'show running-config'
17
+
18
+ cmd 'show version' do |cfg|
19
+ cfg.gsub! /(\s*uptime is\s*)[0-9:]+/, '\1 <removed>'
20
+ cfg.gsub! /(\s*current time:\s*)[0-9-]+\s+[0-9:]+/, '\1 <removed>'
21
+ cfg.gsub! /(\s*at)\s+[0-9-]+\s+[0-9:]+(,\s*uptime\s+[0-9:]+)?/, '\1 <removed>'
22
+ comment cfg
23
+ end
24
+
25
+ cmd 'show power-status' do |cfg|
26
+ comment cfg
27
+ end
28
+
29
+ cmd 'show fan-status' do |cfg|
30
+ comment cfg
31
+ end
32
+
33
+ cfg :telnet do
34
+ username /^Username:/
35
+ password /^Password:/
36
+ end
37
+
38
+ cfg :telnet, :ssh do
39
+ post_login do
40
+ if vars(:enable) == true
41
+ cmd "enable"
42
+ elsif vars(:enable)
43
+ cmd "enable", /^[pP]assword:/
44
+ cmd vars(:enable)
45
+ end
46
+ end
47
+
48
+ post_login 'terminal length 0'
49
+ pre_logout 'exit'
50
+ end
51
+ end
@@ -1,11 +1,13 @@
1
1
  class Boss < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Extreme Baystack Operating System Software(BOSS)
3
5
  # Created by danielcoxman@gmail.com
4
6
  # May 15, 2017
5
7
  # This was tested on ers3510, ers5530, ers4850, ers5952
6
8
  # ssh and telnet were tested with banner and without
7
9
 
8
- comment '! '
10
+ comment '! '
9
11
 
10
12
  prompt /^[^\s#>]+[#>]$/
11
13
 
@@ -1,4 +1,6 @@
1
1
  class BR6910 < Oxidized::Model
2
+ using Refinements
3
+
2
4
  prompt /^([\w.@()-]+[#>]\s?)$/
3
5
  comment '! '
4
6
 
@@ -1,4 +1,6 @@
1
1
  class C4CMTS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Arris C4 CMTS
3
5
 
4
6
  prompt /^([\w.@:\/-]+[#>]\s?)$/
@@ -1,4 +1,6 @@
1
1
  class Cambium < Oxidized::Model
2
+ using Refinements
3
+
2
4
  cfg_cb = lambda do
3
5
  c_page = @m.click @m_page.link_with(text: "Configuration")
4
6
  u_page = @m.click c_page.link_with(text: "Unit Settings")
@@ -0,0 +1,19 @@
1
+ class CambiumePMP < Oxidized::Model
2
+ using Refinements
3
+
4
+ # Cambium ePMP Radios
5
+
6
+ prompt /.*>/
7
+
8
+ cmd :all do |cfg|
9
+ cfg.cut_both
10
+ end
11
+
12
+ pre do
13
+ cmd 'config show json'
14
+ end
15
+
16
+ cfg :ssh do
17
+ pre_logout 'exit'
18
+ end
19
+ end
@@ -1,4 +1,6 @@
1
1
  class Casa < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Casa Systems CMTS
3
5
 
4
6
  prompt /^([\w.@()-]+[#>]\s?)$/
@@ -10,6 +12,7 @@ class Casa < Oxidized::Model
10
12
  cfg.gsub! /^(console-password encrypted) \S+/, '\\1 <secret hidden>'
11
13
  cfg.gsub! /^(password encrypted) \S+/, '\\1 <secret hidden>'
12
14
  cfg.gsub! /^(tacacs-server key) \S+/, '\\1 <secret hidden>'
15
+ cfg.gsub! /^( ip rip authentication secret) \S+/, '\\1 <secret hidden>'
13
16
  cfg
14
17
  end
15
18
 
@@ -18,7 +21,9 @@ class Casa < Oxidized::Model
18
21
  end
19
22
 
20
23
  cmd 'show system' do |cfg|
21
- comment cfg.each_line.reject { |line| line.match /^\s+System (Time|Uptime): / }.join
24
+ cfg.gsub! /Uptime:.*/, 'Uptime: <removed>'
25
+ cfg.gsub! /Time:.*/, 'Time: <removed>'
26
+ comment cfg
22
27
  end
23
28
 
24
29
  cmd 'show version' do |cfg|
@@ -1,4 +1,6 @@
1
1
  class Catos < Oxidized::Model
2
+ using Refinements
3
+
2
4
  prompt /^[\w.@-]+>\s?(\(enable\) )?$/
3
5
  comment '# '
4
6
 
@@ -0,0 +1,14 @@
1
+ # Supporting Cisco Catalyst Express Switches and IOS using the basic web interface
2
+ class CiscoCE < Oxidized::Model
3
+ using Refinements
4
+
5
+ cmd "/level/15/exec/-/show/startup-config" do |cfg|
6
+ output = cfg.gsub(/\A.+<DL>(.+)<\/DL>.+\z/m, '\1') # Strip configuration file from within HTML response.
7
+ output
8
+ end
9
+
10
+ cfg :http do
11
+ @username = @node.auth[:username]
12
+ @password = @node.auth[:password]
13
+ end
14
+ end
@@ -1,4 +1,6 @@
1
1
  class CiscoNGA < Oxidized::Model
2
+ using Refinements
3
+
2
4
  comment '# '
3
5
  prompt /([\w.@-]+[#>]\s?)$/
4
6
 
@@ -1,4 +1,6 @@
1
1
  class CiscoSMA < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # SMA prompt "mail.example.com> "
3
5
  prompt /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/
4
6
  comment '! '
@@ -1,4 +1,6 @@
1
1
  class CiscoSMB < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Cisco Small Business 300, 500, and ESW2 series switches
3
5
  # http://www.cisco.com/c/en/us/support/switches/small-business-300-series-managed-switches/products-release-notes-list.html
4
6
 
@@ -26,6 +28,8 @@ class CiscoSMB < Oxidized::Model
26
28
  end
27
29
 
28
30
  cmd 'show version' do |cfg|
31
+ cfg.gsub! /.*Uptime for this control.*/, ''
32
+ cfg.gsub! /.*System restarted.*/, ''
29
33
  cfg.gsub! /uptime is\ .+/, '<uptime removed>'
30
34
  comment cfg
31
35
  end
@@ -1,4 +1,6 @@
1
1
  class CiscoVPN3k < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Used in Cisco VPN3000 concentrators
3
5
  # it have buggy code 227 reply with whitespace before trailing bracket
4
6
  # "227 Passive mode OK (172,16,0,9,4,9 )"
@@ -1,5 +1,7 @@
1
1
  # model for Centec Networks CNOS based switches
2
2
  class CNOS < Oxidized::Model
3
+ using Refinements
4
+
3
5
  comment '! '
4
6
 
5
7
  cmd :all do |cfg|
@@ -1,4 +1,6 @@
1
1
  class ComnetMS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Comnet Microsemi Switch
3
5
  prompt /^\r?([\w.@()-]+[#>]\s?)$/
4
6
  comment '! '
@@ -1,4 +1,6 @@
1
1
  class Comtrol < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Used in Comtrol Industrial Switches, such as RocketLinx ES8510
3
5
 
4
6
  # Typical prompt "<hostname>#"
@@ -1,5 +1,6 @@
1
1
  class Comware < Oxidized::Model
2
2
  # HP (A-series)/H3C/3Com Comware
3
+ using Refinements
3
4
 
4
5
  # sometimes the prompt might have a leading nul or trailing ASCII Bell (^G)
5
6
  prompt /^\0*(<[\w.-]+>).?$/
@@ -31,6 +32,15 @@ class Comware < Oxidized::Model
31
32
  end
32
33
 
33
34
  cfg :telnet, :ssh do
35
+ # handle enable passwords
36
+ post_login do
37
+ if vars(:enable) == true
38
+ cmd "super"
39
+ elsif vars(:enable)
40
+ cmd "super", /^ [pP]assword:/
41
+ cmd vars(:enable)
42
+ end
43
+ end
34
44
  # enable command-line mode on SMB comware switches (HP V1910, V1920)
35
45
  # autodetection is hard, because the 'summary' command is paged, and
36
46
  # the pager cannot be disabled before _cmdline-mode on.
@@ -41,10 +51,16 @@ class Comware < Oxidized::Model
41
51
  cmd 'y', /(#{@node.prompt}|input password)/
42
52
  cmd vars(:comware_cmdline)
43
53
 
44
- # HP V1950
54
+ # HP V1950 r2432P06
45
55
  cmd 'xtd-cli-mode on', /(#{@node.prompt}|Continue)/
46
56
  cmd 'y', /(#{@node.prompt}|input password)/
47
57
  cmd vars(:comware_cmdline)
58
+
59
+ # HP V1950 OS r3208 (v7.1)
60
+ # HPE Office Connect 1950
61
+ cmd 'xtd-cli-mode', /(#{@node.prompt}|Continue|Switch)/
62
+ cmd 'y', /(#{@node.prompt}|input password|Password:)/
63
+ cmd vars(:comware_cmdline)
48
64
  end
49
65
  end
50
66
 
@@ -1,4 +1,6 @@
1
1
  class Coriant8600 < Oxidized::Model
2
+ using Refinements
3
+
2
4
  comment '# '
3
5
 
4
6
  prompt /^[^\s#>]+[#>]$/
@@ -1,4 +1,6 @@
1
1
  class CoriantGroove < Oxidized::Model
2
+ using Refinements
3
+
2
4
  comment '# '
3
5
 
4
6
  prompt /^(\w+@.*>\s*)$/
@@ -1,4 +1,6 @@
1
1
  class CoriantTmos < Oxidized::Model
2
+ using Refinements
3
+
2
4
  comment '# '
3
5
 
4
6
  prompt /^[^\s#]+#\s$/