oxidized 0.29.1 → 0.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codeql.yml +4 -4
- data/.github/workflows/publishdocker.yml +3 -0
- data/.github/workflows/ruby.yml +1 -1
- data/.github/workflows/stale.yml +4 -1
- data/.rubocop.yml +6 -3
- data/.rubocop_todo.yml +10 -93
- data/CHANGELOG.md +66 -4
- data/CONTRIBUTING.md +174 -0
- data/Dockerfile +12 -1
- data/README.md +18 -36
- data/bin/oxidized +2 -5
- data/docs/Hooks.md +37 -1
- data/docs/Model-Notes/APC_AOS.md +52 -0
- data/docs/Model-Notes/FSOS.md +11 -0
- data/docs/Model-Notes/FortiOS.md +28 -0
- data/docs/Model-Notes/README.md +1 -20
- data/docs/Model-Notes/XGS4600-Zyxel.md +5 -0
- data/docs/Ruby-API.md +1 -1
- data/docs/Sources.md +13 -0
- data/docs/Supported-OS-Types.md +178 -270
- data/docs/Troubleshooting.md +16 -0
- data/examples/podman-compose/Makefile +61 -0
- data/examples/podman-compose/README.md +58 -0
- data/examples/podman-compose/docker-compose.yml +21 -0
- data/examples/podman-compose/model-simulation/Dockerfile-model +13 -0
- data/examples/podman-compose/model-simulation/asternos.sh +34 -0
- data/examples/podman-compose/oxidized-config/.gitignore +8 -0
- data/examples/podman-compose/oxidized-config/config +46 -0
- data/examples/podman-compose/oxidized-config/router.db +1 -0
- data/examples/podman-compose/oxidized-ssh/README.md +14 -0
- data/extra/rest_client.rb +2 -2
- data/extra/syslog.rb +2 -2
- data/lib/oxidized/cli.rb +6 -4
- data/lib/oxidized/config.rb +17 -14
- data/lib/oxidized/core.rb +22 -3
- data/lib/oxidized/hook.rb +3 -3
- data/lib/oxidized/input/exec.rb +1 -1
- data/lib/oxidized/input/ftp.rb +2 -2
- data/lib/oxidized/input/http.rb +32 -8
- data/lib/oxidized/input/input.rb +1 -1
- data/lib/oxidized/input/scp.rb +52 -0
- data/lib/oxidized/input/ssh.rb +10 -7
- data/lib/oxidized/input/telnet.rb +3 -2
- data/lib/oxidized/input/tftp.rb +1 -1
- data/lib/oxidized/jobs.rb +11 -1
- data/lib/oxidized/manager.rb +6 -6
- data/lib/oxidized/model/acos.rb +1 -1
- data/lib/oxidized/model/addpack.rb +26 -0
- data/lib/oxidized/model/adtran.rb +5 -1
- data/lib/oxidized/model/adva.rb +2 -2
- data/lib/oxidized/model/aoscx.rb +2 -1
- data/lib/oxidized/model/apc_aos.rb +2 -1
- data/lib/oxidized/model/aricentiss.rb +7 -0
- data/lib/oxidized/model/asternos.rb +22 -0
- data/lib/oxidized/model/asyncos.rb +2 -2
- data/lib/oxidized/model/awplus.rb +2 -2
- data/lib/oxidized/model/bdcom.rb +1 -0
- data/lib/oxidized/model/c4cmts.rb +1 -2
- data/lib/oxidized/model/ciscosma.rb +1 -1
- data/lib/oxidized/model/ciscosmb.rb +6 -1
- data/lib/oxidized/model/comware.rb +2 -2
- data/lib/oxidized/model/cumulus.rb +1 -1
- data/lib/oxidized/model/dellx.rb +1 -1
- data/lib/oxidized/model/dlink.rb +4 -2
- data/lib/oxidized/model/dlinknextgen.rb +51 -0
- data/lib/oxidized/model/dnos.rb +3 -0
- data/lib/oxidized/model/edgecos.rb +1 -1
- data/lib/oxidized/model/eltex.rb +2 -0
- data/lib/oxidized/model/enterasys800.rb +1 -1
- data/lib/oxidized/model/eos.rb +1 -1
- data/lib/oxidized/model/firebrick.rb +2 -2
- data/lib/oxidized/model/firewareos.rb +1 -1
- data/lib/oxidized/model/fortios.rb +9 -2
- data/lib/oxidized/model/fsos.rb +44 -0
- data/lib/oxidized/model/ios.rb +1 -1
- data/lib/oxidized/model/iosxr.rb +2 -2
- data/lib/oxidized/model/junos.rb +3 -2
- data/lib/oxidized/model/mimosab11.rb +34 -0
- data/lib/oxidized/model/ml66.rb +33 -0
- data/lib/oxidized/model/model.rb +3 -3
- data/lib/oxidized/model/netgear.rb +1 -1
- data/lib/oxidized/model/netscaler.rb +1 -1
- data/lib/oxidized/model/nxos.rb +4 -3
- data/lib/oxidized/model/ocnos.rb +42 -0
- data/lib/oxidized/model/onefinity.rb +18 -0
- data/lib/oxidized/model/openbsd.rb +1 -1
- data/lib/oxidized/model/opengear.rb +36 -1
- data/lib/oxidized/model/opnsense.rb +1 -1
- data/lib/oxidized/model/panos.rb +2 -0
- data/lib/oxidized/model/pfsense.rb +1 -0
- data/lib/oxidized/model/procurve.rb +3 -1
- data/lib/oxidized/model/rgos.rb +33 -0
- data/lib/oxidized/model/routeros.rb +10 -8
- data/lib/oxidized/model/slxos.rb +2 -2
- data/lib/oxidized/model/sonicos.rb +18 -17
- data/lib/oxidized/model/sros.rb +3 -3
- data/lib/oxidized/model/tplink.rb +4 -3
- data/lib/oxidized/model/truenas.rb +2 -1
- data/lib/oxidized/model/vrp.rb +3 -1
- data/lib/oxidized/model/vyatta.rb +6 -0
- data/lib/oxidized/model/zynos.rb +67 -3
- data/lib/oxidized/model/zynosadsl.rb +14 -0
- data/lib/oxidized/model/zynosgs.rb +2 -0
- data/lib/oxidized/model/zynosmgs.rb +32 -0
- data/lib/oxidized/node.rb +7 -7
- data/lib/oxidized/nodes.rb +17 -12
- data/lib/oxidized/output/file.rb +1 -1
- data/lib/oxidized/output/git.rb +5 -3
- data/lib/oxidized/output/gitcrypt.rb +4 -3
- data/lib/oxidized/signals.rb +44 -0
- data/lib/oxidized/source/csv.rb +1 -1
- data/lib/oxidized/source/http.rb +26 -5
- data/lib/oxidized/source/source.rb +2 -2
- data/lib/oxidized/source/sql.rb +3 -3
- data/lib/oxidized/version.rb +2 -2
- data/lib/oxidized/worker.rb +8 -1
- data/lib/oxidized.rb +3 -2
- data/lib/refinements.rb +1 -1
- data/oxidized.gemspec +6 -3
- metadata +77 -9
@@ -14,7 +14,11 @@ class Adtran < Oxidized::Model
|
|
14
14
|
cfg
|
15
15
|
end
|
16
16
|
|
17
|
-
cmd 'show running-config'
|
17
|
+
cmd 'show running-config' do |cfg|
|
18
|
+
# Strip out line at the top which displays the current date/time
|
19
|
+
# ! Created : Mon Jun 26 2023 10:07:07
|
20
|
+
cfg.gsub! /! Createds+:.*\n/, ''
|
21
|
+
end
|
18
22
|
|
19
23
|
cfg :ssh do
|
20
24
|
if vars :enable
|
data/lib/oxidized/model/adva.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
class ADVA < Oxidized::Model
|
7
7
|
using Refinements
|
8
8
|
|
9
|
-
prompt /\w
|
9
|
+
prompt /\w+-+[#>]\s?$/
|
10
10
|
comment '# '
|
11
11
|
|
12
12
|
cmd :secret do |cfg|
|
@@ -18,7 +18,7 @@ class ADVA < Oxidized::Model
|
|
18
18
|
cfg.cut_both
|
19
19
|
end
|
20
20
|
|
21
|
-
cmd 'show running-config
|
21
|
+
cmd 'show running-config delta' do |cfg|
|
22
22
|
cfg.each_line.reject { |line| line.match /^Preparing configuration file.*/ }.join
|
23
23
|
end
|
24
24
|
|
data/lib/oxidized/model/aoscx.rb
CHANGED
@@ -58,6 +58,7 @@ class Aoscx < Oxidized::Model
|
|
58
58
|
cfg.gsub! /^(\d\/\d\/\d.*\s+)\d+\s+$/, '\\1<hidden>'
|
59
59
|
cfg.gsub! /^(\d+\/\S+\s+\S+\s+)\d+\.\d+\s+C(.*)/, '\\1<hidden>\\2'
|
60
60
|
cfg.gsub! /^(LC.*\s+)\d+\.\d+\s+(C.*)$/, '\\1 <hidden> \\2'
|
61
|
+
cfg.gsub! /^(\S+\s+\S+\s+\s+\S+\s+)(slow|normal|medium|fast|max)(\s+\S+\s+\S+\s+)\d+/, '\\1<speed>\\3<rpm>'
|
61
62
|
comment cfg
|
62
63
|
end
|
63
64
|
|
@@ -69,7 +70,7 @@ class Aoscx < Oxidized::Model
|
|
69
70
|
comment cfg
|
70
71
|
end
|
71
72
|
|
72
|
-
cmd 'show system | exclude "Up Time" | exclude "CPU" | exclude "Memory"' do |cfg|
|
73
|
+
cmd 'show system | exclude "Up Time" | exclude "CPU" | exclude "Memory" | exclude "Pkts .x" | exclude "Lowest" | exclude "Missed"' do |cfg|
|
73
74
|
comment cfg
|
74
75
|
end
|
75
76
|
|
@@ -2,7 +2,8 @@ class Apc_aos < Oxidized::Model # rubocop:disable Naming/ClassAndModuleCamelCase
|
|
2
2
|
using Refinements
|
3
3
|
|
4
4
|
cmd 'config.ini' do |cfg|
|
5
|
-
cfg.gsub!
|
5
|
+
cfg.gsub!(/^; Configuration file, generated on.*\n/, '')
|
6
|
+
cfg
|
6
7
|
end
|
7
8
|
|
8
9
|
cfg :ftp do
|
@@ -2,6 +2,10 @@
|
|
2
2
|
# #show version
|
3
3
|
# Switch ID Hardware Version Firmware Version
|
4
4
|
# 0 SSE-G48-TG4 (P2-01) 1.0.16-9
|
5
|
+
# and
|
6
|
+
# # show version
|
7
|
+
# Switch ID Hardware Version Firmware Version
|
8
|
+
# 0 MBM-XEM-002 (B6-01) 2.1.3-25
|
5
9
|
|
6
10
|
class AricentISS < Oxidized::Model
|
7
11
|
using Refinements
|
@@ -13,6 +17,9 @@ class AricentISS < Oxidized::Model
|
|
13
17
|
# 1.0.18-15 is known to include the corrected spelling
|
14
18
|
post_login 'no cli pagination'
|
15
19
|
post_login 'no cli pagignation'
|
20
|
+
# Starting firmware 2.0, pagination is done differently.
|
21
|
+
# This configuration is reset after the session ends.
|
22
|
+
post_login 'conf t; set cli pagination off; exit'
|
16
23
|
pre_logout 'exit'
|
17
24
|
end
|
18
25
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class AsterNOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
prompt /^[^\$]+\$/
|
5
|
+
comment '# '
|
6
|
+
|
7
|
+
cmd :all do |cfg|
|
8
|
+
cfg.each_line.to_a[1..-2].join
|
9
|
+
end
|
10
|
+
|
11
|
+
cmd 'show version' do |cfg|
|
12
|
+
# @model = Regexp.last_match(1) if cfg =~ /^Model: (\S+)/
|
13
|
+
comment cfg
|
14
|
+
end
|
15
|
+
|
16
|
+
cmd "show runningconfiguration all"
|
17
|
+
|
18
|
+
cfg :ssh do
|
19
|
+
# exec true
|
20
|
+
pre_logout 'exit'
|
21
|
+
end
|
22
|
+
end
|
@@ -25,9 +25,9 @@ class AsyncOS < Oxidized::Model
|
|
25
25
|
# Delete hour and date which change each run
|
26
26
|
# cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:'
|
27
27
|
# Delete select passphrase display option
|
28
|
-
cfg.gsub!
|
28
|
+
cfg.gsub! "Choose the passphrase option:", ''
|
29
29
|
cfg.gsub! /1. Mask passphrases \(Files with masked passphrases cannot be loaded using/, ''
|
30
|
-
cfg.gsub!
|
30
|
+
cfg.gsub! "loadconfig command)", ''
|
31
31
|
cfg.gsub! /2. Encrypt passphrases/, ''
|
32
32
|
cfg.gsub! /3. Plain passphrases/, ''
|
33
33
|
cfg.gsub! /^3$/, ''
|
@@ -15,8 +15,8 @@ class AWPlus < Oxidized::Model
|
|
15
15
|
|
16
16
|
# Removes gibberish pager output e.g. VT100 escape codes
|
17
17
|
cmd :all do |cfg|
|
18
|
-
cfg.gsub!
|
19
|
-
cfg.gsub!
|
18
|
+
cfg.gsub! "\e[K", '' # example how to handle pager - cleareol EL0
|
19
|
+
cfg.gsub! "\e[7m\e[m", '' # example how to handle pager - Reverse SGR7
|
20
20
|
cfg.delete! "\r" # Filters rogue ^M - see issue #415
|
21
21
|
cfg.cut_both
|
22
22
|
end
|
data/lib/oxidized/model/bdcom.rb
CHANGED
@@ -25,7 +25,7 @@ class CiscoSMA < Oxidized::Model
|
|
25
25
|
# Delete hour and date which change each run
|
26
26
|
# cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:'
|
27
27
|
# Delete select passphrase display option
|
28
|
-
cfg.gsub!
|
28
|
+
cfg.gsub! "Do you want to mask the password? Files with masked passwords cannot be loaded", ''
|
29
29
|
cfg.gsub! /^\s+y/, ''
|
30
30
|
# Delete space
|
31
31
|
cfg.gsub! /\n\s{25}/, ''
|
@@ -5,7 +5,12 @@ class CiscoSMB < Oxidized::Model
|
|
5
5
|
# http://www.cisco.com/c/en/us/support/switches/small-business-300-series-managed-switches/products-release-notes-list.html
|
6
6
|
|
7
7
|
prompt /^\r?([\w.@()-]+[#>]\s?)$/
|
8
|
-
comment
|
8
|
+
comment '! '
|
9
|
+
|
10
|
+
expect '^.*Your password has exceeded the maximum lifetime.*$' do
|
11
|
+
send 'N'
|
12
|
+
""
|
13
|
+
end
|
9
14
|
|
10
15
|
cmd :all do |cfg|
|
11
16
|
lines = cfg.each_line.to_a[1..-2]
|
@@ -27,7 +27,7 @@ class Comware < Oxidized::Model
|
|
27
27
|
end
|
28
28
|
|
29
29
|
cfg :telnet do
|
30
|
-
username /^(Username|
|
30
|
+
username /^(Username|[Ll]ogin):/
|
31
31
|
password /^Password:/
|
32
32
|
end
|
33
33
|
|
@@ -37,7 +37,7 @@ class Comware < Oxidized::Model
|
|
37
37
|
if vars(:enable) == true
|
38
38
|
cmd "super"
|
39
39
|
elsif vars(:enable)
|
40
|
-
cmd "super",
|
40
|
+
cmd "super", /^\s?[pP]assword:/
|
41
41
|
cmd vars(:enable)
|
42
42
|
end
|
43
43
|
end
|
data/lib/oxidized/model/dellx.rb
CHANGED
data/lib/oxidized/model/dlink.rb
CHANGED
@@ -2,9 +2,8 @@ class Dlink < Oxidized::Model
|
|
2
2
|
using Refinements
|
3
3
|
|
4
4
|
# D-LINK Switches
|
5
|
-
# Add support dgs 1100 series (tested only with dgs-1100-10/me)
|
6
5
|
|
7
|
-
prompt
|
6
|
+
prompt /[\w.@()\/:-]+[#>]\s?$/
|
8
7
|
comment '# '
|
9
8
|
|
10
9
|
cmd :secret do |cfg|
|
@@ -19,6 +18,9 @@ class Dlink < Oxidized::Model
|
|
19
18
|
|
20
19
|
cmd 'show switch' do |cfg|
|
21
20
|
cfg.gsub! /^System Uptime\s.+/, '' # Omit constantly changing uptime info
|
21
|
+
cfg.gsub! /^System up time\s.+/, '' # Omit constantly changing uptime info
|
22
|
+
cfg.gsub! /^System Time\s.+/, '' # Omit constantly changing uptime info
|
23
|
+
cfg.gsub! /^RTC Time\s.+/, '' # Omit constantly changing uptime info
|
22
24
|
comment cfg
|
23
25
|
end
|
24
26
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class DlinkNextGen < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
# D-LINK next generation cli Switches
|
5
|
+
# Add support DXS-1210-12SC
|
6
|
+
|
7
|
+
prompt /[\w.@()\/-]+[#>]\s?$/
|
8
|
+
comment '# '
|
9
|
+
|
10
|
+
cmd :all do |cfg|
|
11
|
+
cfg.each_line.to_a[2..-2].map { |line| line.delete("\r").rstrip }.join("\n") + "\n"
|
12
|
+
end
|
13
|
+
|
14
|
+
cmd :secret do |cfg|
|
15
|
+
cfg.gsub! /(password) (\S+).*/, '\\1 <secret hidden>'
|
16
|
+
cfg.gsub! /(snmp-server group) (\S+) (v.*)/, '\\1 <secret hidden> \\3'
|
17
|
+
cfg.gsub! /(snmp-server community) (\S+) (v.*)/, '\\1 <secret hidden> \\3'
|
18
|
+
cfg
|
19
|
+
end
|
20
|
+
|
21
|
+
# "show switch" doesn't exist on DXS-1210-28T rev A1 Firmware: Build 1.00.024; not figured out how to run "show version" so running both
|
22
|
+
cmd 'show switch' do |cfg|
|
23
|
+
cfg.gsub! /^\s+System Time\s.+/, '' # Omit constantly changing uptime info
|
24
|
+
comment cfg
|
25
|
+
end
|
26
|
+
|
27
|
+
cmd 'show version' do |cfg|
|
28
|
+
comment cfg
|
29
|
+
end
|
30
|
+
|
31
|
+
cmd 'show vlan' do |cfg|
|
32
|
+
comment cfg
|
33
|
+
end
|
34
|
+
|
35
|
+
cmd 'show running-config' do |cfg|
|
36
|
+
cfg.gsub! /^(snmp-server community ["\w]+) \S+/, '\\1 <removed>'
|
37
|
+
cfg.gsub! /^(username [\w.@-]+ privilege \d{1,2} password \d{1,2}) \S+/, '\\1 <removed>'
|
38
|
+
cfg
|
39
|
+
end
|
40
|
+
|
41
|
+
cfg :telnet do
|
42
|
+
username /\r*([\w\s.@()\/:-]+)?([Uu]ser[Nn]ame|[Ll]ogin):/
|
43
|
+
password /\r*[Pp]ass[Ww]ord:/
|
44
|
+
end
|
45
|
+
|
46
|
+
cfg :telnet, :ssh do
|
47
|
+
post_login 'terminal length 0'
|
48
|
+
post_login 'terminal width 255'
|
49
|
+
pre_logout 'logout'
|
50
|
+
end
|
51
|
+
end
|
data/lib/oxidized/model/dnos.rb
CHANGED
@@ -16,6 +16,9 @@ class DNOS < Oxidized::Model
|
|
16
16
|
cfg.gsub! /secret (\d+) (\S+).*/, '<secret hidden>'
|
17
17
|
cfg.gsub! /password (\d+) (\S+).*/, '<secret hidden>'
|
18
18
|
cfg.gsub! /^(tacacs-server key \d+) (\S+).*/, '\\1 <secret hidden>'
|
19
|
+
cfg.gsub! /(ip ospf message-digest-key \d \S+ \d).*/, '\\1 <secret hidden>'
|
20
|
+
cfg.gsub! /(authentication-type).*/, '\\1 <secret hidden>'
|
21
|
+
cfg.gsub! /^(bsd-username \S+ secret).*/, '\\1 <secret hidden>'
|
19
22
|
cfg
|
20
23
|
end
|
21
24
|
|
data/lib/oxidized/model/eltex.rb
CHANGED
data/lib/oxidized/model/eos.rb
CHANGED
@@ -15,7 +15,7 @@ class EOS < Oxidized::Model
|
|
15
15
|
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
|
16
16
|
cfg.gsub! /(secret \w+) (\S+).*/, '\\1 <secret hidden>'
|
17
17
|
cfg.gsub! /(password \d+) (\S+).*/, '\\1 <secret hidden>'
|
18
|
-
cfg.gsub! /^(enable secret).*/, '\\1 <configuration removed>'
|
18
|
+
cfg.gsub! /^(enable (?:secret|password)).*/, '\\1 <configuration removed>'
|
19
19
|
cfg.gsub! /^(service unsupported-transceiver).*/, '\\1 <license key removed>'
|
20
20
|
cfg.gsub! /^(tacacs-server key \d+).*/, '\\1 <configuration removed>'
|
21
21
|
cfg.gsub! /( {6}key) (\h+ 7) (\h+).*/, '\\1 <secret hidden>'
|
@@ -10,8 +10,8 @@ class Firebrick < Oxidized::Model
|
|
10
10
|
end
|
11
11
|
|
12
12
|
cmd 'show status' do |cfg|
|
13
|
-
cfg.gsub!
|
14
|
-
cfg.gsub!
|
13
|
+
cfg.gsub! "Status", ''
|
14
|
+
cfg.gsub! "------", ''
|
15
15
|
cfg.gsub! /Uptime.*/, ''
|
16
16
|
cfg.gsub! /Current time.*/, ''
|
17
17
|
cfg.gsub! /RAM.*/, ''
|
@@ -5,6 +5,12 @@ class FortiOS < Oxidized::Model
|
|
5
5
|
|
6
6
|
prompt /^([-\w.~]+(\s[(\w\-.)]+)?~?\s?[#>$]\s?)$/
|
7
7
|
|
8
|
+
# When a post-login-banner is enabled, you have to press "a" to log in
|
9
|
+
expect /^\(Press\s'a'\sto\saccept\):/ do |data, re|
|
10
|
+
send 'a'
|
11
|
+
data.sub re, ''
|
12
|
+
end
|
13
|
+
|
8
14
|
expect /^--More--\s$/ do |data, re|
|
9
15
|
send ' '
|
10
16
|
data.sub re, ''
|
@@ -23,6 +29,7 @@ class FortiOS < Oxidized::Model
|
|
23
29
|
cfg.gsub! /(set (?:passwd|password|key|group-password|auth-password-l1|auth-password-l2|rsso|history0|history1)) .+/, '\\1 <configuration removed>'
|
24
30
|
cfg.gsub! /(set md5-key [0-9]+) .+/, '\\1 <configuration removed>'
|
25
31
|
cfg.gsub! /(set private-key ).*?-+END (ENCRYPTED|RSA|OPENSSH) PRIVATE KEY-+\n?"$/m, '\\1<configuration removed>'
|
32
|
+
cfg.gsub! /(set privatekey ).*?-+END (ENCRYPTED|RSA|OPENSSH) PRIVATE KEY-+\n?"$/m, '\\1<configuration removed>'
|
26
33
|
cfg.gsub! /(set ca )"-+BEGIN.*?-+END CERTIFICATE-+"$/m, '\\1<configuration removed>'
|
27
34
|
cfg.gsub! /(set csr ).*?-+END CERTIFICATE REQUEST-+"$/m, '\\1<configuration removed>'
|
28
35
|
cfg
|
@@ -38,7 +45,7 @@ class FortiOS < Oxidized::Model
|
|
38
45
|
cfg.gsub! /(Disk Usage\s+:\s+)(.*)/, '\1<stripped>'
|
39
46
|
cfg.gsub! /(^\S+ (?:disk|DB):\s+)(.*)/, '\1<stripped>\3'
|
40
47
|
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>'
|
48
|
+
cfg.gsub! /(Virus-DB|Extended DB|FMWP-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>'
|
42
49
|
comment cfg
|
43
50
|
end
|
44
51
|
|
@@ -66,7 +73,7 @@ class FortiOS < Oxidized::Model
|
|
66
73
|
|
67
74
|
cfg << cmd('end') if @vdom_enabled
|
68
75
|
|
69
|
-
['show
|
76
|
+
['show | grep .', 'show full-configuration', 'show'].each do |fullcmd|
|
70
77
|
fullcfg = cmd(fullcmd)
|
71
78
|
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
79
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class FSOS < Oxidized::Model
|
2
|
+
# Fiberstore / fs.com
|
3
|
+
using Refinements
|
4
|
+
comment '! '
|
5
|
+
|
6
|
+
# Handle paging
|
7
|
+
expect /^ --More--.*$/ do |data, re|
|
8
|
+
send ' '
|
9
|
+
data.sub re, ''
|
10
|
+
end
|
11
|
+
|
12
|
+
cmd :secret do |cfg|
|
13
|
+
cfg.gsub! /(secret \w+) (\S+).*/, '\\1 <secret hidden>'
|
14
|
+
cfg.gsub! /(password \d+) (\S+).*/, '\\1 <secret hidden>'
|
15
|
+
cfg.gsub! /(snmp-server community \d+) (\S+).*/, '\\1 <secret hidden>'
|
16
|
+
cfg
|
17
|
+
end
|
18
|
+
|
19
|
+
cmd 'show version' do |cfg|
|
20
|
+
# Remove uptime so the result doesn't change every time
|
21
|
+
cfg.gsub! /.*uptime is.*\n/, ''
|
22
|
+
cfg.gsub! /.*System uptime.*\n/, ''
|
23
|
+
comment cfg
|
24
|
+
end
|
25
|
+
|
26
|
+
cmd 'show running-config' do |cfg|
|
27
|
+
# Remove "Building configuration..." message
|
28
|
+
cfg.gsub! /^Building configuration.*\n/, ''
|
29
|
+
cfg.cut_head
|
30
|
+
end
|
31
|
+
|
32
|
+
cfg :telnet do
|
33
|
+
username /^Username:/
|
34
|
+
password /^Password:/
|
35
|
+
end
|
36
|
+
|
37
|
+
cfg :telnet, :ssh do
|
38
|
+
post_login 'enable'
|
39
|
+
post_login 'terminal length 0'
|
40
|
+
post_login 'terminal width 256'
|
41
|
+
pre_logout 'exit'
|
42
|
+
pre_logout 'exit'
|
43
|
+
end
|
44
|
+
end
|
data/lib/oxidized/model/ios.rb
CHANGED
@@ -85,7 +85,7 @@ class IOS < Oxidized::Model
|
|
85
85
|
comments << "Processor ID: #{Regexp.last_match(1)}" if cfg.lines[i + 1] =~ /processor board id (\S+)/i
|
86
86
|
if cfg.lines[i + 2] =~ /(cpu at |processor: |#{cpu} processor,)/i
|
87
87
|
# change implementation to impl and prepend comma
|
88
|
-
cpuxtra = cfg.lines[i + 2].gsub(
|
88
|
+
cpuxtra = cfg.lines[i + 2].gsub("implementation", 'impl').gsub(/^/, ', ').chomp
|
89
89
|
end
|
90
90
|
comments << "CPU:#{slave} #{cpu}#{cpuxtra}#{slaveslot}"
|
91
91
|
end
|
data/lib/oxidized/model/iosxr.rb
CHANGED
@@ -16,7 +16,7 @@ class IOSXR < Oxidized::Model
|
|
16
16
|
cfg
|
17
17
|
end
|
18
18
|
|
19
|
-
cmd 'show inventory' do |cfg|
|
19
|
+
cmd 'admin show inventory' do |cfg|
|
20
20
|
comment cfg
|
21
21
|
end
|
22
22
|
|
@@ -25,7 +25,7 @@ class IOSXR < Oxidized::Model
|
|
25
25
|
end
|
26
26
|
|
27
27
|
cmd 'show running-config' do |cfg|
|
28
|
-
cfg = cfg.each_line.to_a[
|
28
|
+
cfg = cfg.each_line.to_a[1..-1].join
|
29
29
|
cfg
|
30
30
|
end
|
31
31
|
|
data/lib/oxidized/model/junos.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
class JunOS < Oxidized::Model
|
2
2
|
using Refinements
|
3
|
-
|
4
3
|
comment '# '
|
5
4
|
|
6
5
|
def telnet
|
@@ -10,11 +9,13 @@ class JunOS < Oxidized::Model
|
|
10
9
|
cmd :all do |cfg|
|
11
10
|
cfg = cfg.cut_both if screenscrape
|
12
11
|
cfg.gsub!(/ scale-subscriber (\s+)(\d+)/, ' scale-subscriber <count>')
|
12
|
+
cfg.gsub!(/VMX-BANDWIDTH\s+(\d+) (.*)/, 'VMX-BANDWIDTH <count> \2')
|
13
13
|
cfg.lines.map { |line| line.rstrip }.join("\n") + "\n"
|
14
14
|
end
|
15
15
|
|
16
16
|
cmd :secret do |cfg|
|
17
17
|
cfg.gsub!(/community (\S+) {/, 'community <hidden> {')
|
18
|
+
cfg.gsub!(/(ssh-(rsa|dsa|ecdsa|ecdsa-sk|ed25519|ed25519-sk) )".*; ## SECRET-DATA/, '<secret removed>')
|
18
19
|
cfg.gsub!(/ "\$\d\$\S+; ## SECRET-DATA/, ' <secret removed>;')
|
19
20
|
cfg
|
20
21
|
end
|
@@ -29,7 +30,7 @@ class JunOS < Oxidized::Model
|
|
29
30
|
case @model
|
30
31
|
when 'mx960'
|
31
32
|
out << cmd('show chassis fabric reachability') { |cfg| comment cfg }
|
32
|
-
when /^(ex22|
|
33
|
+
when /^(ex22|ex3[34]|ex4|ex8|qfx)/
|
33
34
|
out << cmd('show virtual-chassis') { |cfg| comment cfg }
|
34
35
|
end
|
35
36
|
out
|
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
# Mechanize has to be intialized here as the login needs a POST request
|
3
|
+
require "mechanize"
|
4
|
+
rescue LoadError
|
5
|
+
# Oxidized requires mechanize
|
6
|
+
raise Oxidized::OxidizedError, "mechanize not found: sudo gem install mechanize"
|
7
|
+
end
|
8
|
+
|
9
|
+
class Mimosab11 < Oxidized::Model
|
10
|
+
using Refinements
|
11
|
+
# Callback cfg_cb function to login(POST) then get(GET) the configuration
|
12
|
+
cfg_cb = lambda do
|
13
|
+
@e = Mechanize.new
|
14
|
+
# Set login query endpoint(lqe) and login POST data(lqp)
|
15
|
+
lqe = "https://#{@node.ip}/?q=index.login&mimosa_ajax=1"
|
16
|
+
lgp = { "username" => "configure", "password" => @password }
|
17
|
+
# Set get request endpoint(gc) for config
|
18
|
+
gc = "https://#{@node.ip}/?q=preferences.configure&mimosa_action=download"
|
19
|
+
# Not to verify self signed
|
20
|
+
@e.verify_mode = 0
|
21
|
+
@e.post(lqe, lgp)
|
22
|
+
cfg = @e.get(gc)
|
23
|
+
cfg.body
|
24
|
+
end
|
25
|
+
|
26
|
+
cmd cfg_cb do |cfg|
|
27
|
+
cfg
|
28
|
+
end
|
29
|
+
|
30
|
+
cfg :http do
|
31
|
+
@username = @node.auth[:username]
|
32
|
+
@password = @node.auth[:password]
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class ML66 < Oxidized::Model
|
2
|
+
comment '! '
|
3
|
+
prompt /.*#/
|
4
|
+
|
5
|
+
expect /User:.*$/ do |data, re|
|
6
|
+
send "admin_user\n"
|
7
|
+
send "#{@node.auth[:password]}\n"
|
8
|
+
data.sub re, ''
|
9
|
+
end
|
10
|
+
|
11
|
+
cmd 'show version' do |cfg|
|
12
|
+
cfg.gsub! "Uptime", ''
|
13
|
+
comment cfg
|
14
|
+
end
|
15
|
+
|
16
|
+
cmd 'show inventory hw all' do |cfg|
|
17
|
+
comment cfg
|
18
|
+
end
|
19
|
+
|
20
|
+
cmd 'show inventory sw all' do |cfg|
|
21
|
+
comment cfg
|
22
|
+
end
|
23
|
+
|
24
|
+
cmd 'show license status all' do |cfg|
|
25
|
+
comment cfg
|
26
|
+
end
|
27
|
+
|
28
|
+
cmd 'show running-config'
|
29
|
+
|
30
|
+
cfg :ssh do
|
31
|
+
pre_logout 'logout'
|
32
|
+
end
|
33
|
+
end
|
data/lib/oxidized/model/model.rb
CHANGED
@@ -143,8 +143,8 @@ module Oxidized
|
|
143
143
|
@input.send data
|
144
144
|
end
|
145
145
|
|
146
|
-
def expect(
|
147
|
-
self.class.expect
|
146
|
+
def expect(...)
|
147
|
+
self.class.expect(...)
|
148
148
|
end
|
149
149
|
|
150
150
|
def cfg
|
@@ -217,7 +217,7 @@ module Oxidized
|
|
217
217
|
|
218
218
|
def process_cmd_output(output, name)
|
219
219
|
output = String.new('') unless output.instance_of?(String)
|
220
|
-
output.
|
220
|
+
output.process_cmd(name)
|
221
221
|
output
|
222
222
|
end
|
223
223
|
end
|
data/lib/oxidized/model/nxos.rb
CHANGED
@@ -10,11 +10,12 @@ class NXOS < Oxidized::Model
|
|
10
10
|
end
|
11
11
|
|
12
12
|
cmd :secret do |cfg|
|
13
|
-
cfg.gsub! /^(snmp-server community).*/, '\\1 <
|
14
|
-
cfg.gsub! /^(snmp-server user (\S+) (\S+) auth (\S+)) (\S+) (priv) (\S+)/, '\\1 <
|
13
|
+
cfg.gsub! /^(snmp-server community).*/, '\\1 <secret hidden>'
|
14
|
+
cfg.gsub! /^(snmp-server user (\S+) (\S+) auth (\S+)) (\S+) (priv) (\S+)/, '\\1 <secret hidden> '
|
15
|
+
cfg.gsub! /^(snmp-server host.*? )\S+( udp-port \d+)?$/, '\\1<secret hidden>\\2'
|
15
16
|
cfg.gsub! /(password \d+) (\S+)/, '\\1 <secret hidden>'
|
16
17
|
cfg.gsub! /^(radius-server key).*/, '\\1 <secret hidden>'
|
17
|
-
cfg.gsub! /^(tacacs-server
|
18
|
+
cfg.gsub! /^(tacacs-server .*key(?: \d+)?) \S+/, '\\1 <secret hidden>'
|
18
19
|
cfg
|
19
20
|
end
|
20
21
|
|