hrr_rb_ssh 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/demo/server.rb +13 -1
- data/lib/hrr_rb_ssh/authentication/method/none/context.rb +1 -1
- data/lib/hrr_rb_ssh/authentication/method/none.rb +4 -4
- data/lib/hrr_rb_ssh/authentication/method/password/context.rb +1 -1
- data/lib/hrr_rb_ssh/authentication/method/password.rb +4 -4
- data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/codable.rb +5 -5
- data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/ssh_dss.rb +29 -18
- data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/ssh_rsa.rb +27 -16
- data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm.rb +7 -13
- data/lib/hrr_rb_ssh/authentication/method/publickey/context.rb +1 -1
- data/lib/hrr_rb_ssh/authentication/method/publickey.rb +5 -5
- data/lib/hrr_rb_ssh/authentication/method.rb +6 -12
- data/lib/hrr_rb_ssh/authentication.rb +1 -1
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env/context.rb +2 -2
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/env.rb +2 -3
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec/context.rb +2 -2
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/exec.rb +2 -3
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req/context.rb +2 -2
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/pty_req.rb +2 -3
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell/context.rb +2 -2
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/shell.rb +2 -3
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem/context.rb +2 -2
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/subsystem.rb +2 -3
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type.rb +16 -11
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session.rb +1 -15
- data/lib/hrr_rb_ssh/connection/channel/channel_type.rb +15 -10
- data/lib/hrr_rb_ssh/connection/channel.rb +1 -1
- data/lib/hrr_rb_ssh/data_type.rb +153 -0
- data/lib/hrr_rb_ssh/message/001_ssh_msg_disconnect.rb +6 -6
- data/lib/hrr_rb_ssh/message/002_ssh_msg_ignore.rb +4 -4
- data/lib/hrr_rb_ssh/message/003_ssh_msg_unimplemented.rb +4 -4
- data/lib/hrr_rb_ssh/message/004_ssh_msg_debug.rb +6 -6
- data/lib/hrr_rb_ssh/message/005_ssh_msg_service_request.rb +4 -4
- data/lib/hrr_rb_ssh/message/006_ssh_msg_service_accept.rb +4 -4
- data/lib/hrr_rb_ssh/message/020_ssh_msg_kexinit.rb +31 -31
- data/lib/hrr_rb_ssh/message/021_ssh_msg_newkeys.rb +3 -3
- data/lib/hrr_rb_ssh/message/030_ssh_msg_kexdh_init.rb +4 -4
- data/lib/hrr_rb_ssh/message/031_ssh_msg_kexdh_reply.rb +6 -6
- data/lib/hrr_rb_ssh/message/050_ssh_msg_userauth_request.rb +18 -18
- data/lib/hrr_rb_ssh/message/051_ssh_msg_userauth_failure.rb +5 -5
- data/lib/hrr_rb_ssh/message/052_ssh_msg_userauth_success.rb +3 -3
- data/lib/hrr_rb_ssh/message/060_ssh_msg_userauth_pk_ok.rb +5 -5
- data/lib/hrr_rb_ssh/message/080_ssh_msg_global_request.rb +13 -13
- data/lib/hrr_rb_ssh/message/081_ssh_msg_request_success.rb +6 -6
- data/lib/hrr_rb_ssh/message/082_ssh_msg_request_failure.rb +3 -3
- data/lib/hrr_rb_ssh/message/090_ssh_msg_channel_open.rb +25 -25
- data/lib/hrr_rb_ssh/message/091_ssh_msg_channel_open_confirmation.rb +25 -25
- data/lib/hrr_rb_ssh/message/092_ssh_msg_channel_open_failure.rb +7 -7
- data/lib/hrr_rb_ssh/message/093_ssh_msg_channel_window_adjust.rb +5 -5
- data/lib/hrr_rb_ssh/message/094_ssh_msg_channel_data.rb +5 -5
- data/lib/hrr_rb_ssh/message/095_ssh_msg_channel_extended_data.rb +6 -6
- data/lib/hrr_rb_ssh/message/096_ssh_msg_channel_eof.rb +4 -4
- data/lib/hrr_rb_ssh/message/097_ssh_msg_channel_close.rb +4 -4
- data/lib/hrr_rb_ssh/message/098_ssh_msg_channel_request.rb +53 -53
- data/lib/hrr_rb_ssh/message/099_ssh_msg_channel_success.rb +4 -4
- data/lib/hrr_rb_ssh/message/100_ssh_msg_channel_failure.rb +4 -4
- data/lib/hrr_rb_ssh/message/codable.rb +2 -3
- data/lib/hrr_rb_ssh/subclass_with_preference_listable.rb +29 -0
- data/lib/hrr_rb_ssh/transport/compression_algorithm/functionable.rb +4 -4
- data/lib/hrr_rb_ssh/transport/compression_algorithm/none.rb +1 -6
- data/lib/hrr_rb_ssh/transport/compression_algorithm/unfunctionable.rb +4 -0
- data/lib/hrr_rb_ssh/transport/compression_algorithm/zlib.rb +1 -6
- data/lib/hrr_rb_ssh/transport/compression_algorithm.rb +5 -11
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes128_cbc.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes128_ctr.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes192_cbc.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes192_ctr.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes256_cbc.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes256_ctr.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/arcfour.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/blowfish_cbc.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/cast128_cbc.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/functionable.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/none.rb +1 -6
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/three_des_cbc.rb +1 -2
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/unfunctionable.rb +6 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm.rb +5 -11
- data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman.rb +14 -14
- data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman_group14_sha1.rb +2 -5
- data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman_group1_sha1.rb +2 -5
- data/lib/hrr_rb_ssh/transport/kex_algorithm.rb +5 -10
- data/lib/hrr_rb_ssh/transport/mac_algorithm/functionable.rb +2 -3
- data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_md5.rb +3 -5
- data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_md5_96.rb +3 -5
- data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_sha1.rb +3 -5
- data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_sha1_96.rb +3 -5
- data/lib/hrr_rb_ssh/transport/mac_algorithm/none.rb +2 -8
- data/lib/hrr_rb_ssh/transport/mac_algorithm/unfunctionable.rb +4 -0
- data/lib/hrr_rb_ssh/transport/mac_algorithm.rb +5 -11
- data/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ssh_dss.rb +14 -13
- data/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ssh_rsa.rb +12 -11
- data/lib/hrr_rb_ssh/transport/server_host_key_algorithm.rb +5 -10
- data/lib/hrr_rb_ssh/transport.rb +147 -108
- data/lib/hrr_rb_ssh/version.rb +1 -1
- metadata +4 -12
- data/lib/hrr_rb_ssh/authentication/method/method.rb +0 -34
- data/lib/hrr_rb_ssh/authentication/method/publickey/algorithm/algorithm.rb +0 -41
- data/lib/hrr_rb_ssh/connection/channel/channel_type/channel_type.rb +0 -30
- data/lib/hrr_rb_ssh/connection/channel/channel_type/session/request_type/request_type.rb +0 -34
- data/lib/hrr_rb_ssh/transport/compression_algorithm/compression_algorithm.rb +0 -34
- data/lib/hrr_rb_ssh/transport/data_type.rb +0 -163
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/encryption_algorithm.rb +0 -34
- data/lib/hrr_rb_ssh/transport/kex_algorithm/kex_algorithm.rb +0 -34
- data/lib/hrr_rb_ssh/transport/mac_algorithm/mac_algorithm.rb +0 -34
- data/lib/hrr_rb_ssh/transport/server_host_key_algorithm/server_host_key_algorithm.rb +0 -34
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -15,14 +15,14 @@ module HrrRbSsh
|
|
15
15
|
VALUE = 81
|
16
16
|
|
17
17
|
DEFINITION = [
|
18
|
-
#
|
19
|
-
[
|
18
|
+
#[DataType, Field Name]
|
19
|
+
[DataType::Byte, 'message number'],
|
20
20
|
]
|
21
21
|
|
22
22
|
TCPIP_FORWARD_DEFINITION = [
|
23
|
-
#
|
24
|
-
#
|
25
|
-
[
|
23
|
+
#[DataType, Field Name]
|
24
|
+
#[DataType::String, 'request name' : "tcpip-forward"],
|
25
|
+
[DataType::Uint32, 'port that was bound on the server'],
|
26
26
|
]
|
27
27
|
|
28
28
|
CONDITIONAL_DEFINITION = {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -15,8 +15,8 @@ module HrrRbSsh
|
|
15
15
|
VALUE = 82
|
16
16
|
|
17
17
|
DEFINITION = [
|
18
|
-
#
|
19
|
-
[
|
18
|
+
#[DataType, Field Name]
|
19
|
+
[DataType::Byte, 'message number'],
|
20
20
|
]
|
21
21
|
end
|
22
22
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -15,42 +15,42 @@ module HrrRbSsh
|
|
15
15
|
VALUE = 90
|
16
16
|
|
17
17
|
DEFINITION = [
|
18
|
-
#
|
19
|
-
[
|
20
|
-
[
|
21
|
-
[
|
22
|
-
[
|
23
|
-
[
|
18
|
+
#[DataType, Field Name]
|
19
|
+
[DataType::Byte, 'message number'],
|
20
|
+
[DataType::String, 'channel type'],
|
21
|
+
[DataType::Uint32, 'sender channel'],
|
22
|
+
[DataType::Uint32, 'initial window size'],
|
23
|
+
[DataType::Uint32, 'maximum packet size'],
|
24
24
|
]
|
25
25
|
|
26
26
|
SESSION_DEFINITION = [
|
27
|
-
#
|
28
|
-
#
|
27
|
+
#[DataType, Field Name]
|
28
|
+
#[DataType::String, 'channel type' : "session"],
|
29
29
|
]
|
30
30
|
|
31
31
|
X11_DEFINITION = [
|
32
|
-
#
|
33
|
-
#
|
34
|
-
[
|
35
|
-
[
|
32
|
+
#[DataType, Field Name]
|
33
|
+
#[DataType::String, 'channel type' : "x11"],
|
34
|
+
[DataType::String, 'originator address'],
|
35
|
+
[DataType::Uint32, 'originator port'],
|
36
36
|
]
|
37
37
|
|
38
38
|
FORWARDED_TCPIP_DEFINITION = [
|
39
|
-
#
|
40
|
-
#
|
41
|
-
[
|
42
|
-
[
|
43
|
-
[
|
44
|
-
[
|
39
|
+
#[DataType, Field Name]
|
40
|
+
#[DataType::String, 'channel type' : "forwarded-tcpip"],
|
41
|
+
[DataType::String, 'address that was connected'],
|
42
|
+
[DataType::Uint32, 'port that was connected'],
|
43
|
+
[DataType::String, 'originator IP address'],
|
44
|
+
[DataType::Uint32, 'originator port'],
|
45
45
|
]
|
46
46
|
|
47
47
|
DIRECT_TCPIP_DEFINITION = [
|
48
|
-
#
|
49
|
-
#
|
50
|
-
[
|
51
|
-
[
|
52
|
-
[
|
53
|
-
[
|
48
|
+
#[DataType, Field Name]
|
49
|
+
#[DataType::String, 'channel type' : "direct-tcpip"],
|
50
|
+
[DataType::String, 'host to connect'],
|
51
|
+
[DataType::Uint32, 'port to connect'],
|
52
|
+
[DataType::String, 'originator IP address'],
|
53
|
+
[DataType::Uint32, 'originator port'],
|
54
54
|
]
|
55
55
|
|
56
56
|
CONDITIONAL_DEFINITION = {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -15,42 +15,42 @@ module HrrRbSsh
|
|
15
15
|
VALUE = 91
|
16
16
|
|
17
17
|
DEFINITION = [
|
18
|
-
#
|
19
|
-
[
|
20
|
-
[
|
21
|
-
[
|
22
|
-
[
|
23
|
-
[
|
18
|
+
#[DataType, Field Name]
|
19
|
+
[DataType::Byte, 'message number'],
|
20
|
+
[DataType::Uint32, 'recipient channel'],
|
21
|
+
[DataType::Uint32, 'sender channel'],
|
22
|
+
[DataType::Uint32, 'initial window size'],
|
23
|
+
[DataType::Uint32, 'maximum packet size'],
|
24
24
|
]
|
25
25
|
|
26
26
|
SESSION_DEFINITION = [
|
27
|
-
#
|
28
|
-
#
|
27
|
+
#[DataType, Field Name]
|
28
|
+
#[DataType::String, 'channel type' : "session"],
|
29
29
|
]
|
30
30
|
|
31
31
|
X11_DEFINITION = [
|
32
|
-
#
|
33
|
-
#
|
34
|
-
[
|
35
|
-
[
|
32
|
+
#[DataType, Field Name]
|
33
|
+
#[DataType::String, 'channel type' : "x11"],
|
34
|
+
[DataType::String, 'originator address'],
|
35
|
+
[DataType::Uint32, 'originator port'],
|
36
36
|
]
|
37
37
|
|
38
38
|
FORWARDED_TCPIP_DEFINITION = [
|
39
|
-
#
|
40
|
-
#
|
41
|
-
[
|
42
|
-
[
|
43
|
-
[
|
44
|
-
[
|
39
|
+
#[DataType, Field Name]
|
40
|
+
#[DataType::String, 'channel type' : "forwarded-tcpip"],
|
41
|
+
[DataType::String, 'address that was connected'],
|
42
|
+
[DataType::Uint32, 'port that was connected'],
|
43
|
+
[DataType::String, 'originator IP address'],
|
44
|
+
[DataType::Uint32, 'originator port'],
|
45
45
|
]
|
46
46
|
|
47
47
|
DIRECT_TCPIP_DEFINITION = [
|
48
|
-
#
|
49
|
-
#
|
50
|
-
[
|
51
|
-
[
|
52
|
-
[
|
53
|
-
[
|
48
|
+
#[DataType, Field Name]
|
49
|
+
#[DataType::String, 'channel type' : "direct-tcpip"],
|
50
|
+
[DataType::String, 'host to connect'],
|
51
|
+
[DataType::Uint32, 'port to connect'],
|
52
|
+
[DataType::String, 'originator IP address'],
|
53
|
+
[DataType::Uint32, 'originator port'],
|
54
54
|
]
|
55
55
|
|
56
56
|
CONDITIONAL_DEFINITION = {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -22,12 +22,12 @@ module HrrRbSsh
|
|
22
22
|
VALUE = 92
|
23
23
|
|
24
24
|
DEFINITION = [
|
25
|
-
#
|
26
|
-
[
|
27
|
-
[
|
28
|
-
[
|
29
|
-
[
|
30
|
-
[
|
25
|
+
#[DataType, Field Name]
|
26
|
+
[DataType::Byte, 'message number'],
|
27
|
+
[DataType::Uint32, 'recipient channel'],
|
28
|
+
[DataType::Uint32, 'reason code'],
|
29
|
+
[DataType::String, 'description'],
|
30
|
+
[DataType::String, 'language tag'],
|
31
31
|
]
|
32
32
|
end
|
33
33
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -15,10 +15,10 @@ module HrrRbSsh
|
|
15
15
|
VALUE = 93
|
16
16
|
|
17
17
|
DEFINITION = [
|
18
|
-
#
|
19
|
-
[
|
20
|
-
[
|
21
|
-
[
|
18
|
+
#[DataType, Field Name]
|
19
|
+
[DataType::Byte, 'message number'],
|
20
|
+
[DataType::Uint32, 'recipient channel'],
|
21
|
+
[DataType::Uint32, 'bytes to add'],
|
22
22
|
]
|
23
23
|
end
|
24
24
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -15,10 +15,10 @@ module HrrRbSsh
|
|
15
15
|
VALUE = 94
|
16
16
|
|
17
17
|
DEFINITION = [
|
18
|
-
#
|
19
|
-
[
|
20
|
-
[
|
21
|
-
[
|
18
|
+
#[DataType, Field Name]
|
19
|
+
[DataType::Byte, 'message number'],
|
20
|
+
[DataType::Uint32, 'recipient channel'],
|
21
|
+
[DataType::String, 'data'],
|
22
22
|
]
|
23
23
|
end
|
24
24
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -19,11 +19,11 @@ module HrrRbSsh
|
|
19
19
|
VALUE = 95
|
20
20
|
|
21
21
|
DEFINITION = [
|
22
|
-
#
|
23
|
-
[
|
24
|
-
[
|
25
|
-
[
|
26
|
-
[
|
22
|
+
#[DataType, Field Name]
|
23
|
+
[DataType::Byte, 'message number'],
|
24
|
+
[DataType::Uint32, 'recipient channel'],
|
25
|
+
[DataType::Uint32, 'data type code'],
|
26
|
+
[DataType::String, 'data'],
|
27
27
|
]
|
28
28
|
end
|
29
29
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -15,9 +15,9 @@ module HrrRbSsh
|
|
15
15
|
VALUE = 96
|
16
16
|
|
17
17
|
DEFINITION = [
|
18
|
-
#
|
19
|
-
[
|
20
|
-
[
|
18
|
+
#[DataType, Field Name]
|
19
|
+
[DataType::Byte, 'message number'],
|
20
|
+
[DataType::Uint32, 'recipient channel'],
|
21
21
|
]
|
22
22
|
end
|
23
23
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -15,9 +15,9 @@ module HrrRbSsh
|
|
15
15
|
VALUE = 97
|
16
16
|
|
17
17
|
DEFINITION = [
|
18
|
-
#
|
19
|
-
[
|
20
|
-
[
|
18
|
+
#[DataType, Field Name]
|
19
|
+
[DataType::Byte, 'message number'],
|
20
|
+
[DataType::Uint32, 'recipient channel'],
|
21
21
|
]
|
22
22
|
end
|
23
23
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -31,91 +31,91 @@ module HrrRbSsh
|
|
31
31
|
VALUE = 98
|
32
32
|
|
33
33
|
DEFINITION = [
|
34
|
-
#
|
35
|
-
[
|
36
|
-
[
|
37
|
-
[
|
38
|
-
[
|
34
|
+
#[DataType, Field Name]
|
35
|
+
[DataType::Byte, 'message number'],
|
36
|
+
[DataType::Uint32, 'recipient channel'],
|
37
|
+
[DataType::String, 'request type'],
|
38
|
+
[DataType::Boolean, 'want reply'],
|
39
39
|
]
|
40
40
|
|
41
41
|
PTY_REQ_DEFINITION = [
|
42
|
-
#
|
43
|
-
#
|
44
|
-
[
|
45
|
-
[
|
46
|
-
[
|
47
|
-
[
|
48
|
-
[
|
49
|
-
[
|
42
|
+
#[DataType, Field Name]
|
43
|
+
#[DataType::String, 'request type' : "pty-req"],
|
44
|
+
[DataType::String, 'TERM environment variable value'],
|
45
|
+
[DataType::Uint32, 'terminal width, characters'],
|
46
|
+
[DataType::Uint32, 'terminal height, rows'],
|
47
|
+
[DataType::Uint32, 'terminal width, pixels'],
|
48
|
+
[DataType::Uint32, 'terminal height, pixels'],
|
49
|
+
[DataType::String, 'encoded terminal modes'],
|
50
50
|
]
|
51
51
|
|
52
52
|
X11_REQ_DEFINITION = [
|
53
|
-
#
|
54
|
-
#
|
55
|
-
[
|
56
|
-
[
|
57
|
-
[
|
58
|
-
[
|
53
|
+
#[DataType, Field Name]
|
54
|
+
#[DataType::String, 'request type' : "x11-req"],
|
55
|
+
[DataType::Boolean, 'single connection'],
|
56
|
+
[DataType::String, 'x11 authentication protocol'],
|
57
|
+
[DataType::String, 'x11 authentication cookie'],
|
58
|
+
[DataType::Uint32, 'x11 screen number'],
|
59
59
|
]
|
60
60
|
|
61
61
|
ENV_DEFINITION = [
|
62
|
-
#
|
63
|
-
#
|
64
|
-
[
|
65
|
-
[
|
62
|
+
#[DataType, Field Name]
|
63
|
+
#[DataType::String, 'request type' : "env"],
|
64
|
+
[DataType::String, 'variable name'],
|
65
|
+
[DataType::String, 'variable value'],
|
66
66
|
]
|
67
67
|
|
68
68
|
SHELL_DEFINITION = [
|
69
|
-
#
|
70
|
-
#
|
69
|
+
#[DataType, Field Name]
|
70
|
+
#[DataType::String, 'request type' : "shell"],
|
71
71
|
]
|
72
72
|
|
73
73
|
EXEC_DEFINITION = [
|
74
|
-
#
|
75
|
-
#
|
76
|
-
[
|
74
|
+
#[DataType, Field Name]
|
75
|
+
#[DataType::String, 'request type' : "exec"],
|
76
|
+
[DataType::String, 'command'],
|
77
77
|
]
|
78
78
|
|
79
79
|
SUBSYSTEM_DEFINITION = [
|
80
|
-
#
|
81
|
-
#
|
82
|
-
[
|
80
|
+
#[DataType, Field Name]
|
81
|
+
#[DataType::String, 'request type' : "subsystem"],
|
82
|
+
[DataType::String, 'subsystem name'],
|
83
83
|
]
|
84
84
|
|
85
85
|
WINDOW_CHANGE_DEFINITION = [
|
86
|
-
#
|
87
|
-
#
|
88
|
-
[
|
89
|
-
[
|
90
|
-
[
|
91
|
-
[
|
86
|
+
#[DataType, Field Name]
|
87
|
+
#[DataType::String, 'request type' : "window-change"],
|
88
|
+
[DataType::Uint32, 'terminal width, columns'],
|
89
|
+
[DataType::Uint32, 'terminal height, rows'],
|
90
|
+
[DataType::Uint32, 'terminal width, pixels'],
|
91
|
+
[DataType::Uint32, 'terminal height, pixels'],
|
92
92
|
]
|
93
93
|
|
94
94
|
XON_XOFF_DEFINITION = [
|
95
|
-
#
|
96
|
-
#
|
97
|
-
[
|
95
|
+
#[DataType, Field Name]
|
96
|
+
#[DataType::String, 'request type' : "xon-xoff"],
|
97
|
+
[DataType::Boolean, 'client can do'],
|
98
98
|
]
|
99
99
|
|
100
100
|
SIGNAL_DEFINITION = [
|
101
|
-
#
|
102
|
-
#
|
103
|
-
[
|
101
|
+
#[DataType, Field Name]
|
102
|
+
#[DataType::String, 'request type' : "signal"],
|
103
|
+
[DataType::String, 'signal name'],
|
104
104
|
]
|
105
105
|
|
106
106
|
EXIT_STATUS_DEFINITION = [
|
107
|
-
#
|
108
|
-
#
|
109
|
-
[
|
107
|
+
#[DataType, Field Name]
|
108
|
+
#[DataType::String, 'request type' : "exit-status"],
|
109
|
+
[DataType::Uint32, 'exit status'],
|
110
110
|
]
|
111
111
|
|
112
112
|
EXIT_SIGNAL_DEFINITION = [
|
113
|
-
#
|
114
|
-
#
|
115
|
-
[
|
116
|
-
[
|
117
|
-
[
|
118
|
-
[
|
113
|
+
#[DataType, Field Name]
|
114
|
+
#[DataType::String, 'request type' : "exit-signal"],
|
115
|
+
[DataType::String, 'signal name'],
|
116
|
+
[DataType::Boolean, 'core dumped'],
|
117
|
+
[DataType::String, 'error message'],
|
118
|
+
[DataType::String, 'language tag'],
|
119
119
|
]
|
120
120
|
|
121
121
|
CONDITIONAL_DEFINITION = {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -15,9 +15,9 @@ module HrrRbSsh
|
|
15
15
|
VALUE = 99
|
16
16
|
|
17
17
|
DEFINITION = [
|
18
|
-
#
|
19
|
-
[
|
20
|
-
[
|
18
|
+
#[DataType, Field Name]
|
19
|
+
[DataType::Byte, 'message number'],
|
20
|
+
[DataType::Uint32, 'recipient channel'],
|
21
21
|
]
|
22
22
|
end
|
23
23
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/
|
4
|
+
require 'hrr_rb_ssh/data_type'
|
5
5
|
require 'hrr_rb_ssh/message/codable'
|
6
6
|
|
7
7
|
module HrrRbSsh
|
@@ -15,9 +15,9 @@ module HrrRbSsh
|
|
15
15
|
VALUE = 100
|
16
16
|
|
17
17
|
DEFINITION = [
|
18
|
-
#
|
19
|
-
[
|
20
|
-
[
|
18
|
+
#[DataType, Field Name]
|
19
|
+
[DataType::Byte, 'message number'],
|
20
|
+
[DataType::Uint32, 'recipient channel'],
|
21
21
|
]
|
22
22
|
end
|
23
23
|
end
|
@@ -2,7 +2,6 @@
|
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
4
|
require 'hrr_rb_ssh/logger'
|
5
|
-
require 'hrr_rb_ssh/transport/data_type'
|
6
5
|
|
7
6
|
module HrrRbSsh
|
8
7
|
module Message
|
@@ -28,7 +27,7 @@ module HrrRbSsh
|
|
28
27
|
definition = common_definition + conditional_definition(message.merge complementary_message)
|
29
28
|
definition.map{ |data_type, field_name|
|
30
29
|
field_value = if message[field_name].instance_of? ::Proc then message[field_name].call else message[field_name] end
|
31
|
-
|
30
|
+
data_type.encode( field_value )
|
32
31
|
}.join
|
33
32
|
end
|
34
33
|
|
@@ -46,7 +45,7 @@ module HrrRbSsh
|
|
46
45
|
decoded_message = definition.map{ |data_type, field_name|
|
47
46
|
[
|
48
47
|
field_name,
|
49
|
-
|
48
|
+
data_type.decode( payload_io )
|
50
49
|
]
|
51
50
|
}
|
52
51
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
module HrrRbSsh
|
5
|
+
module SubclassWithPreferenceListable
|
6
|
+
def inherited klass
|
7
|
+
@subclass_list.push klass if @subclass_list
|
8
|
+
end
|
9
|
+
|
10
|
+
def [] key
|
11
|
+
__subclass_list__(__method__).find{ |klass| klass::NAME == key }
|
12
|
+
end
|
13
|
+
|
14
|
+
def list_supported
|
15
|
+
__subclass_list__(__method__).map{ |klass| klass::NAME }
|
16
|
+
end
|
17
|
+
|
18
|
+
def list_preferred
|
19
|
+
__subclass_list__(__method__).select{ |klass| klass::PREFERENCE > 0 }.sort_by{ |klass| klass::PREFERENCE }.reverse.map{ |klass| klass::NAME }
|
20
|
+
end
|
21
|
+
|
22
|
+
def __subclass_list__ method_name
|
23
|
+
send(:method_missing, method_name) unless @subclass_list
|
24
|
+
@subclass_list
|
25
|
+
end
|
26
|
+
|
27
|
+
private :__subclass_list__
|
28
|
+
end
|
29
|
+
end
|
@@ -2,18 +2,18 @@
|
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
4
|
require 'zlib'
|
5
|
+
require 'hrr_rb_ssh/logger'
|
5
6
|
|
6
7
|
module HrrRbSsh
|
7
8
|
class Transport
|
8
9
|
class CompressionAlgorithm
|
9
10
|
module Functionable
|
10
11
|
def initialize direction
|
11
|
-
|
12
|
-
|
12
|
+
@logger = HrrRbSsh::Logger.new(self.class.name)
|
13
13
|
case direction
|
14
|
-
when
|
14
|
+
when Direction::OUTGOING
|
15
15
|
@deflator = ::Zlib::Deflate.new
|
16
|
-
when
|
16
|
+
when Direction::INCOMING
|
17
17
|
@inflator = ::Zlib::Inflate.new
|
18
18
|
end
|
19
19
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# vim: et ts=2 sw=2
|
3
3
|
|
4
|
-
require 'hrr_rb_ssh/transport/compression_algorithm/compression_algorithm'
|
5
4
|
require 'hrr_rb_ssh/transport/compression_algorithm/unfunctionable'
|
6
5
|
|
7
6
|
module HrrRbSsh
|
@@ -9,11 +8,7 @@ module HrrRbSsh
|
|
9
8
|
class CompressionAlgorithm
|
10
9
|
class None < CompressionAlgorithm
|
11
10
|
NAME = 'none'
|
12
|
-
|
13
|
-
def initialize direction=nil
|
14
|
-
super
|
15
|
-
end
|
16
|
-
|
11
|
+
PREFERENCE = 20
|
17
12
|
include Unfunctionable
|
18
13
|
end
|
19
14
|
end
|