oxidized 0.28.0 → 0.29.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +31 -0
- data/.github/workflows/codeql.yml +76 -0
- data/.github/workflows/publishdocker.yml +11 -2
- data/.github/workflows/ruby.yml +42 -0
- data/.github/workflows/stale.yml +16 -0
- data/.rubocop.yml +30 -10
- data/.rubocop_todo.yml +97 -43
- data/CHANGELOG.md +149 -2
- data/Dockerfile +15 -9
- data/README.md +63 -32
- data/Rakefile +2 -0
- data/docs/Configuration.md +49 -7
- data/docs/Creating-Models.md +24 -19
- data/docs/Hooks.md +35 -6
- data/docs/Model-Notes/ADVA.md +12 -0
- data/docs/Model-Notes/Cumulus.md +7 -1
- data/docs/Model-Notes/IOS.md +36 -0
- data/docs/Model-Notes/JunOS.md +3 -3
- data/docs/Model-Notes/LenovoNOS.md +29 -0
- data/docs/Model-Notes/LinksysSRW.md +15 -0
- data/docs/Model-Notes/Nokia.md +3 -0
- data/docs/Model-Notes/OS10.md +33 -0
- data/docs/Model-Notes/PanOS_API.md +28 -0
- data/docs/Model-Notes/README.md +2 -0
- data/docs/Ruby-API.md +12 -8
- data/docs/Sources.md +18 -0
- data/docs/Supported-OS-Types.md +51 -6
- data/docs/Troubleshooting.md +1 -1
- data/extra/gitdiff-msteams.sh +91 -0
- data/extra/nagios_check_failing_nodes.rb +6 -9
- data/extra/oxidized-report-git-commits +71 -14
- data/extra/oxidized.init +2 -5
- data/extra/oxidized.logrotate +1 -0
- data/extra/oxidized.runit +4 -1
- data/extra/oxidized.service +5 -8
- data/extra/rest_client.rb +1 -1
- data/extra/syslog.rb +2 -2
- data/lib/oxidized/cli.rb +1 -1
- data/lib/oxidized/config/vars.rb +5 -2
- data/lib/oxidized/config.rb +6 -3
- data/lib/oxidized/core.rb +1 -1
- data/lib/oxidized/hook/exec.rb +6 -6
- data/lib/oxidized/hook/githubrepo.rb +42 -11
- data/lib/oxidized/hook/slackdiff.rb +2 -2
- data/lib/oxidized/hook/xmppdiff.rb +45 -25
- data/lib/oxidized/hook.rb +4 -8
- data/lib/oxidized/input/exec.rb +1 -1
- data/lib/oxidized/input/input.rb +1 -0
- data/lib/oxidized/input/ssh.rb +23 -20
- data/lib/oxidized/input/telnet.rb +52 -44
- data/lib/oxidized/job.rb +1 -0
- data/lib/oxidized/jobs.rb +11 -6
- data/lib/oxidized/manager.rb +1 -0
- data/lib/oxidized/model/acmepacket.rb +40 -0
- data/lib/oxidized/model/acos.rb +3 -1
- data/lib/oxidized/model/acsw.rb +2 -0
- data/lib/oxidized/model/adtran.rb +7 -3
- data/lib/oxidized/model/adva.rb +68 -0
- data/lib/oxidized/model/aen.rb +2 -0
- data/lib/oxidized/model/aireos.rb +2 -0
- data/lib/oxidized/model/airfiber.rb +3 -1
- data/lib/oxidized/model/airos.rb +2 -0
- data/lib/oxidized/model/alteonos.rb +2 -0
- data/lib/oxidized/model/alvarion.rb +2 -0
- data/lib/oxidized/model/aos.rb +2 -0
- data/lib/oxidized/model/aos7.rb +2 -0
- data/lib/oxidized/model/aoscx.rb +98 -0
- data/lib/oxidized/model/aosw.rb +4 -2
- data/lib/oxidized/model/apc_aos.rb +2 -0
- data/lib/oxidized/model/arbos.rb +2 -0
- data/lib/oxidized/model/aricentiss.rb +2 -0
- data/lib/oxidized/model/asa.rb +4 -0
- data/lib/oxidized/model/asyncos.rb +2 -0
- data/lib/oxidized/model/audiocodes.rb +2 -0
- data/lib/oxidized/model/audiocodesmp.rb +2 -0
- data/lib/oxidized/model/awplus.rb +3 -1
- data/lib/oxidized/model/axos.rb +2 -0
- data/lib/oxidized/model/bdcom.rb +51 -0
- data/lib/oxidized/model/boss.rb +3 -1
- data/lib/oxidized/model/br6910.rb +2 -0
- data/lib/oxidized/model/c4cmts.rb +2 -0
- data/lib/oxidized/model/cambium.rb +2 -0
- data/lib/oxidized/model/cambiumepmp.rb +19 -0
- data/lib/oxidized/model/casa.rb +6 -1
- data/lib/oxidized/model/catos.rb +2 -0
- data/lib/oxidized/model/ciscoce.rb +14 -0
- data/lib/oxidized/model/cisconga.rb +2 -0
- data/lib/oxidized/model/ciscosma.rb +2 -0
- data/lib/oxidized/model/ciscosmb.rb +4 -0
- data/lib/oxidized/model/ciscovpn3k.rb +2 -0
- data/lib/oxidized/model/cnos.rb +2 -0
- data/lib/oxidized/model/comnetms.rb +2 -0
- data/lib/oxidized/model/comtrol.rb +2 -0
- data/lib/oxidized/model/comware.rb +17 -1
- data/lib/oxidized/model/coriant8600.rb +2 -0
- data/lib/oxidized/model/coriantgroove.rb +2 -0
- data/lib/oxidized/model/corianttmos.rb +2 -0
- data/lib/oxidized/model/cumulus.rb +60 -44
- data/lib/oxidized/model/datacom.rb +2 -0
- data/lib/oxidized/model/dcnos.rb +2 -0
- data/lib/oxidized/model/dellx.rb +3 -3
- data/lib/oxidized/model/dlink.rb +4 -1
- data/lib/oxidized/model/dnos.rb +2 -0
- data/lib/oxidized/model/eciapollo.rb +2 -0
- data/lib/oxidized/model/edgecos.rb +24 -2
- data/lib/oxidized/model/edgeos.rb +2 -0
- data/lib/oxidized/model/edgeswitch.rb +6 -4
- data/lib/oxidized/model/eltex.rb +50 -0
- data/lib/oxidized/model/enterasys.rb +20 -3
- data/lib/oxidized/model/enterasys800.rb +31 -0
- data/lib/oxidized/model/eos.rb +4 -1
- data/lib/oxidized/model/fabricos.rb +3 -1
- data/lib/oxidized/model/fastiron.rb +5 -2
- data/lib/oxidized/model/fiberdriver.rb +2 -0
- data/lib/oxidized/model/firebrick.rb +2 -0
- data/lib/oxidized/model/firelinuxos.rb +2 -0
- data/lib/oxidized/model/firewareos.rb +2 -0
- data/lib/oxidized/model/fortios.rb +26 -11
- data/lib/oxidized/model/fortiwlc.rb +26 -0
- data/lib/oxidized/model/ftos.rb +2 -0
- data/lib/oxidized/model/fujitsupy.rb +2 -0
- data/lib/oxidized/model/gaiaos.rb +42 -3
- data/lib/oxidized/model/gcombnps.rb +2 -0
- data/lib/oxidized/model/grandstream.rb +2 -0
- data/lib/oxidized/model/h3c.rb +42 -0
- data/lib/oxidized/model/hatteras.rb +4 -2
- data/lib/oxidized/model/hios.rb +40 -0
- data/lib/oxidized/model/hirschmann.rb +2 -0
- data/lib/oxidized/model/hpebladesystem.rb +3 -1
- data/lib/oxidized/model/hpemsa.rb +2 -0
- data/lib/oxidized/model/hpmsm.rb +2 -0
- data/lib/oxidized/model/ibos.rb +2 -0
- data/lib/oxidized/model/icotera.rb +2 -0
- data/lib/oxidized/model/ios.rb +15 -10
- data/lib/oxidized/model/iosxe.rb +1 -1
- data/lib/oxidized/model/iosxr.rb +2 -0
- data/lib/oxidized/model/ipos.rb +2 -0
- data/lib/oxidized/model/ironware.rb +10 -4
- data/lib/oxidized/model/isam.rb +2 -0
- data/lib/oxidized/model/junos.rb +7 -1
- data/lib/oxidized/model/lancom.rb +25 -0
- data/lib/oxidized/model/lenovonos.rb +84 -0
- data/lib/oxidized/model/linksyssrw.rb +73 -0
- data/lib/oxidized/model/linuxgeneric.rb +2 -0
- data/lib/oxidized/model/masteros.rb +2 -0
- data/lib/oxidized/model/mlnxos.rb +4 -0
- data/lib/oxidized/model/model.rb +35 -8
- data/lib/oxidized/model/mtrlrfs.rb +2 -0
- data/lib/oxidized/model/ndms.rb +3 -1
- data/lib/oxidized/model/necix.rb +32 -0
- data/lib/oxidized/model/netgear.rb +7 -2
- data/lib/oxidized/model/netonix.rb +2 -0
- data/lib/oxidized/model/netscaler.rb +40 -1
- data/lib/oxidized/model/nodegrid.rb +25 -0
- data/lib/oxidized/model/nos.rb +2 -0
- data/lib/oxidized/model/nsxconfig.rb +2 -0
- data/lib/oxidized/model/nsxfirewall.rb +2 -0
- data/lib/oxidized/model/nxos.rb +5 -2
- data/lib/oxidized/model/oneos.rb +2 -0
- data/lib/oxidized/model/openbsd.rb +11 -0
- data/lib/oxidized/model/opengear.rb +3 -1
- data/lib/oxidized/model/openwrt.rb +2 -0
- data/lib/oxidized/model/opnsense.rb +14 -4
- data/lib/oxidized/model/os10.rb +2 -0
- data/lib/oxidized/model/outputs.rb +2 -0
- data/lib/oxidized/model/panos.rb +2 -0
- data/lib/oxidized/model/panos_api.rb +73 -0
- data/lib/oxidized/model/pfsense.rb +14 -7
- data/lib/oxidized/model/planet.rb +2 -0
- data/lib/oxidized/model/powerconnect.rb +3 -3
- data/lib/oxidized/model/procurve.rb +4 -2
- data/lib/oxidized/model/purityos.rb +10 -1
- data/lib/oxidized/model/qtech.rb +2 -0
- data/lib/oxidized/model/quantaos.rb +3 -5
- data/lib/oxidized/model/raisecom.rb +2 -0
- data/lib/oxidized/model/routeros.rb +17 -2
- data/lib/oxidized/model/saos.rb +2 -0
- data/lib/oxidized/model/screenos.rb +2 -0
- data/lib/oxidized/model/sgos.rb +2 -0
- data/lib/oxidized/model/siklu.rb +2 -0
- data/lib/oxidized/model/slxos.rb +3 -0
- data/lib/oxidized/model/smartax.rb +2 -0
- data/lib/oxidized/model/smartcs.rb +42 -0
- data/lib/oxidized/model/sonicos.rb +11 -1
- data/lib/oxidized/model/speedtouch.rb +2 -0
- data/lib/oxidized/model/sros.rb +3 -1
- data/lib/oxidized/model/srosmd.rb +99 -0
- data/lib/oxidized/model/stoneos.rb +8 -2
- data/lib/oxidized/model/supermicro.rb +1 -1
- data/lib/oxidized/model/swos.rb +11 -0
- data/lib/oxidized/model/tdre.rb +2 -0
- data/lib/oxidized/model/telco.rb +2 -0
- data/lib/oxidized/model/timos.rb +1 -1
- data/lib/oxidized/model/tmos.rb +5 -2
- data/lib/oxidized/model/tplink.rb +4 -0
- data/lib/oxidized/model/trango.rb +13 -11
- data/lib/oxidized/model/truenas.rb +22 -0
- data/lib/oxidized/model/ucs.rb +2 -0
- data/lib/oxidized/model/viptela.rb +2 -0
- data/lib/oxidized/model/voltaire.rb +2 -0
- data/lib/oxidized/model/voss.rb +2 -0
- data/lib/oxidized/model/vrp.rb +3 -1
- data/lib/oxidized/model/vyatta.rb +2 -0
- data/lib/oxidized/model/weos.rb +2 -0
- data/lib/oxidized/model/xos.rb +6 -3
- data/lib/oxidized/model/yamaha.rb +59 -0
- data/lib/oxidized/model/zhoneolt.rb +2 -0
- data/lib/oxidized/model/zteolt.rb +54 -0
- data/lib/oxidized/model/zy1308.rb +13 -0
- data/lib/oxidized/model/zynos.rb +2 -0
- data/lib/oxidized/model/zynoscli.rb +2 -0
- data/lib/oxidized/model/zynosgs.rb +2 -0
- data/lib/oxidized/node/stats.rb +1 -0
- data/lib/oxidized/node.rb +16 -11
- data/lib/oxidized/nodes.rb +7 -6
- data/lib/oxidized/output/file.rb +2 -1
- data/lib/oxidized/output/git.rb +5 -3
- data/lib/oxidized/output/gitcrypt.rb +5 -8
- data/lib/oxidized/output/http.rb +2 -0
- data/lib/oxidized/source/csv.rb +1 -0
- data/lib/oxidized/source/http.rb +4 -0
- data/lib/oxidized/source/source.rb +7 -2
- data/lib/oxidized/source/sql.rb +15 -5
- data/lib/oxidized/version.rb +2 -2
- data/lib/oxidized/worker.rb +5 -5
- data/lib/oxidized.rb +1 -1
- data/lib/refinements.rb +43 -0
- data/oxidized.gemspec +22 -16
- metadata +120 -31
- data/.github/no-response.yml +0 -13
- data/.travis.yml +0 -10
- 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
|
-
|
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
|
-
|
22
|
-
|
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
|
-
|
25
|
-
|
33
|
+
cfg = add_comment 'THE HOSTNAME'
|
34
|
+
cfg += cmd 'cat /etc/hostname'
|
26
35
|
|
27
|
-
|
28
|
-
|
36
|
+
cfg += add_comment 'THE HOSTS'
|
37
|
+
cfg += cmd 'cat /etc/hosts'
|
29
38
|
|
30
|
-
|
31
|
-
|
39
|
+
cfg += add_comment 'THE INTERFACES'
|
40
|
+
cfg += cmd 'grep -r "" /etc/network/interface* | cut -d "/" -f 4-'
|
32
41
|
|
33
|
-
|
34
|
-
|
42
|
+
cfg += add_comment 'RESOLV.CONF'
|
43
|
+
cfg += cmd 'cat /etc/resolv.conf'
|
35
44
|
|
36
|
-
|
37
|
-
|
45
|
+
cfg += add_comment 'NTP.CONF'
|
46
|
+
cfg += cmd 'cat /etc/ntp.conf'
|
38
47
|
|
39
|
-
|
40
|
-
|
48
|
+
cfg += add_comment 'SNMP settings'
|
49
|
+
cfg += cmd 'cat /etc/snmp/snmpd.conf'
|
41
50
|
|
42
|
-
|
43
|
-
|
51
|
+
cfg += add_comment "#{routing_daemon_shout} DAEMONS"
|
52
|
+
cfg += cmd "cat /etc/#{routing_daemon}/daemons"
|
44
53
|
|
45
|
-
|
46
|
-
|
54
|
+
cfg += add_comment "#{routing_daemon_shout} ZEBRA"
|
55
|
+
cfg += cmd "cat /etc/#{routing_daemon}/zebra.conf"
|
47
56
|
|
48
|
-
|
49
|
-
|
57
|
+
cfg += add_comment "#{routing_daemon_shout} BGP"
|
58
|
+
cfg += cmd "cat /etc/#{routing_daemon}/bgpd.conf"
|
50
59
|
|
51
|
-
|
52
|
-
|
60
|
+
cfg += add_comment "#{routing_daemon_shout} OSPF"
|
61
|
+
cfg += cmd "cat /etc/#{routing_daemon}/ospfd.conf"
|
53
62
|
|
54
|
-
|
55
|
-
|
63
|
+
cfg += add_comment "#{routing_daemon_shout} OSPF6"
|
64
|
+
cfg += cmd "cat /etc/#{routing_daemon}/ospf6d.conf"
|
56
65
|
|
57
|
-
|
58
|
-
|
66
|
+
cfg += add_comment "#{routing_daemon_shout} CONF"
|
67
|
+
cfg += cmd "cat /etc/#{routing_daemon}/#{routing_conf_file}"
|
59
68
|
|
60
|
-
|
61
|
-
|
69
|
+
cfg += add_comment 'MOTD'
|
70
|
+
cfg += cmd 'cat /etc/motd'
|
62
71
|
|
63
|
-
|
64
|
-
|
72
|
+
cfg += add_comment 'PASSWD'
|
73
|
+
cfg += cmd 'cat /etc/passwd'
|
65
74
|
|
66
|
-
|
67
|
-
|
75
|
+
cfg += add_comment 'SWITCHD'
|
76
|
+
cfg += cmd 'cat /etc/cumulus/switchd.conf'
|
68
77
|
|
69
|
-
|
70
|
-
|
78
|
+
cfg += add_comment 'PORTS'
|
79
|
+
cfg += cmd 'cat /etc/cumulus/ports.conf'
|
71
80
|
|
72
|
-
|
73
|
-
|
81
|
+
cfg += add_comment 'TRAFFIC'
|
82
|
+
cfg += cmd 'cat /etc/cumulus/datapath/traffic.conf'
|
74
83
|
|
75
|
-
|
76
|
-
|
84
|
+
cfg += add_comment 'ACL'
|
85
|
+
cfg += cmd 'cat /etc/cumulus/acl/policy.conf'
|
77
86
|
|
78
|
-
|
79
|
-
|
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
|
data/lib/oxidized/model/dcnos.rb
CHANGED
data/lib/oxidized/model/dellx.rb
CHANGED
@@ -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
|
data/lib/oxidized/model/dlink.rb
CHANGED
@@ -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
|
|
data/lib/oxidized/model/dnos.rb
CHANGED
@@ -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
|
-
|
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 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
|
20
|
-
|
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
|
-
|
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 :
|
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
|
data/lib/oxidized/model/eos.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
class EOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
# Arista EOS model #
|
3
5
|
|
4
|
-
prompt /^.+[#>]
|
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
|
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",
|
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 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! /(
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
cfg
|
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
|
-
|
62
|
-
|
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
|
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
|
data/lib/oxidized/model/ftos.rb
CHANGED