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
@@ -1,4 +1,6 @@
1
1
  class Cumulus < Oxidized::Model
2
+ using Refinements
3
+
2
4
  prompt /^((\w*)@(.*)):/
3
5
  comment '# '
4
6
 
@@ -11,72 +13,86 @@ class Cumulus < Oxidized::Model
11
13
  cfg.cut_both
12
14
  end
13
15
 
16
+ cmd :secret do |cfg|
17
+ cfg.gsub! /password (\S+)/, 'password <hidden>'
18
+ cfg
19
+ end
20
+
14
21
  # show the persistent configuration
15
22
  pre do
16
- # Set FRR or Quagga in config
17
- routing_daemon = vars(:cumulus_routing_daemon) ? vars(:cumulus_routing_daemon).downcase : 'quagga'
18
- routing_conf_file = routing_daemon == 'frr' ? 'frr.conf' : 'Quagga.conf'
19
- routing_daemon_shout = routing_daemon.upcase
23
+ use_nclu = vars(:cumulus_use_nclu) || false
20
24
 
21
- cfg = add_comment 'THE HOSTNAME'
22
- cfg += cmd 'cat /etc/hostname'
25
+ if use_nclu
26
+ cfg = cmd 'net show configuration commands'
27
+ else
28
+ # Set FRR or Quagga in config
29
+ routing_daemon = vars(:cumulus_routing_daemon) ? vars(:cumulus_routing_daemon).downcase : 'quagga'
30
+ routing_conf_file = routing_daemon == 'frr' ? 'frr.conf' : 'Quagga.conf'
31
+ routing_daemon_shout = routing_daemon.upcase
23
32
 
24
- cfg += add_comment 'THE HOSTS'
25
- cfg += cmd 'cat /etc/hosts'
33
+ cfg = add_comment 'THE HOSTNAME'
34
+ cfg += cmd 'cat /etc/hostname'
26
35
 
27
- cfg += add_comment 'THE INTERFACES'
28
- cfg += cmd 'grep -r "" /etc/network/interface* | cut -d "/" -f 4-'
36
+ cfg += add_comment 'THE HOSTS'
37
+ cfg += cmd 'cat /etc/hosts'
29
38
 
30
- cfg += add_comment 'RESOLV.CONF'
31
- cfg += cmd 'cat /etc/resolv.conf'
39
+ cfg += add_comment 'THE INTERFACES'
40
+ cfg += cmd 'grep -r "" /etc/network/interface* | cut -d "/" -f 4-'
32
41
 
33
- cfg += add_comment 'NTP.CONF'
34
- cfg += cmd 'cat /etc/ntp.conf'
42
+ cfg += add_comment 'RESOLV.CONF'
43
+ cfg += cmd 'cat /etc/resolv.conf'
35
44
 
36
- cfg += add_comment 'SNMP settings'
37
- cfg += cmd 'cat /etc/snmp/snmpd.conf'
45
+ cfg += add_comment 'NTP.CONF'
46
+ cfg += cmd 'cat /etc/ntp.conf'
38
47
 
39
- cfg += add_comment "#{routing_daemon_shout} DAEMONS"
40
- cfg += cmd "cat /etc/#{routing_daemon}/daemons"
48
+ cfg += add_comment 'SNMP settings'
49
+ cfg += cmd 'cat /etc/snmp/snmpd.conf'
41
50
 
42
- cfg += add_comment "#{routing_daemon_shout} ZEBRA"
43
- cfg += cmd "cat /etc/#{routing_daemon}/zebra.conf"
51
+ cfg += add_comment "#{routing_daemon_shout} DAEMONS"
52
+ cfg += cmd "cat /etc/#{routing_daemon}/daemons"
44
53
 
45
- cfg += add_comment "#{routing_daemon_shout} BGP"
46
- cfg += cmd "cat /etc/#{routing_daemon}/bgpd.conf"
54
+ cfg += add_comment "#{routing_daemon_shout} ZEBRA"
55
+ cfg += cmd "cat /etc/#{routing_daemon}/zebra.conf"
47
56
 
48
- cfg += add_comment "#{routing_daemon_shout} OSPF"
49
- cfg += cmd "cat /etc/#{routing_daemon}/ospfd.conf"
57
+ cfg += add_comment "#{routing_daemon_shout} BGP"
58
+ cfg += cmd "cat /etc/#{routing_daemon}/bgpd.conf"
50
59
 
51
- cfg += add_comment "#{routing_daemon_shout} OSPF6"
52
- cfg += cmd "cat /etc/#{routing_daemon}/ospf6d.conf"
60
+ cfg += add_comment "#{routing_daemon_shout} OSPF"
61
+ cfg += cmd "cat /etc/#{routing_daemon}/ospfd.conf"
53
62
 
54
- cfg += add_comment "#{routing_daemon_shout} CONF"
55
- cfg += cmd "cat /etc/#{routing_daemon}/#{routing_conf_file}"
63
+ cfg += add_comment "#{routing_daemon_shout} OSPF6"
64
+ cfg += cmd "cat /etc/#{routing_daemon}/ospf6d.conf"
56
65
 
57
- cfg += add_comment 'MOTD'
58
- cfg += cmd 'cat /etc/motd'
66
+ cfg += add_comment "#{routing_daemon_shout} CONF"
67
+ cfg += cmd "cat /etc/#{routing_daemon}/#{routing_conf_file}"
59
68
 
60
- cfg += add_comment 'PASSWD'
61
- cfg += cmd 'cat /etc/passwd'
69
+ cfg += add_comment 'MOTD'
70
+ cfg += cmd 'cat /etc/motd'
62
71
 
63
- cfg += add_comment 'SWITCHD'
64
- cfg += cmd 'cat /etc/cumulus/switchd.conf'
72
+ cfg += add_comment 'PASSWD'
73
+ cfg += cmd 'cat /etc/passwd'
65
74
 
66
- cfg += add_comment 'PORTS'
67
- cfg += cmd 'cat /etc/cumulus/ports.conf'
75
+ cfg += add_comment 'SWITCHD'
76
+ cfg += cmd 'cat /etc/cumulus/switchd.conf'
68
77
 
69
- cfg += add_comment 'TRAFFIC'
70
- cfg += cmd 'cat /etc/cumulus/datapath/traffic.conf'
78
+ cfg += add_comment 'PORTS'
79
+ cfg += cmd 'cat /etc/cumulus/ports.conf'
71
80
 
72
- cfg += add_comment 'ACL'
73
- cfg += cmd 'cat /etc/cumulus/acl/policy.conf'
81
+ cfg += add_comment 'TRAFFIC'
82
+ cfg += cmd 'cat /etc/cumulus/datapath/traffic.conf'
74
83
 
75
- cfg += add_comment 'VERSION'
76
- cfg += cmd 'cat /etc/cumulus/etc.replace/os-release'
84
+ cfg += add_comment 'ACL'
85
+ cfg += cmd 'cat /etc/cumulus/acl/policy.conf'
77
86
 
78
- cfg += add_comment 'License'
79
- cfg += cmd 'cl-license'
87
+ cfg += add_comment 'DHCP-RELAY'
88
+ cfg += cmd 'cat /etc/default/isc-dhcp-relay'
89
+
90
+ cfg += add_comment 'VERSION'
91
+ cfg += cmd 'cat /etc/cumulus/etc.replace/os-release'
92
+
93
+ cfg += add_comment 'License'
94
+ cfg += cmd 'cl-license'
95
+ end
80
96
 
81
97
  cfg
82
98
  end
@@ -1,4 +1,6 @@
1
1
  class DataCom < Oxidized::Model
2
+ using Refinements
3
+
2
4
  comment '! '
3
5
 
4
6
  expect /^--More--\s+$/ do |data, re|
@@ -5,6 +5,8 @@
5
5
  # Developed against SNR S2950-24G 7.0.3.5
6
6
 
7
7
  class DCNOS < Oxidized::Model
8
+ using Refinements
9
+
8
10
  comment '! '
9
11
 
10
12
  cmd :all do |cfg|
@@ -1,4 +1,6 @@
1
1
  class DellX < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Used in Dell X-Series Switches
3
5
 
4
6
  prompt /[#>]$/
@@ -20,9 +22,7 @@ class DellX < Oxidized::Model
20
22
  end
21
23
 
22
24
  cmd 'show version' do |cfg|
23
- if @stackable.nil?
24
- @stackable = true if cfg =~ /(U|u)nit\s/
25
- end
25
+ @stackable = true if @stackable.nil? && (cfg =~ /(U|u)nit\s/)
26
26
  cfg = cfg.split("\n").reject { |line| line[/Up\sTime/] }
27
27
  comment cfg.join("\n") + "\n"
28
28
  end
@@ -1,5 +1,8 @@
1
1
  class Dlink < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # D-LINK Switches
5
+ # Add support dgs 1100 series (tested only with dgs-1100-10/me)
3
6
 
4
7
  prompt /^(\r*[\w\s.@()\/:-]+[#>]\s?)$/
5
8
  comment '# '
@@ -26,7 +29,7 @@ class Dlink < Oxidized::Model
26
29
  cmd 'show config current'
27
30
 
28
31
  cfg :telnet do
29
- username /\r*[Uu]ser[Nn]ame:/
32
+ username /\r*([\w\s.@()\/:-]+)?([Uu]ser[Nn]ame|[Ll]ogin):/
30
33
  password /\r*[Pp]ass[Ww]ord:/
31
34
  end
32
35
 
@@ -1,4 +1,6 @@
1
1
  class DNOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Force10 DNOS model #
3
5
 
4
6
  comment '! '
@@ -2,6 +2,8 @@
2
2
  # Tested on OPT9608 systems via SSH and telnet
3
3
 
4
4
  class ECIapollo < Oxidized::Model
5
+ using Refinements
6
+
5
7
  prompt /^([\w.@()-]+[#>]\s?)$/
6
8
  comment '# '
7
9
 
@@ -1,6 +1,14 @@
1
1
  class EdgeCOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  comment '! '
3
5
 
6
+ # Handle pager for ES3526XA-V2
7
+ expect /^---More---.*$/ do |data, re|
8
+ send ' '
9
+ data.sub re, ''
10
+ end
11
+
4
12
  cmd :secret do |cfg|
5
13
  cfg.gsub!(/password \d+ (\S+).*/, '<secret removed>')
6
14
  cfg.gsub!(/community (\S+)/, 'community <hidden>')
@@ -8,10 +16,18 @@ class EdgeCOS < Oxidized::Model
8
16
  end
9
17
 
10
18
  cmd :all do |cfg|
11
- cfg.each_line.to_a[0..-2].join
19
+ # Do not show errors for commands that are not supported on some devices
20
+ cfg.gsub! /^(% Invalid input detected at '\^' marker\.|^\s+\^)$/, ''
21
+ # Handle pager for ES3526XA-V2
22
+ cfg.gsub! /^([\b]{10}\s{10}[\b]{10})/, ''
23
+ cfg.cut_both
12
24
  end
13
25
 
14
- cmd 'show running-config'
26
+ cmd 'show running-config' do |cfg|
27
+ # Remove "building running-config, please wait..." message
28
+ cfg.gsub! /^Building running configuration.*\n/, ''
29
+ cfg.cut_head
30
+ end
15
31
 
16
32
  cmd 'show system' do |cfg|
17
33
  cfg.gsub! /^.*\sUp Time\s*:.*\n/i, ''
@@ -20,6 +36,7 @@ class EdgeCOS < Oxidized::Model
20
36
  end
21
37
 
22
38
  cmd 'show version' do |cfg|
39
+ cfg.gsub! /^.*\suptime is.*\n/i, ''
23
40
  comment cfg
24
41
  end
25
42
 
@@ -43,7 +60,12 @@ class EdgeCOS < Oxidized::Model
43
60
  end
44
61
 
45
62
  cfg :telnet, :ssh do
63
+ post_login do
64
+ send "enable\n" if vars(:enable) == true
65
+ end
46
66
  post_login 'terminal length 0'
67
+ post_login 'terminal width 300'
68
+ pre_logout 'exit' if vars(:enable) == true
47
69
  pre_logout 'exit'
48
70
  end
49
71
  end
@@ -1,4 +1,6 @@
1
1
  class Edgeos < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # EdgeOS #
3
5
 
4
6
  prompt /@.*?:~\$\s/
@@ -1,4 +1,6 @@
1
1
  class EdgeSwitch < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Ubiquiti EdgeSwitch #
3
5
 
4
6
  comment '!'
@@ -16,11 +18,11 @@ class EdgeSwitch < Oxidized::Model
16
18
 
17
19
  cfg :telnet, :ssh do
18
20
  post_login do
19
- if vars :enable
20
- send "enable\n"
21
+ if vars(:enable) == true
22
+ cmd "enable"
23
+ elsif vars(:enable)
24
+ cmd "enable", /^[pP]assword:/
21
25
  cmd vars(:enable)
22
- else
23
- cmd 'enable'
24
26
  end
25
27
  cmd 'terminal length 0'
26
28
  end
@@ -0,0 +1,50 @@
1
+ class Eltex < Oxidized::Model
2
+ using Refinements
3
+
4
+ # Tested with MES2324FB Version: 4.0.7.1 Build: 37 (master)
5
+
6
+ prompt /^\s?[\w.@\(\)-]+[#>]\s?$/
7
+ comment '! '
8
+
9
+ cmd :all do |cfg|
10
+ cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
11
+ cfg.cut_both
12
+ end
13
+
14
+ cmd :secret do |cfg|
15
+ cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
16
+ cfg.gsub! /^(enable (password|secret)( level \d+)? \d) .+/, '\\1 <secret hidden>'
17
+ cfg.gsub! /^(\s+(?:password|secret)) (?:\d )?\S+/, '\\1 <secret hidden>'
18
+ cfg.gsub! /^(tacacs-server (.+ )?key) .+/, '\\1 <secret hidden>'
19
+ cfg.gsub! /^((tacacs|radius) server [^\n]+\n(\s+[^\n]+\n)*\s+key) [^\n]+$/m, '\1 <secret hidden>'
20
+ cfg.gsub! /username (\S+) privilege (\d+) (\S+).*/, '<secret hidden>'
21
+ cfg.gsub! /^username \S+ password \d \S+/, '<secret hidden>'
22
+ cfg.gsub! /^enable password \d \S+/, '<secret hidden>'
23
+ cfg.gsub! /wpa-psk ascii \d \S+/, '<secret hidden>'
24
+ cfg
25
+ end
26
+
27
+ cmd 'show running-config' do |cfg|
28
+ cfg
29
+ end
30
+
31
+ cfg :telnet do
32
+ username /^(User Name):/
33
+ password /^Password:/
34
+ end
35
+
36
+ cfg :telnet, :ssh do
37
+ # preferred way to handle additional passwords
38
+ post_login do
39
+ if vars(:enable) == true
40
+ cmd "enable"
41
+ elsif vars(:enable)
42
+ cmd "enable", /^[pP]assword:/
43
+ cmd vars(:enable)
44
+ end
45
+ end
46
+ post_login 'terminal datadump'
47
+ pre_logout 'disable'
48
+ pre_logout 'exit'
49
+ end
50
+ end
@@ -1,9 +1,17 @@
1
1
  class Enterasys < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Enterasys B3/C3 models #
3
5
 
4
- prompt /^.+\w\(su\)->\s?$/
6
+ prompt /^.+\w\((su|rw)\)->\s?$/
7
+
8
+ comment '!'
5
9
 
6
- comment '!'
10
+ # Handle paging
11
+ expect /^--More--.*$/ do |data, re|
12
+ send ' '
13
+ data.sub re, ''
14
+ end
7
15
 
8
16
  cmd :all do |cfg|
9
17
  cfg.each_line.to_a[2..-3].map { |line| line.delete("\r").rstrip }.join("\n") + "\n"
@@ -13,6 +21,10 @@ class Enterasys < Oxidized::Model
13
21
  comment cfg
14
22
  end
15
23
 
24
+ cmd 'show version' do |cfg|
25
+ comment cfg
26
+ end
27
+
16
28
  cmd 'show config' do |cfg|
17
29
  cfg.gsub! /^This command shows non-default configurations only./, ''
18
30
  cfg.gsub! /^Use 'show config all' to show both default and non-default configurations./, ''
@@ -22,7 +34,12 @@ class Enterasys < Oxidized::Model
22
34
  cfg
23
35
  end
24
36
 
25
- cfg :ssh do
37
+ cfg :telnet do
38
+ username /^Username:/i
39
+ password /^Password:/i
40
+ end
41
+
42
+ cfg :telnet, :ssh do
26
43
  pre_logout 'exit'
27
44
  end
28
45
  end
@@ -0,0 +1,31 @@
1
+ class Enterasys800 < Oxidized::Model
2
+ using Refinements
3
+
4
+ # Enterasys 800 models #
5
+ # Tested with 08H20G4-24 Fast Ethernet Switch Firmware: Build 01.01.01.0017
6
+ comment '# '
7
+
8
+ prompt /([\w \(:.@-]+[#>]\s?)$/
9
+
10
+ cfg :telnet do
11
+ username /UserName:/
12
+ password /PassWord:/
13
+ end
14
+
15
+ cfg :telnet do
16
+ post_login 'disable clipaging'
17
+ end
18
+
19
+ cfg :telnet do
20
+ pre_logout 'logout'
21
+ end
22
+
23
+ cmd :all do |cfg|
24
+ cfg = cfg.cut_both
25
+ cfg = cfg.gsub /^[\r\n]|^\s\s\s/, ''
26
+ cfg = cfg.gsub /Command: show config effective/, ''
27
+ cfg
28
+ end
29
+
30
+ cmd 'show config effective'
31
+ end
@@ -1,7 +1,9 @@
1
1
  class EOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Arista EOS model #
3
5
 
4
- prompt /^.+[#>]\s?$/
6
+ prompt /^.+[#>]$/
5
7
 
6
8
  comment '! '
7
9
 
@@ -14,6 +16,7 @@ class EOS < Oxidized::Model
14
16
  cfg.gsub! /(secret \w+) (\S+).*/, '\\1 <secret hidden>'
15
17
  cfg.gsub! /(password \d+) (\S+).*/, '\\1 <secret hidden>'
16
18
  cfg.gsub! /^(enable secret).*/, '\\1 <configuration removed>'
19
+ cfg.gsub! /^(service unsupported-transceiver).*/, '\\1 <license key removed>'
17
20
  cfg.gsub! /^(tacacs-server key \d+).*/, '\\1 <configuration removed>'
18
21
  cfg.gsub! /( {6}key) (\h+ 7) (\h+).*/, '\\1 <secret hidden>'
19
22
  cfg
@@ -1,4 +1,6 @@
1
1
  class FabricOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Brocade Fabric OS model #
3
5
  ## FIXME: Only ssh exec mode support, no telnet, no ssh screenscraping
4
6
 
@@ -6,7 +8,7 @@ class FabricOS < Oxidized::Model
6
8
  comment '# '
7
9
 
8
10
  cmd 'chassisShow' do |cfg|
9
- comment cfg.each_line.reject { |line| line.match(/Time Awake:/) || line.match(/Power Usage \(Watts\):/) || line.match(/Time Alive:/) || line.match(/Update:/) }.join
11
+ comment cfg.each_line.reject { |line| line.match(/Time Awake:/) || line.match(/Power Usage \(Watts\):/) || line.match(/Power Usage:/) || line.match(/Time Alive:/) || line.match(/Update:/) }.join
10
12
  end
11
13
 
12
14
  cmd 'configShow -all' do |cfg|
@@ -1,4 +1,6 @@
1
1
  class FastIron < Oxidized::Model
2
+ using Refinements
3
+
2
4
  prompt /^([\w.@()-]+[#>]\s?)$/
3
5
  comment '! '
4
6
 
@@ -46,7 +48,7 @@ class FastIron < Oxidized::Model
46
48
  cmd 'show running-config'
47
49
 
48
50
  cfg :telnet do
49
- username /^.* login: /
51
+ username /^(.* login|Username): /
50
52
  password /^Password:/
51
53
  end
52
54
 
@@ -56,11 +58,12 @@ class FastIron < Oxidized::Model
56
58
  if vars(:enable) == true
57
59
  cmd "enable"
58
60
  elsif vars(:enable)
59
- cmd "enable", /^[pP]assword:/
61
+ cmd "enable", /[pP]assword:/
60
62
  cmd vars(:enable)
61
63
  end
62
64
  end
63
65
  post_login 'skip-page-display'
64
66
  pre_logout 'exit'
67
+ pre_logout 'exit'
65
68
  end
66
69
  end
@@ -1,4 +1,6 @@
1
1
  class FiberDriver < Oxidized::Model
2
+ using Refinements
3
+
2
4
  prompt /\w+#/
3
5
  comment "! "
4
6
 
@@ -1,4 +1,6 @@
1
1
  class Firebrick < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Firebrick #
3
5
  prompt /\x0a\x1b\x5b\x32\x4b\x0d.*>\s/
4
6
 
@@ -1,4 +1,6 @@
1
1
  class FireLinuxOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Fire Linux OS is what the new FTD (FirePOWER) series devices from Cisco run. At the backend, it's mostly identical to ASA's.
3
5
 
4
6
  prompt /^[#>]\(?.+\)?\s?/
@@ -1,4 +1,6 @@
1
1
  class FirewareOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  prompt /^\[?\w*\]?\w*?(<\w*>)?(#|>)\s*$/
3
5
  comment '-- '
4
6
 
@@ -1,4 +1,6 @@
1
1
  class FortiOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  comment '# '
3
5
 
4
6
  prompt /^([-\w.~]+(\s[(\w\-.)]+)?~?\s?[#>$]\s?)$/
@@ -21,7 +23,7 @@ class FortiOS < Oxidized::Model
21
23
  cfg.gsub! /(set (?:passwd|password|key|group-password|auth-password-l1|auth-password-l2|rsso|history0|history1)) .+/, '\\1 <configuration removed>'
22
24
  cfg.gsub! /(set md5-key [0-9]+) .+/, '\\1 <configuration removed>'
23
25
  cfg.gsub! /(set private-key ).*?-+END (ENCRYPTED|RSA|OPENSSH) PRIVATE KEY-+\n?"$/m, '\\1<configuration removed>'
24
- cfg.gsub! /(set ca ).*?-+END CERTIFICATE-+"$/m, '\\1<configuration removed>'
26
+ cfg.gsub! /(set ca )"-+BEGIN.*?-+END CERTIFICATE-+"$/m, '\\1<configuration removed>'
25
27
  cfg.gsub! /(set csr ).*?-+END CERTIFICATE REQUEST-+"$/m, '\\1<configuration removed>'
26
28
  cfg
27
29
  end
@@ -29,13 +31,14 @@ class FortiOS < Oxidized::Model
29
31
  cmd 'get system status' do |cfg|
30
32
  @vdom_enabled = cfg.match /Virtual domain configuration: (enable|multiple)/
31
33
  cfg.gsub! /(System time:).*/, '\\1 <stripped>'
32
- cfg.gsub! /(Cluster uptime:).*/, '\\1 <stripped>'
33
- cfg.gsub! /(Virus-DB|Extended DB|IPS-DB|IPS-ETDB|APP-DB|INDUSTRIAL-DB|Botnet DB|IPS Malicious URL Database).*/, '\\1 <db version stripped>'
34
- comment cfg
35
- end
36
-
37
- cmd 'get system ha status' do |cfg|
38
- cfg = cfg.each_line.select { |line| line.match /^(HA Health Status|Mode|Model|Master|Slave\s+):/ }.join
34
+ cfg.gsub! /(Cluster (?:uptime|state change time):).*/, '\\1 <stripped>'
35
+ cfg.gsub! /(Current Time\s+:\s+)(.*)/, '\1<stripped>'
36
+ cfg.gsub! /(Uptime:\s+)(.*)/, '\1<stripped>\3'
37
+ cfg.gsub! /(Last reboot:\s+)(.*)/, '\1<stripped>\3'
38
+ cfg.gsub! /(Disk Usage\s+:\s+)(.*)/, '\1<stripped>'
39
+ cfg.gsub! /(^\S+ (?:disk|DB):\s+)(.*)/, '\1<stripped>\3'
40
+ cfg.gsub! /(VM Registration:\s+)(.*)/, '\1<stripped>\3'
41
+ cfg.gsub! /(Virus-DB|Extended DB|IPS-DB|IPS-ETDB|APP-DB|INDUSTRIAL-DB|Botnet DB|IPS Malicious URL Database|AV AI\/ML Model|IoT-Detect).*/, '\\1 <db version stripped>'
39
42
  comment cfg
40
43
  end
41
44
 
@@ -43,6 +46,11 @@ class FortiOS < Oxidized::Model
43
46
  cfg = []
44
47
  cfg << cmd('config global') if @vdom_enabled
45
48
 
49
+ cfg << cmd('get system ha status') do |cfg_ha|
50
+ cfg_ha = cfg_ha.each_line.select { |line| line.match /^(HA Health Status|Mode|Model|Master|Slave|Primary|Secondary|# COMMAND)(\s+)?:/ }.join
51
+ comment cfg_ha
52
+ end
53
+
46
54
  cfg << cmd('get hardware status') do |cfg_hw|
47
55
  comment cfg_hw
48
56
  end
@@ -58,12 +66,19 @@ class FortiOS < Oxidized::Model
58
66
 
59
67
  cfg << cmd('end') if @vdom_enabled
60
68
 
61
- cfg << cmd('show full-configuration | grep .')
62
- cfg.join "\n"
69
+ ['show full-configuration | grep .', 'show full-configuration', 'show'].each do |fullcmd|
70
+ fullcfg = cmd(fullcmd)
71
+ next if fullcfg.lines[1..3].join =~ /(Parsing error at|command parse error)/ # Don't show for unsupported devices (e.g. FortiAnalyzer, FortiManager, FortiMail)
72
+
73
+ cfg << fullcfg
74
+ break
75
+ end
76
+
77
+ cfg.join
63
78
  end
64
79
 
65
80
  cfg :telnet do
66
- username /login:/
81
+ username /^[lL]ogin:/
67
82
  password /^Password:/
68
83
  end
69
84
 
@@ -0,0 +1,26 @@
1
+ class FortiWLC < Oxidized::Model
2
+ using Refinements
3
+
4
+ comment '# '
5
+
6
+ cmd :all do |cfg, cmdstring|
7
+ new_cfg = comment "COMMAND: #{cmdstring}\n"
8
+ new_cfg << cfg.each_line.to_a[1..-2].map { |line| line.gsub(/(conf_file_ver=)(.*)/, '\1<stripped>\3') }.join
9
+ end
10
+
11
+ prompt /^([-\w.\/:?\[\]()]+[#>]\s?)$/
12
+
13
+ cmd 'show controller' do |cfg|
14
+ comment cfg
15
+ end
16
+ cmd 'show ap' do |cfg|
17
+ comment cfg
18
+ end
19
+ cmd 'show running-config' do |cfg|
20
+ comment cfg
21
+ end
22
+
23
+ cfg :telnet, :ssh do
24
+ pre_logout "exit\n"
25
+ end
26
+ end
@@ -1,4 +1,6 @@
1
1
  class FTOS < Oxidized::Model
2
+ using Refinements
3
+
2
4
  # Force10 FTOS model #
3
5
 
4
6
  comment '! '
@@ -1,4 +1,6 @@
1
1
  class FujitsuPY < Oxidized::Model
2
+ using Refinements
3
+
2
4
  prompt /^(\([\w.-]*\)\s#|^\S+#\s)$/
3
5
  comment '! '
4
6