xlogin 0.5.9 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/xlogin.rb +0 -4
- data/lib/xlogin/firmware_factory.rb +5 -10
- data/lib/xlogin/templates/ios.rb +13 -15
- data/lib/xlogin/templates/iosxr.rb +15 -17
- data/lib/xlogin/templates/junos.rb +7 -9
- data/lib/xlogin/templates/sros.rb +15 -17
- data/lib/xlogin/templates/vyos.rb +6 -8
- data/lib/xlogin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74571de0b0cfd2927444299ac5501950732998f9
|
4
|
+
data.tar.gz: c123722cc6b42fa4bde1f52ae0ca0815987ac4bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be01886a787bc8f6ee0b60affbc977d7941bcf8049054948dc6a7e97b92e984b92481c0ae2b3c03d8af6b611ac32a422e3f33fe95dc8b339f977215f2e2c7a52
|
7
|
+
data.tar.gz: 6fa942ccb22a3c6e99f6b4455e360b6ac457a01b24ddb507154c94fafcab38bf5042bb675c15b3d5e9d0fe6224e99d91871fad49c5414f0f816721c8237595a6
|
data/Gemfile.lock
CHANGED
data/lib/xlogin.rb
CHANGED
@@ -11,7 +11,6 @@ module Xlogin
|
|
11
11
|
def initialize
|
12
12
|
@database = Hash.new
|
13
13
|
@templates = Hash.new
|
14
|
-
@aliases = Hash.new
|
15
14
|
@group = nil
|
16
15
|
end
|
17
16
|
|
@@ -19,28 +18,24 @@ module Xlogin
|
|
19
18
|
files.each do |file|
|
20
19
|
file = File.expand_path(file)
|
21
20
|
next unless File.exist?(file) && file =~ /.rb$/
|
22
|
-
|
21
|
+
|
22
|
+
name = File.basename(file, '.rb').scan(/\w+/).join.downcase
|
23
|
+
Xlogin.configure(name) { |firmware| firmware.instance_eval(IO.read(file)) }
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
26
27
|
def get_template(name)
|
27
|
-
|
28
|
-
@templates[name]
|
28
|
+
@templates[name.to_s.downcase]
|
29
29
|
end
|
30
30
|
|
31
31
|
def set_template(name, template)
|
32
|
-
|
33
|
-
@templates[name] = template
|
32
|
+
@templates[name.to_s.downcase] = template
|
34
33
|
end
|
35
34
|
|
36
35
|
def list_templates
|
37
36
|
@templates.keys
|
38
37
|
end
|
39
38
|
|
40
|
-
def alias_template(new_name, name)
|
41
|
-
@aliases[new_name.to_s.downcase] = name.to_s.downcase
|
42
|
-
end
|
43
|
-
|
44
39
|
def source(file)
|
45
40
|
file = File.expand_path(file)
|
46
41
|
return unless File.exist?(file)
|
data/lib/xlogin/templates/ios.rb
CHANGED
@@ -1,18 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
timeout(300)
|
2
|
+
prompt(/[>$#]/)
|
3
|
+
prompt(/yes \/ no: /) do
|
4
|
+
puts (Xlogin.authorized?)? 'y' : 'n'
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
bind(:login) do |password|
|
8
|
+
waitfor(/Password: /) && puts(password)
|
9
|
+
waitfor
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
12
|
+
bind(:enable) do |password|
|
13
|
+
puts('enable')
|
14
|
+
waitfor(/Password: /) && puts(password)
|
15
|
+
waitfor
|
18
16
|
end
|
@@ -1,21 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
os.prompt(/#\z/)
|
1
|
+
timeout(300)
|
2
|
+
prompt(/#\z/)
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
os.hook do |command|
|
13
|
-
if command =~ /^(?:adm |admi |admin )?\s*(?:con|rel|red|cle|hw|ro)/
|
14
|
-
# commands: configure, reload, redundancy, clear, hw-module, rollback
|
15
|
-
# with or without admin prefix is prihibited if not authorized.
|
16
|
-
raise Xlogin::AuthorizationError.new("prohibited command: #{command}") unless Xlogin.authorized?
|
17
|
-
end
|
4
|
+
bind(:login) do |*args|
|
5
|
+
username, password = *args
|
6
|
+
waitfor(/Username: /) && puts(username)
|
7
|
+
waitfor(/Password: /) && puts(password)
|
8
|
+
waitfor
|
9
|
+
end
|
18
10
|
|
19
|
-
|
11
|
+
hook do |command|
|
12
|
+
if command =~ /^(?:adm |admi |admin )?\s*(?:con|rel|red|cle|hw|ro)/
|
13
|
+
# commands: configure, reload, redundancy, clear, hw-module, rollback
|
14
|
+
# with or without admin prefix is prihibited if not authorized.
|
15
|
+
raise Xlogin::AuthorizationError.new("prohibited command: #{command}") unless Xlogin.authorized?
|
20
16
|
end
|
17
|
+
|
18
|
+
pass(command)
|
21
19
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
os.prompt(/[>#] \z/)
|
1
|
+
timeout(300)
|
2
|
+
prompt(/[>#] \z/)
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
4
|
+
bind(:login) do |*args|
|
5
|
+
username, password = *args
|
6
|
+
waitfor(/login:\s/) && puts(username)
|
7
|
+
waitfor(/Password:/) && puts(password)
|
8
|
+
waitfor
|
11
9
|
end
|
@@ -1,20 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
timeout(300)
|
2
|
+
prompt(/[>$#] /)
|
3
|
+
prompt(/y\/n:/) do
|
4
|
+
puts (Xlogin.authorized?)? 'y' : 'n'
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
bind(:login) do |*args|
|
8
|
+
username, password = *args
|
9
|
+
waitfor(/Login:\s?/) && puts(username)
|
10
|
+
waitfor(/Password:\s?/) && puts(password)
|
11
|
+
waitfor
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
14
|
+
bind(:enable_admin) do |password|
|
15
|
+
puts('enable-admin')
|
16
|
+
waitfor(/Password:\s?/) && puts(password)
|
17
|
+
waitfor
|
20
18
|
end
|
@@ -1,10 +1,8 @@
|
|
1
|
-
|
2
|
-
os.prompt(/[$#] (?:\e\[K)?\z/n)
|
1
|
+
prompt(/[$#] (?:\e\[K)?\z/n)
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
3
|
+
bind(:login) do |*args|
|
4
|
+
username, password = *args
|
5
|
+
waitfor(/login:\s/) && puts(username)
|
6
|
+
waitfor(/Password:\s/) && puts(password)
|
7
|
+
waitfor
|
10
8
|
end
|
data/lib/xlogin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xlogin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- haccht
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-telnet
|