oxidized 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/publishdocker.yml +13 -0
  3. data/.rubocop.yml +10 -1
  4. data/.rubocop_todo.yml +12 -4
  5. data/CHANGELOG.md +646 -409
  6. data/docs/Configuration.md +4 -1
  7. data/docs/Hooks.md +1 -0
  8. data/docs/Model-Notes/{ios.md → IOS.md} +1 -1
  9. data/docs/Model-Notes/LinuxGeneric.md +4 -3
  10. data/docs/Model-Notes/README.md +1 -1
  11. data/docs/Model-Notes/Viptela.md +1 -1
  12. data/docs/Ruby-API.md +13 -1
  13. data/docs/Supported-OS-Types.md +14 -1
  14. data/lib/oxidized/input/http.rb +14 -4
  15. data/lib/oxidized/input/ssh.rb +1 -1
  16. data/lib/oxidized/input/telnet.rb +1 -1
  17. data/lib/oxidized/model/aos7.rb +2 -2
  18. data/lib/oxidized/model/aosw.rb +5 -0
  19. data/lib/oxidized/model/ciscosmb.rb +13 -2
  20. data/lib/oxidized/model/cnos.rb +33 -0
  21. data/lib/oxidized/model/cumulus.rb +1 -4
  22. data/lib/oxidized/model/edgecos.rb +13 -3
  23. data/lib/oxidized/model/eos.rb +1 -0
  24. data/lib/oxidized/model/fortios.rb +6 -6
  25. data/lib/oxidized/model/gcombnps.rb +4 -4
  26. data/lib/oxidized/model/ibos.rb +55 -0
  27. data/lib/oxidized/model/ios.rb +1 -1
  28. data/lib/oxidized/model/ironware.rb +1 -1
  29. data/lib/oxidized/model/nsxconfig.rb +22 -0
  30. data/lib/oxidized/model/nsxfirewall.rb +22 -0
  31. data/lib/oxidized/model/os10.rb +46 -0
  32. data/lib/oxidized/model/procurve.rb +2 -2
  33. data/lib/oxidized/model/qtech.rb +41 -0
  34. data/lib/oxidized/model/routeros.rb +3 -3
  35. data/lib/oxidized/model/sonicos.rb +5 -0
  36. data/lib/oxidized/model/telco.rb +24 -0
  37. data/lib/oxidized/model/xos.rb +2 -2
  38. data/lib/oxidized/node.rb +2 -2
  39. data/lib/oxidized/nodes.rb +1 -1
  40. data/lib/oxidized/output/git.rb +1 -1
  41. data/lib/oxidized/version.rb +2 -2
  42. data/oxidized.gemspec +2 -2
  43. metadata +16 -8
@@ -25,7 +25,7 @@ class IOS < Oxidized::Model
25
25
 
26
26
  cmd :secret do |cfg|
27
27
  cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
28
- cfg.gsub! /^(snmp-server host \S+( vrf \S+)?( version (1|2c|3))?)\s+\S+((\s+\S*)*)\s*/, '\\1 <secret hidden> \\5'
28
+ cfg.gsub! /^(snmp-server host \S+( vrf \S+)?( informs?)?( version (1|2c|3 (noauth|auth|priv)))?)\s+\S+((\s+\S*)*)\s*/, '\\1 <secret hidden> \\7'
29
29
  cfg.gsub! /^(username .+ (password|secret) \d) .+/, '\\1 <secret hidden>'
30
30
  cfg.gsub! /^(enable (password|secret)( level \d+)? \d) .+/, '\\1 <secret hidden>'
31
31
  cfg.gsub! /^(\s+(?:password|secret)) (?:\d )?\S+/, '\\1 <secret hidden>'
@@ -76,7 +76,7 @@ class IronWare < Oxidized::Model
76
76
  cfg :telnet, :ssh do
77
77
  if vars :enable
78
78
  post_login do
79
- send "enable\n"
79
+ send "enable\r\n"
80
80
  cmd vars(:enable)
81
81
  end
82
82
  end
@@ -0,0 +1,22 @@
1
+ require 'net/http'
2
+ class NSXConfig < Oxidized::Model
3
+ cmd "/api/4.0/edges/" do |cfg|
4
+ edges = JSON.parse(cfg.encode('UTF-8', { invalid: :replace, undef: :replace, replace: '?' }))["edgePage"]["data"]
5
+ data = []
6
+ edges.each do |edge|
7
+ firewall_config = cmd "/api/4.0/edges/#{edge['id']}"
8
+ json_config = JSON.parse(firewall_config.encode('UTF-8', { invalid: :replace, undef: :replace, replace: '?' }))
9
+ json_config["edgeInfo"] = "#{edge['id']} #{edge['name']}"
10
+ data.push(json_config)
11
+ end
12
+ JSON.pretty_generate(data)
13
+ end
14
+
15
+ cfg :http do
16
+ @username = @node.auth[:username]
17
+ @password = @node.auth[:password]
18
+ @headers['Content-Type'] = 'application/json'
19
+ @headers['Accept'] = 'application/json'
20
+ @secure = true
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ require 'net/http'
2
+ class NSXFirewall < Oxidized::Model
3
+ cmd "/api/4.0/edges/" do |cfg|
4
+ edges = JSON.parse(cfg.encode('UTF-8', { invalid: :replace, undef: :replace, replace: '?' }))["edgePage"]["data"]
5
+ data = []
6
+ edges.each do |edge|
7
+ firewall_config = cmd "/api/4.0/edges/#{edge['id']}/firewall/config"
8
+ json_config = {}
9
+ json_config["#{edge['id']} #{edge['name']}"] = JSON.parse(firewall_config.encode('UTF-8', { invalid: :replace, undef: :replace, replace: '?' }))
10
+ data.push(json_config)
11
+ end
12
+ JSON.pretty_generate(data)
13
+ end
14
+
15
+ cfg :http do
16
+ @username = @node.auth[:username]
17
+ @password = @node.auth[:password]
18
+ @headers['Content-Type'] = 'application/json'
19
+ @headers['Accept'] = 'application/json'
20
+ @secure = true
21
+ end
22
+ end
@@ -0,0 +1,46 @@
1
+ class OS10 < Oxidized::Model
2
+ # For switches running Dell EMC Networking OS10 #
3
+ #
4
+ # Tested with : Dell PowerSwitch S4148U-ON
5
+
6
+ comment '! '
7
+
8
+ cmd :all do |cfg|
9
+ cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
10
+ cfg.each_line.to_a[2..-2].join
11
+ end
12
+
13
+ cmd :secret do |cfg|
14
+ cfg.gsub! /(password )(\S+)/, '\1<secret hidden>'
15
+ cfg
16
+ end
17
+
18
+ cmd 'show inventory' do |cfg|
19
+ comment cfg
20
+ end
21
+
22
+ cmd 'show inventory media' do |cfg|
23
+ comment cfg
24
+ end
25
+
26
+ cmd 'show running-configuration' do |cfg|
27
+ cfg.each_line.to_a[3..-1].join
28
+ end
29
+
30
+ cfg :telnet do
31
+ username /^Login:/
32
+ password /^Password:/
33
+ end
34
+
35
+ cfg :telnet, :ssh do
36
+ if vars :enable
37
+ post_login do
38
+ send "enable\n"
39
+ cmd vars(:enable)
40
+ end
41
+ end
42
+ post_login 'terminal length 0'
43
+ pre_logout 'exit'
44
+ pre_logout 'exit'
45
+ end
46
+ end
@@ -1,9 +1,9 @@
1
1
  class Procurve < Oxidized::Model
2
2
  # previous command is repeated followed by "\eE", which sometimes ends up on last line
3
- # ssh switches prompt may start with \r, followed by the prompt itself, regex ([\w\s.-]+# ), which ends the line
3
+ # ssh switches prompt may start with \r, followed by the prompt itself, regex ([\w\s.-]+[#>] ), which ends the line
4
4
  # telnet switchs may start with various vt100 control characters, regex (\e\[24;[0-9][hH]), follwed by the prompt, followed
5
5
  # by at least 3 other vt100 characters
6
- prompt /(^\r|\e\[24;[0-9][hH])?([\w\s.-]+# )($|(\e\[24;[0-9][0-9]?[hH]){3})/
6
+ prompt /(^\r|\e\[24;[0-9][hH])?([\w\s.-]+[#>] )($|(\e\[24;[0-9][0-9]?[hH]){3})/
7
7
 
8
8
  comment '! '
9
9
 
@@ -0,0 +1,41 @@
1
+ class QTECH < Oxidized::Model
2
+ comment '! '
3
+
4
+ cmd :all do |cfg|
5
+ cfg.cut_both
6
+ end
7
+
8
+ cmd :secret do |cfg|
9
+ cfg.gsub! /^(snmp-server community(?: r[ow])?(?: \d)?) .+/, '\\1 <secret hidden>'
10
+ cfg.gsub! /^(snmp-server user .+ auth \S+) .+/, '\\1 <secret hidden>'
11
+ cfg.gsub! /^(username .+ password \d) .+/, '\\1 <secret hidden>'
12
+ cfg.gsub! /^(enable password(?: level \d+)? \d) .+/, '\\1 <secret hidden>'
13
+ cfg
14
+ end
15
+
16
+ cmd 'show version' do |cfg|
17
+ comment cfg.each_line.reject { |line| line.match /^ (Copyright |All rights reserved$|Uptime is |Last reboot is )/ }.join
18
+ end
19
+
20
+ cmd 'show running-config' do |cfg|
21
+ cfg
22
+ end
23
+
24
+ cfg :telnet do
25
+ username /^login:/
26
+ password /^Password:/
27
+ end
28
+
29
+ cfg :telnet, :ssh do
30
+ post_login do
31
+ if vars(:enable) == true
32
+ cmd "enable"
33
+ elsif vars(:enable)
34
+ cmd "enable", /^[pP]assword:/
35
+ cmd vars(:enable)
36
+ end
37
+ cmd 'terminal length 0'
38
+ end
39
+ pre_logout 'exit'
40
+ end
41
+ end
@@ -12,15 +12,15 @@ class RouterOS < Oxidized::Model
12
12
  cfg
13
13
  end
14
14
 
15
- cmd '/system routerboard print' do |cfg|
15
+ cmd '/system routerboard print without-paging' do |cfg|
16
16
  comment cfg
17
17
  end
18
18
 
19
- cmd '/system package update print' do |cfg|
19
+ cmd '/system package update print without-paging' do |cfg|
20
20
  comment cfg
21
21
  end
22
22
 
23
- cmd '/system history print' do |cfg|
23
+ cmd '/system history print without-paging' do |cfg|
24
24
  comment cfg
25
25
  end
26
26
 
@@ -12,6 +12,11 @@ class SonicOS < Oxidized::Model
12
12
  cfg.gsub! /cli ftp password default \d\,(\S+)/, 'cli ftp password default <secret hidden> \2'
13
13
  cfg.gsub! /secret \d\,(\S+)/, 'secret <secret hidden> \2'
14
14
  cfg.gsub! /shared-secret \d\,(\S+)/, 'shared-secret <secret hidden> \2'
15
+ cfg.gsub! /password \d\,(\S+)/, 'password <secret hidden> \2'
16
+ cfg.gsub! /passphrase password \d\,(\S+)/, 'passphrase password <secret hidden> \2'
17
+ cfg.gsub! /bind-password \d\,(\S+)/, 'bind-password <secret hidden> \2'
18
+ cfg.gsub! /authentication sha1 \d\,(\S+)/, 'authentication sha1 <secret hidden> \2'
19
+ cfg.gsub! /encryption aes \d\,(\S+)/, 'encryption aes <secret hidden> \2'
15
20
  cfg
16
21
  end
17
22
 
@@ -0,0 +1,24 @@
1
+ class TELCO < Oxidized::Model
2
+ # Telco Systems T-Marc 3306
3
+
4
+ prompt /^(\r?[\w.@_()-]+[#]\s?)$/
5
+ comment '! '
6
+
7
+ cmd :all do |cfg|
8
+ cfg.each_line.to_a[2..-2].join.delete("\n")
9
+ end
10
+
11
+ cmd 'show running-config' do |cfg|
12
+ cfg
13
+ end
14
+
15
+ cfg :ssh, :telnet do
16
+ post_login 'terminal length 0'
17
+ pre_logout 'exit'
18
+ end
19
+
20
+ cfg :telnet do
21
+ username /^Username:/
22
+ password /^Password:/
23
+ end
24
+ end
@@ -1,7 +1,7 @@
1
1
  class XOS < Oxidized::Model
2
2
  # Extreme Networks XOS
3
3
 
4
- prompt /^*?[\w .-]+# $/
4
+ prompt /^\*?\s?[-\w.~]+(:\d+)? [#>] $/
5
5
  comment '# '
6
6
 
7
7
  cmd :all do |cfg|
@@ -43,7 +43,7 @@ class XOS < Oxidized::Model
43
43
  cfg :telnet, :ssh do
44
44
  post_login do
45
45
  data = cmd 'disable clipaging session'
46
- match = data.match /^disable clipaging session\n\*?[\w .-]+(:\d+)? # $/m
46
+ match = data.match /^disable clipaging session\n\*?[\w .-]+(:\d+)? [#>] $/m
47
47
  next if match
48
48
 
49
49
  cmd 'disable clipaging'
@@ -73,7 +73,7 @@ module Oxidized
73
73
  resc = " (rescued #{resc})"
74
74
  end
75
75
  Oxidized.logger.send(level, '%s raised %s%s with msg "%s"' % [ip, err.class, resc, err.message])
76
- return false
76
+ false
77
77
  rescue StandardError => err
78
78
  crashdir = Oxidized.config.crash.directory
79
79
  crashfile = Oxidized.config.crash.hostnames? ? name : ip.to_s
@@ -86,7 +86,7 @@ module Oxidized
86
86
  fh.puts err.backtrace
87
87
  end
88
88
  Oxidized.logger.error '%s raised %s with msg "%s", %s saved' % [ip, err.class, err.message, crashfile]
89
- return false
89
+ false
90
90
  end
91
91
  end
92
92
 
@@ -164,7 +164,7 @@ module Oxidized
164
164
  node.stats = old[i].stats
165
165
  node.last = old[i].last
166
166
  end
167
- rescue Oxidized::NodeNotFound # rubocop:disable Lint/HandleExceptions
167
+ rescue Oxidized::NodeNotFound
168
168
  end
169
169
  end
170
170
  sort_by! { |x| x.last.nil? ? Time.new(0) : x.last.end }
@@ -74,7 +74,7 @@ module Oxidized
74
74
  repo = Rugged::Repository.new repo
75
75
  walker = Rugged::Walker.new(repo)
76
76
  walker.sorting(Rugged::SORT_DATE)
77
- walker.push(repo.head.target)
77
+ walker.push(repo.head.target.oid)
78
78
  i = -1
79
79
  tab = []
80
80
  walker.each do |commit|
@@ -1,6 +1,6 @@
1
1
  module Oxidized
2
- VERSION = '0.27.0'.freeze
3
- VERSION_FULL = '0.27.0'.freeze
2
+ VERSION = '0.28.0'.freeze
3
+ VERSION_FULL = '0.28.0'.freeze
4
4
  def self.version_set
5
5
  version_full = %x(git describe --tags).chop rescue ""
6
6
  version = %x(git describe --tags --abbrev=0).chop rescue ""
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_runtime_dependency 'ed25519', '~> 1.2'
24
24
  s.add_runtime_dependency 'net-ssh', '~> 5'
25
25
  s.add_runtime_dependency 'net-telnet', '~> 0.2'
26
- s.add_runtime_dependency 'rugged', '~> 0.28'
26
+ s.add_runtime_dependency 'rugged', '~> 0.28.0'
27
27
  s.add_runtime_dependency 'slop', '~> 4.6'
28
28
 
29
29
  s.add_development_dependency 'bundler', '~> 2.0'
@@ -33,6 +33,6 @@ Gem::Specification.new do |s|
33
33
  s.add_development_dependency 'mocha', '~> 1.1'
34
34
  s.add_development_dependency 'pry', '~> 0'
35
35
  s.add_development_dependency 'rake', '~> 10.0'
36
- s.add_development_dependency 'rubocop', '~> 0.74.0'
36
+ s.add_development_dependency 'rubocop', '~> 0.80.0'
37
37
  s.add_development_dependency 'simplecov'
38
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxidized
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saku Ytti
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-10-27 00:00:00.000000000 Z
13
+ date: 2020-05-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: asetus
@@ -88,14 +88,14 @@ dependencies:
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '0.28'
91
+ version: 0.28.0
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: '0.28'
98
+ version: 0.28.0
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: slop
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -200,14 +200,14 @@ dependencies:
200
200
  requirements:
201
201
  - - "~>"
202
202
  - !ruby/object:Gem::Version
203
- version: 0.74.0
203
+ version: 0.80.0
204
204
  type: :development
205
205
  prerelease: false
206
206
  version_requirements: !ruby/object:Gem::Requirement
207
207
  requirements:
208
208
  - - "~>"
209
209
  - !ruby/object:Gem::Version
210
- version: 0.74.0
210
+ version: 0.80.0
211
211
  - !ruby/object:Gem::Dependency
212
212
  name: simplecov
213
213
  requirement: !ruby/object:Gem::Requirement
@@ -235,6 +235,7 @@ files:
235
235
  - ".codeclimate.yml"
236
236
  - ".github/PULL_REQUEST_TEMPLATE.md"
237
237
  - ".github/no-response.yml"
238
+ - ".github/workflows/publishdocker.yml"
238
239
  - ".gitignore"
239
240
  - ".rubocop.yml"
240
241
  - ".rubocop_todo.yml"
@@ -256,6 +257,7 @@ files:
256
257
  - docs/Model-Notes/Comware.md
257
258
  - docs/Model-Notes/Cumulus.md
258
259
  - docs/Model-Notes/EOS.md
260
+ - docs/Model-Notes/IOS.md
259
261
  - docs/Model-Notes/JunOS.md
260
262
  - docs/Model-Notes/LinuxGeneric.md
261
263
  - docs/Model-Notes/Netgear.md
@@ -265,7 +267,6 @@ files:
265
267
  - docs/Model-Notes/VRP-Huawei.md
266
268
  - docs/Model-Notes/Viptela.md
267
269
  - docs/Model-Notes/XGS4600-Zyxel.md
268
- - docs/Model-Notes/ios.md
269
270
  - docs/Outputs.md
270
271
  - docs/Ruby-API.md
271
272
  - docs/Sources.md
@@ -343,6 +344,7 @@ files:
343
344
  - lib/oxidized/model/ciscosma.rb
344
345
  - lib/oxidized/model/ciscosmb.rb
345
346
  - lib/oxidized/model/ciscovpn3k.rb
347
+ - lib/oxidized/model/cnos.rb
346
348
  - lib/oxidized/model/comnetms.rb
347
349
  - lib/oxidized/model/comtrol.rb
348
350
  - lib/oxidized/model/comware.rb
@@ -378,6 +380,7 @@ files:
378
380
  - lib/oxidized/model/hpebladesystem.rb
379
381
  - lib/oxidized/model/hpemsa.rb
380
382
  - lib/oxidized/model/hpmsm.rb
383
+ - lib/oxidized/model/ibos.rb
381
384
  - lib/oxidized/model/icotera.rb
382
385
  - lib/oxidized/model/ios.rb
383
386
  - lib/oxidized/model/iosxe.rb
@@ -396,12 +399,15 @@ files:
396
399
  - lib/oxidized/model/netonix.rb
397
400
  - lib/oxidized/model/netscaler.rb
398
401
  - lib/oxidized/model/nos.rb
402
+ - lib/oxidized/model/nsxconfig.rb
403
+ - lib/oxidized/model/nsxfirewall.rb
399
404
  - lib/oxidized/model/nxos.rb
400
405
  - lib/oxidized/model/oneos.rb
401
406
  - lib/oxidized/model/openbsd.rb
402
407
  - lib/oxidized/model/opengear.rb
403
408
  - lib/oxidized/model/openwrt.rb
404
409
  - lib/oxidized/model/opnsense.rb
410
+ - lib/oxidized/model/os10.rb
405
411
  - lib/oxidized/model/outputs.rb
406
412
  - lib/oxidized/model/panos.rb
407
413
  - lib/oxidized/model/pfsense.rb
@@ -409,6 +415,7 @@ files:
409
415
  - lib/oxidized/model/powerconnect.rb
410
416
  - lib/oxidized/model/procurve.rb
411
417
  - lib/oxidized/model/purityos.rb
418
+ - lib/oxidized/model/qtech.rb
412
419
  - lib/oxidized/model/quantaos.rb
413
420
  - lib/oxidized/model/raisecom.rb
414
421
  - lib/oxidized/model/routeros.rb
@@ -424,6 +431,7 @@ files:
424
431
  - lib/oxidized/model/stoneos.rb
425
432
  - lib/oxidized/model/supermicro.rb
426
433
  - lib/oxidized/model/tdre.rb
434
+ - lib/oxidized/model/telco.rb
427
435
  - lib/oxidized/model/timos.rb
428
436
  - lib/oxidized/model/tmos.rb
429
437
  - lib/oxidized/model/tplink.rb
@@ -475,7 +483,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
475
483
  - !ruby/object:Gem::Version
476
484
  version: '0'
477
485
  requirements: []
478
- rubygems_version: 3.0.2
486
+ rubygems_version: 3.1.3
479
487
  signing_key:
480
488
  specification_version: 4
481
489
  summary: feeble attempt at rancid