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 RouterOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
prompt /\[\w+@\S+(\s+\S+)*\]\s?>\s?$/
|
3
5
|
comment "# "
|
4
6
|
|
@@ -13,11 +15,14 @@ class RouterOS < Oxidized::Model
|
|
13
15
|
end
|
14
16
|
|
15
17
|
cmd '/system routerboard print without-paging' do |cfg|
|
18
|
+
cfg = cfg.each_line.grep(/(model|firmware-type|current-firmware|serial-number):/).join
|
16
19
|
comment cfg
|
17
20
|
end
|
18
21
|
|
19
22
|
cmd '/system package update print without-paging' do |cfg|
|
20
|
-
|
23
|
+
version_line = cfg.each_line.grep(/installed-version: /)[0]
|
24
|
+
@ros_version = /: ([0-9])/.match(version_line)[1].to_i
|
25
|
+
comment version_line
|
21
26
|
end
|
22
27
|
|
23
28
|
cmd '/system history print without-paging' do |cfg|
|
@@ -25,11 +30,21 @@ class RouterOS < Oxidized::Model
|
|
25
30
|
end
|
26
31
|
|
27
32
|
post do
|
28
|
-
|
33
|
+
Oxidized.logger.debug "lib/oxidized/model/routeros.rb: running /export for routeros version #{@ros_version}"
|
34
|
+
run_cmd = if vars(:remove_secret)
|
35
|
+
'/export hide-sensitive'
|
36
|
+
elsif (not @ros_version.nil?) && (@ros_version >= 7)
|
37
|
+
'/export show-sensitive'
|
38
|
+
else
|
39
|
+
'/export'
|
40
|
+
end
|
29
41
|
cmd run_cmd do |cfg|
|
30
42
|
cfg.gsub! /\\\r?\n\s+/, '' # strip new line
|
31
43
|
cfg.gsub! /# inactive time\r\n/, '' # Remove time based system comment
|
32
44
|
cfg.gsub! /# received packet from \S+ bad format\r\n/, '' # Remove intermittent VRRP/CARP collision comment
|
45
|
+
cfg.gsub! /# poe-out status: short_circuit\r\n/, '' # Remove intermittent POE short_circuit comment
|
46
|
+
cfg.gsub! /# Firmware upgraded successfully, please reboot for changes to take effect!\r\n/, '' # Remove transient firmware upgrade comment
|
47
|
+
cfg.gsub! /# \S+ not ready\r\n/, '' # Remove intermittent $interface not ready comment
|
33
48
|
cfg = cfg.split("\n").reject { |line| line[/^#\s\w{3}\/\d{2}\/\d{4}.*$/] }
|
34
49
|
cfg.join("\n") + "\n"
|
35
50
|
end
|
data/lib/oxidized/model/saos.rb
CHANGED
data/lib/oxidized/model/sgos.rb
CHANGED
data/lib/oxidized/model/siklu.rb
CHANGED
data/lib/oxidized/model/slxos.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class SLXOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
prompt /^.*[>#]\s?$/i
|
3
5
|
comment '! '
|
4
6
|
|
@@ -12,6 +14,7 @@ class SLXOS < Oxidized::Model
|
|
12
14
|
cmd 'show chassis' do |cfg|
|
13
15
|
cfg.encode!("UTF-8", invalid: :replace, undef: :replace) # sometimes ironware returns broken encoding
|
14
16
|
cfg.gsub! /.*Power Usage.*/, '' # remove unwanted lines power usage
|
17
|
+
cfg.gsub! /^Update\:.*$/, '' # remove unwanted current date
|
15
18
|
cfg.gsub! /Time A(live|wake).*/, '' # remove unwanted lines time alive/awake
|
16
19
|
cfg.gsub! /([\[]*)1([\]]*)<->([\[]*)2([\]]*)(<->([\[]*)3([\]]*))*/, ''
|
17
20
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class SmartCS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
prompt /^\r?([\w.@() -]+[#>]\s?)$/
|
5
|
+
comment '# '
|
6
|
+
|
7
|
+
expect /-more <Press SPACE for another page, 'q' to quit>-/ do |data, re|
|
8
|
+
send ' '
|
9
|
+
data.sub re, ''
|
10
|
+
end
|
11
|
+
|
12
|
+
cmd :all do |cfg|
|
13
|
+
cfg
|
14
|
+
end
|
15
|
+
|
16
|
+
cmd 'show version' do |cfg|
|
17
|
+
comment cfg.insert(0, "--------------------------------------------------------------------------------! \n")
|
18
|
+
# Unhash below to write a comment in the config file.
|
19
|
+
cfg.insert(0, "Starting: show version cmd \n")
|
20
|
+
cfg << "\n \nEnding: show version cmd"
|
21
|
+
comment cfg << "\n--------------------------------------------------------------------------------! \n \n"
|
22
|
+
comment cfg
|
23
|
+
end
|
24
|
+
|
25
|
+
cmd 'show config' do |cfg|
|
26
|
+
# remove "Press SPACE for another page" add SPACE(\s)
|
27
|
+
cfg.gsub! /\s{5,}/, ""
|
28
|
+
end
|
29
|
+
|
30
|
+
cfg :telnet, :ssh do
|
31
|
+
# preferred way to handle additional passwords
|
32
|
+
post_login do
|
33
|
+
pw = vars(:enable)
|
34
|
+
pw ||= ""
|
35
|
+
send "su\r"
|
36
|
+
expect /[pP]assword:\s?$/
|
37
|
+
cmd pw
|
38
|
+
end
|
39
|
+
pre_logout 'exit'
|
40
|
+
pre_logout 'exit'
|
41
|
+
end
|
42
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class SonicOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
# Applies to Sonicwall NSA series firewalls
|
3
5
|
|
4
6
|
prompt /^\w+@\w+[>]\(?.+\)?\s?/
|
@@ -17,6 +19,12 @@ class SonicOS < Oxidized::Model
|
|
17
19
|
cfg.gsub! /bind-password \d\,(\S+)/, 'bind-password <secret hidden> \2'
|
18
20
|
cfg.gsub! /authentication sha1 \d\,(\S+)/, 'authentication sha1 <secret hidden> \2'
|
19
21
|
cfg.gsub! /encryption aes \d\,(\S+)/, 'encryption aes <secret hidden> \2'
|
22
|
+
cfg.gsub! /smtp-pass \d\,(\S+)/, 'smtp-pass <secret hidden> \2'
|
23
|
+
cfg.gsub! /pop-pass \d\,(\S+)/, 'pop-pass <secret hidden> \2'
|
24
|
+
cfg.gsub! /sslvpn password \d\,(\S+)/, 'sslvpn password <secret hidden> \2'
|
25
|
+
cfg.gsub! /administrator password \d\,(\S+)/, 'administrator password <secret hidden> \2'
|
26
|
+
cfg.gsub! /ftp password \d\,(\S+)/, 'ftp password <secret hidden> \2'
|
27
|
+
cfg.gsub! /shared-key \d\,(\S+)/, 'shared-key <secret hidden> \2'
|
20
28
|
cfg
|
21
29
|
end
|
22
30
|
|
@@ -38,8 +46,10 @@ class SonicOS < Oxidized::Model
|
|
38
46
|
def clean(cfg)
|
39
47
|
out = []
|
40
48
|
cfg.each_line do |line|
|
49
|
+
next if line =~ /date \d{4}\:\d{2}\:\d{2}/
|
50
|
+
next if line =~ /time \d{2}\:\d{2}:\d{2}/
|
41
51
|
next if line =~ /system-time \"\d{2}\/\d{2}\/\d{4} \d{2}\:\d{2}:\d{2}.\d+\"/
|
42
|
-
next if line =~ /system-uptime "(\s+up\s+\d+\s+)|(
|
52
|
+
next if line =~ /system-uptime "((\s+up\s+\d+\s+)|(\d+\s\w+(,\s)?)*)"/
|
43
53
|
next if line =~ /checksum \d+/
|
44
54
|
|
45
55
|
line = line[1..-1] if line[0] == "\r"
|
data/lib/oxidized/model/sros.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
class SROS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
#
|
3
5
|
# Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent).
|
4
6
|
# Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP.
|
5
7
|
#
|
6
8
|
|
7
|
-
comment
|
9
|
+
comment '# '
|
8
10
|
|
9
11
|
prompt /^([-\w.:>*]+\s?[#>]\s?)$/
|
10
12
|
|
@@ -0,0 +1,99 @@
|
|
1
|
+
class SROSMD < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
#
|
5
|
+
# Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent)
|
6
|
+
# Working in Model-Driven CLI mode.
|
7
|
+
# Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP.
|
8
|
+
#
|
9
|
+
|
10
|
+
comment '# '
|
11
|
+
|
12
|
+
prompt /^([-\w.@:>*]+\s?[#>]\s?)$/
|
13
|
+
|
14
|
+
cmd :all do |cfg, cmdstring|
|
15
|
+
new_cfg = comment "COMMAND: #{cmdstring}\n"
|
16
|
+
cfg.gsub! /# Finished .*/, ''
|
17
|
+
cfg.gsub! /# Generated .*/, ''
|
18
|
+
cfg.delete! "\r"
|
19
|
+
new_cfg << cfg.cut_both
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# Show the system information.
|
24
|
+
#
|
25
|
+
cmd 'show system information' do |cfg|
|
26
|
+
#
|
27
|
+
# Strip uptime.
|
28
|
+
#
|
29
|
+
cfg.sub! /^System Up Time.*\n/, ''
|
30
|
+
comment cfg
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Show the card state.
|
35
|
+
#
|
36
|
+
cmd 'show card state' do |cfg|
|
37
|
+
comment cfg
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Show the chassis information.
|
42
|
+
#
|
43
|
+
cmd 'show chassis' do |cfg|
|
44
|
+
comment cfg.lines.to_a[0..25].reject { |line| line.match /state|Time|Temperature|Status/ }.join
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Show the boot log.
|
49
|
+
#
|
50
|
+
cmd 'file show bootlog.txt' do |cfg|
|
51
|
+
cfg.gsub! /[\b][\b][\b]/, "\n"
|
52
|
+
comment cfg
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# Show the running debug configuration.
|
57
|
+
#
|
58
|
+
cmd 'admin show configuration debug full-context' do |cfg|
|
59
|
+
comment cfg
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Show the saved debug configuration (admin debug-save).
|
64
|
+
#
|
65
|
+
cmd 'file show config.dbg' do |cfg|
|
66
|
+
comment cfg
|
67
|
+
end
|
68
|
+
|
69
|
+
#
|
70
|
+
# Show the running persistent indices.
|
71
|
+
#
|
72
|
+
cmd 'admin show configuration configure | match persistent-indices post-lines 10000' do |cfg|
|
73
|
+
comment cfg
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# Show the boot options file.
|
78
|
+
#
|
79
|
+
cmd 'admin show configuration bof full-context' do |cfg|
|
80
|
+
cfg
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# Show the running configuration.
|
85
|
+
#
|
86
|
+
cmd 'admin show configuration configure full-context' do |cfg|
|
87
|
+
cfg
|
88
|
+
end
|
89
|
+
|
90
|
+
cfg :telnet do
|
91
|
+
username /^Login: /
|
92
|
+
password /^Password: /
|
93
|
+
end
|
94
|
+
|
95
|
+
cfg :telnet, :ssh do
|
96
|
+
post_login 'environment more false'
|
97
|
+
pre_logout 'logout'
|
98
|
+
end
|
99
|
+
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
class StoneOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
# Hillstone Networks StoneOS software
|
3
5
|
|
4
|
-
prompt /^\r?[\w.()-]
|
6
|
+
prompt /^\r?[\w.()-]+~?[#>](\s)?$/
|
5
7
|
comment '# '
|
6
8
|
|
7
9
|
expect /^\s.*--More--.*$/ do |data, re|
|
@@ -10,12 +12,16 @@ class StoneOS < Oxidized::Model
|
|
10
12
|
end
|
11
13
|
|
12
14
|
cmd :all do |cfg|
|
15
|
+
cfg.gsub! /+.*+/, '' # Linebreak handling
|
13
16
|
cfg.cut_both
|
14
17
|
end
|
15
18
|
|
16
|
-
cmd 'show configuration running'
|
19
|
+
cmd 'show configuration running' do |cfg|
|
20
|
+
cfg.gsub! /^Building configuration.*$/, ''
|
21
|
+
end
|
17
22
|
|
18
23
|
cmd 'show version' do |cfg|
|
24
|
+
cfg.gsub! /^Uptime is .*$/, ''
|
19
25
|
comment cfg
|
20
26
|
end
|
21
27
|
|
data/lib/oxidized/model/tdre.rb
CHANGED
data/lib/oxidized/model/telco.rb
CHANGED
data/lib/oxidized/model/timos.rb
CHANGED
data/lib/oxidized/model/tmos.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
class TMOS < Oxidized::Model
|
2
|
-
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
comment '# '
|
3
5
|
|
4
6
|
cmd :secret do |cfg|
|
5
7
|
cfg.gsub!(/^([\s\t]*)secret \S+/, '\1secret <secret removed>')
|
@@ -18,6 +20,7 @@ class TMOS < Oxidized::Model
|
|
18
20
|
cmd 'tmsh -q show sys hardware field-fmt' do |cfg|
|
19
21
|
cfg.gsub!(/fan-speed (\S+)/, '')
|
20
22
|
cfg.gsub!(/temperature (\S+)/, '')
|
23
|
+
cfg.gsub!(/humidity (\S+)/, '')
|
21
24
|
comment cfg
|
22
25
|
end
|
23
26
|
|
@@ -47,7 +50,7 @@ class TMOS < Oxidized::Model
|
|
47
50
|
|
48
51
|
cmd('[ -d "/config/zebos" ] && cat /config/zebos/*/ZebOS.conf') { |cfg| comment cfg }
|
49
52
|
|
50
|
-
cmd('cat /config/partitions/*/bigip
|
53
|
+
cmd('cat /config/partitions/*/bigip*.conf') { |cfg| comment cfg }
|
51
54
|
|
52
55
|
cfg :ssh do
|
53
56
|
exec true # don't run shell, run each command in exec channel
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class TPLink < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
# tp-link prompt
|
3
5
|
prompt /^\r?([\w.@()-]+[#>]\s?)$/
|
4
6
|
comment '! '
|
@@ -35,6 +37,8 @@ class TPLink < Oxidized::Model
|
|
35
37
|
end
|
36
38
|
|
37
39
|
cmd 'show system-info' do |cfg|
|
40
|
+
cfg.gsub! /(System Time\s+-).*/, '\\1 <stripped>'
|
41
|
+
cfg.gsub! /(Running Time\s+-).*/, '\\1 <stripped>'
|
38
42
|
comment cfg.each_line.to_a[3..-3].join
|
39
43
|
end
|
40
44
|
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class Trango < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
# take a Trangolink sysinfo output and turn it into a configuration file
|
3
5
|
|
4
6
|
prompt /^#>\s?/
|
@@ -9,16 +11,16 @@ class Trango < Oxidized::Model
|
|
9
11
|
comments = []
|
10
12
|
cfg.each_line do |line|
|
11
13
|
if line =~ /\[Opmode\] (off|on) \[Default Opmode\] (off|on)/
|
12
|
-
out << "opmode " + Regexp.last_match[1]
|
13
|
-
out << "defaultopmode " + Regexp.last_match[2]
|
14
|
+
out << ("opmode " + Regexp.last_match[1])
|
15
|
+
out << ("defaultopmode " + Regexp.last_match[2])
|
14
16
|
end
|
15
|
-
out << "power " + Regexp.last_match[1] if line =~ /\[Tx Power\] ([\-\d]+) dBm/
|
16
|
-
out << "freq " + Regexp.last_match[1] + ' ' + Regexp.last_match[2] if line =~ /\[Active Channel\] (\d+) (v|h)/
|
17
|
-
out << "peerid " + Regexp.last_match[1] if line =~ /\[Peer ID\] ([A-F0-9]+)/
|
18
|
-
out << "utype " + Regexp.last_match[1] if line =~ /\[Unit Type\] (\S+)/
|
19
|
-
comments << '# ' + Regexp.last_match[1] + ': ' + Regexp.last_match[2] if line =~ /\[(Hardware Version|Firmware Version|Model|S\/N)\] (\S+)/
|
20
|
-
out << "remarks " + Regexp.last_match[1] if line =~ /\[Remarks\] (\S+)/
|
21
|
-
out << "rssiled " + Regexp.last_match[1] if line =~ /\[RSSI LED\] (on|off)/
|
17
|
+
out << ("power " + Regexp.last_match[1]) if line =~ /\[Tx Power\] ([\-\d]+) dBm/
|
18
|
+
out << ("freq " + Regexp.last_match[1] + ' ' + Regexp.last_match[2]) if line =~ /\[Active Channel\] (\d+) (v|h)/
|
19
|
+
out << ("peerid " + Regexp.last_match[1]) if line =~ /\[Peer ID\] ([A-F0-9]+)/
|
20
|
+
out << ("utype " + Regexp.last_match[1]) if line =~ /\[Unit Type\] (\S+)/
|
21
|
+
comments << ('# ' + Regexp.last_match[1] + ': ' + Regexp.last_match[2]) if line =~ /\[(Hardware Version|Firmware Version|Model|S\/N)\] (\S+)/
|
22
|
+
out << ("remarks " + Regexp.last_match[1]) if line =~ /\[Remarks\] (\S+)/
|
23
|
+
out << ("rssiled " + Regexp.last_match[1]) if line =~ /\[RSSI LED\] (on|off)/
|
22
24
|
speed = Regexp.last_match[1] if line =~ /\[Speed\] (\d+) Mbps/
|
23
25
|
out << "mir ".concat(Regexp.last_match[1]) if line =~ /\[Tx MIR\] (\d+) Kbps/
|
24
26
|
if line =~ /\[Auto Rate Shift\] (on|off)/
|
@@ -27,9 +29,9 @@ class Trango < Oxidized::Model
|
|
27
29
|
end
|
28
30
|
next unless line =~ /\[IP\] (\S+) \[Subnet Mask\] (\S+) \[Gateway\] (\S+)/
|
29
31
|
|
30
|
-
out << "ipconfig " + Regexp.last_match[1] + ' ' +
|
32
|
+
out << ("ipconfig " + Regexp.last_match[1] + ' ' +
|
31
33
|
Regexp.last_match[2] + ' ' +
|
32
|
-
Regexp.last_match[3]
|
34
|
+
Regexp.last_match[3])
|
33
35
|
end
|
34
36
|
comments.push(*out).join "\n"
|
35
37
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class TrueNAS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
comment '# '
|
5
|
+
|
6
|
+
cmd('uname -a') { |cfg| comment cfg }
|
7
|
+
cmd('cat /etc/version') { |cfg| comment cfg }
|
8
|
+
cmd('sqlite3 "file:///data/freenas-v1.db?mode=ro&immutable=1" .dump') do |cfg|
|
9
|
+
cfg.lines.reject do |line|
|
10
|
+
line.match(/^INSERT INTO storage_replication /) ||
|
11
|
+
line.match(/^INSERT INTO system_alert /)
|
12
|
+
end.join
|
13
|
+
end
|
14
|
+
|
15
|
+
cfg :ssh do
|
16
|
+
exec true # don't run shell, run each command in exec channel
|
17
|
+
end
|
18
|
+
|
19
|
+
cfg :ssh do
|
20
|
+
pre_logout 'exit'
|
21
|
+
end
|
22
|
+
end
|
data/lib/oxidized/model/ucs.rb
CHANGED
data/lib/oxidized/model/voss.rb
CHANGED
data/lib/oxidized/model/vrp.rb
CHANGED
data/lib/oxidized/model/weos.rb
CHANGED
data/lib/oxidized/model/xos.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
class XOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
# Extreme Networks XOS
|
3
5
|
|
4
|
-
prompt
|
6
|
+
prompt /^\s?\*?\s?[-\w]+\s?[-\w.~]+(:\d+)? [#>] $/
|
5
7
|
comment '# '
|
6
8
|
|
7
9
|
cmd :all do |cfg|
|
@@ -23,7 +25,8 @@ class XOS < Oxidized::Model
|
|
23
25
|
end
|
24
26
|
|
25
27
|
cmd 'show switch' do |cfg|
|
26
|
-
|
28
|
+
cfg.gsub! /Next periodic save on.*/, ''
|
29
|
+
comment cfg.each_line.reject { |line| line.match(/Time:/) || line.match(/boot/i) || line.match(/Next periodic/) }.join
|
27
30
|
end
|
28
31
|
|
29
32
|
cmd 'show configuration' do |cfg|
|
@@ -43,7 +46,7 @@ class XOS < Oxidized::Model
|
|
43
46
|
cfg :telnet, :ssh do
|
44
47
|
post_login do
|
45
48
|
data = cmd 'disable clipaging session'
|
46
|
-
match = data.match /^disable clipaging session\n
|
49
|
+
match = data.match /^disable clipaging session\n\r?\*?\s?[-\w]+\s?[-\w.~]+(:\d+)? [#>] $/m
|
47
50
|
next if match
|
48
51
|
|
49
52
|
cmd 'disable clipaging'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class Yamaha < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
prompt /^([\w.@()-]+[#>]\s?)$/
|
5
|
+
comment '# '
|
6
|
+
|
7
|
+
expect /^---more---$/ do |data, re|
|
8
|
+
send ' '
|
9
|
+
data.sub re, ''
|
10
|
+
end
|
11
|
+
|
12
|
+
# non-preferred way to handle additional PW prompt
|
13
|
+
# expect /^[\w.]+>$/ do |data|
|
14
|
+
# send "enable\n"
|
15
|
+
# send vars(:enable) + "\n"
|
16
|
+
# data
|
17
|
+
# end
|
18
|
+
|
19
|
+
expect /^Save new configuration/ do |data, re|
|
20
|
+
send "N\n"
|
21
|
+
data.sub re, ''
|
22
|
+
end
|
23
|
+
|
24
|
+
cmd :all do |cfg|
|
25
|
+
# cfg.gsub! /\cH+\s{8}/, '' # example how to handle pager
|
26
|
+
# cfg.gsub! /\cH+/, '' # example how to handle pager
|
27
|
+
# get rid of errors for commands that don't work on some devices
|
28
|
+
cfg.gsub! /^Error: Invalid command name$|^\s+\^$/, ''
|
29
|
+
cfg.cut_both
|
30
|
+
end
|
31
|
+
|
32
|
+
cmd 'show config' do |cfg|
|
33
|
+
cfg.gsub! /^(# Reporting Date:\s+)(.*)$/, '\1<stripped>'
|
34
|
+
cfg
|
35
|
+
end
|
36
|
+
|
37
|
+
cfg :telnet do
|
38
|
+
password /^Password:/i
|
39
|
+
end
|
40
|
+
|
41
|
+
cfg :telnet, :ssh do
|
42
|
+
# preferred way to handle additional passwords
|
43
|
+
post_login 'console lines infinity'
|
44
|
+
post_login 'console columns 200'
|
45
|
+
post_login 'console character ascii'
|
46
|
+
post_login do
|
47
|
+
if vars(:enable) == true
|
48
|
+
cmd "administrator"
|
49
|
+
elsif vars(:enable)
|
50
|
+
cmd "administrator", /^[pP]assword:/
|
51
|
+
cmd vars(:enable)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
pre_logout do
|
55
|
+
cmd 'exit'
|
56
|
+
end
|
57
|
+
pre_logout 'exit'
|
58
|
+
end
|
59
|
+
end
|