cow 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cow.rb +6 -3
- data/lib/cow/plugins/acs.rb +21 -7
- data/lib/cow/plugins/acs5000.rb +22 -7
- data/lib/cow/plugins/acs6000.rb +22 -7
- data/lib/cow/version.rb +1 -1
- metadata +2 -2
data/lib/cow.rb
CHANGED
@@ -7,9 +7,12 @@ require 'cow/plugins/cisco'
|
|
7
7
|
|
8
8
|
module Cow
|
9
9
|
SERVER_TYPES = {
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
acs_telnet: Cow::ACS::Telnet::Server,
|
11
|
+
acs_ssh: Cow::ACS::SSH::Server,
|
12
|
+
acs5000_telnet: Cow::ACS5000::Telnet::Server,
|
13
|
+
acs5000_ssh: Cow::ACS5000::SSH::Server,
|
14
|
+
acs6000_telnet: Cow::ACS6000::Telnet::Server,
|
15
|
+
acs6000_ssh: Cow::ACS6000::SSH::Server,
|
13
16
|
digi_ts_telnet: Cow::DIGI_TS::Telnet::Server,
|
14
17
|
cisco_telnet: Cow::Cisco::Telnet::Server,
|
15
18
|
cisco_ssh: Cow::Cisco::SSH::Server
|
data/lib/cow/plugins/acs.rb
CHANGED
@@ -9,18 +9,12 @@ module Cow
|
|
9
9
|
class Port < Cow::Tmpl::Port
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
module Server
|
13
13
|
def port(_port)
|
14
14
|
return _port if _port.class == Cow::ACS::Port
|
15
15
|
super
|
16
16
|
end
|
17
17
|
|
18
|
-
def connect_command(_port, _user = ENV['USER'])
|
19
|
-
"ssh -l #{_user}:#{port(_port).tcp_port} #{@hostname}"
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
18
|
def get_ports
|
25
19
|
ret = []
|
26
20
|
snmp do |s|
|
@@ -38,5 +32,25 @@ module Cow
|
|
38
32
|
ret
|
39
33
|
end
|
40
34
|
end
|
35
|
+
|
36
|
+
module Telnet
|
37
|
+
class Server < Cow::Tmpl::Server
|
38
|
+
include Cow::ACS::Server
|
39
|
+
|
40
|
+
def connect_command(_port, _user = ENV['USER'])
|
41
|
+
"telnet #{@hostname} #{port(_port).tcp_port}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
module SSH
|
47
|
+
class Server < Cow::Tmpl::Server
|
48
|
+
include Cow::ACS::Server
|
49
|
+
|
50
|
+
def connect_command(_port, _user = ENV['USER'])
|
51
|
+
"ssh -l #{_user}:#{port(_port).tcp_port} #{@hostname}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
41
55
|
end
|
42
56
|
end
|
data/lib/cow/plugins/acs5000.rb
CHANGED
@@ -9,23 +9,18 @@ module Cow
|
|
9
9
|
class Port < Cow::Tmpl::Port
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
module Server
|
13
13
|
def port(_port)
|
14
14
|
return _port if _port.class == Cow::ACS5000::Port
|
15
15
|
super
|
16
16
|
end
|
17
17
|
|
18
|
-
def connect_command(_port, _user = ENV['USER'])
|
19
|
-
"ssh -l #{_user}:#{port(_port).tcp_port} #{@hostname}"
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
18
|
def get_ports
|
25
19
|
ret = []
|
26
20
|
snmp do |s|
|
27
21
|
s.walk(OID_DESCRIPTION_LIST) do |x|
|
28
22
|
next if x.name.last.zero?
|
23
|
+
next unless (/^[0-9a-f]{2}-[0-9a-f]{2}-[0-9a-f]{2}P[0-9]+$/ =~ x.value.to_s).nil?
|
29
24
|
port = x.name.last
|
30
25
|
name = x.value.to_s
|
31
26
|
tcp_port = snmp { |s| break s.get_value(OID_TCPPORT_LIST + ".#{port}") }
|
@@ -37,5 +32,25 @@ module Cow
|
|
37
32
|
ret
|
38
33
|
end
|
39
34
|
end
|
35
|
+
|
36
|
+
module Telnet
|
37
|
+
class Server < Cow::Tmpl::Server
|
38
|
+
include Cow::ACS5000::Server
|
39
|
+
|
40
|
+
def connect_command(_port, _user = ENV['USER'])
|
41
|
+
"telnet #{@hostname} #{port(_port).tcp_port}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
module SSH
|
47
|
+
class Server < Cow::Tmpl::Server
|
48
|
+
include Cow::ACS5000::Server
|
49
|
+
|
50
|
+
def connect_command(_port, _user = ENV['USER'])
|
51
|
+
"ssh -l #{_user}:#{port(_port).tcp_port} #{@hostname}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
40
55
|
end
|
41
56
|
end
|
data/lib/cow/plugins/acs6000.rb
CHANGED
@@ -9,23 +9,18 @@ module Cow
|
|
9
9
|
class Port < Cow::Tmpl::Port
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
module Server
|
13
13
|
def port(_port)
|
14
14
|
return _port if _port.class == Cow::ACS6000::Port
|
15
15
|
super
|
16
16
|
end
|
17
17
|
|
18
|
-
def connect_command(_port, _user = ENV['USER'])
|
19
|
-
"ssh -l #{_user}:#{port(_port).tcp_port} #{@hostname}"
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
18
|
def get_ports
|
25
19
|
ret = []
|
26
20
|
snmp do |s|
|
27
21
|
s.walk(OID_DESCRIPTION_LIST) do |x|
|
28
22
|
next if x.name.last.zero?
|
23
|
+
next unless (/^[0-9a-f]{2}-[0-9a-f]{2}-[0-9a-f]{2}-p-[0-9]+$/ =~ x.value.to_s).nil?
|
29
24
|
port = x.name.last
|
30
25
|
name = x.value.to_s
|
31
26
|
tcp_port = TCP_PORT_OFFSET + port.to_i
|
@@ -37,5 +32,25 @@ module Cow
|
|
37
32
|
ret
|
38
33
|
end
|
39
34
|
end
|
35
|
+
|
36
|
+
module Telnet
|
37
|
+
class Server < Cow::Tmpl::Server
|
38
|
+
include Cow::ACS6000::Server
|
39
|
+
|
40
|
+
def connect_command(_port, _user = ENV['USER'])
|
41
|
+
"telnet #{@hostname} #{port(_port).tcp_port}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
module SSH
|
47
|
+
class Server < Cow::Tmpl::Server
|
48
|
+
include Cow::ACS6000::Server
|
49
|
+
|
50
|
+
def connect_command(_port, _user = ENV['USER'])
|
51
|
+
"ssh -l #{_user}:#{port(_port).tcp_port} #{@hostname}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
40
55
|
end
|
41
56
|
end
|
data/lib/cow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|