hrr_rb_ssh 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +27 -0
- data/.rspec +3 -0
- data/.travis.yml +22 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE +201 -0
- data/README.md +47 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/demo/server.rb +134 -0
- data/hrr_rb_ssh.gemspec +27 -0
- data/lib/hrr_rb_ssh/authentication/authenticator.rb +16 -0
- data/lib/hrr_rb_ssh/authentication/method/none/context.rb +28 -0
- data/lib/hrr_rb_ssh/authentication/method/none.rb +38 -0
- data/lib/hrr_rb_ssh/authentication/method/password/context.rb +29 -0
- data/lib/hrr_rb_ssh/authentication/method/password.rb +37 -0
- data/lib/hrr_rb_ssh/authentication/method.rb +21 -0
- data/lib/hrr_rb_ssh/authentication.rb +107 -0
- data/lib/hrr_rb_ssh/closed_authentication_error.rb +7 -0
- data/lib/hrr_rb_ssh/closed_connection_error.rb +7 -0
- data/lib/hrr_rb_ssh/closed_transport_error.rb +7 -0
- data/lib/hrr_rb_ssh/compat.rb +65 -0
- data/lib/hrr_rb_ssh/connection/channel/proc_chain/chain_context.rb +22 -0
- data/lib/hrr_rb_ssh/connection/channel/proc_chain.rb +25 -0
- data/lib/hrr_rb_ssh/connection/channel/session/env/context.rb +43 -0
- data/lib/hrr_rb_ssh/connection/channel/session/env.rb +31 -0
- data/lib/hrr_rb_ssh/connection/channel/session/exec/context.rb +41 -0
- data/lib/hrr_rb_ssh/connection/channel/session/exec.rb +31 -0
- data/lib/hrr_rb_ssh/connection/channel/session/pty_req/context.rb +50 -0
- data/lib/hrr_rb_ssh/connection/channel/session/pty_req.rb +31 -0
- data/lib/hrr_rb_ssh/connection/channel/session/shell/context.rb +37 -0
- data/lib/hrr_rb_ssh/connection/channel/session/shell.rb +31 -0
- data/lib/hrr_rb_ssh/connection/channel/session/subsystem/context.rb +40 -0
- data/lib/hrr_rb_ssh/connection/channel/session/subsystem.rb +31 -0
- data/lib/hrr_rb_ssh/connection/channel/session.rb +31 -0
- data/lib/hrr_rb_ssh/connection/channel.rb +278 -0
- data/lib/hrr_rb_ssh/connection/request_handler.rb +18 -0
- data/lib/hrr_rb_ssh/connection.rb +170 -0
- data/lib/hrr_rb_ssh/logger.rb +52 -0
- data/lib/hrr_rb_ssh/message/001_ssh_msg_disconnect.rb +44 -0
- data/lib/hrr_rb_ssh/message/002_ssh_msg_ignore.rb +24 -0
- data/lib/hrr_rb_ssh/message/003_ssh_msg_unimplemented.rb +24 -0
- data/lib/hrr_rb_ssh/message/004_ssh_msg_debug.rb +26 -0
- data/lib/hrr_rb_ssh/message/005_ssh_msg_service_request.rb +24 -0
- data/lib/hrr_rb_ssh/message/006_ssh_msg_service_accept.rb +24 -0
- data/lib/hrr_rb_ssh/message/020_ssh_msg_kexinit.rb +51 -0
- data/lib/hrr_rb_ssh/message/021_ssh_msg_newkeys.rb +23 -0
- data/lib/hrr_rb_ssh/message/030_ssh_msg_kexdh_init.rb +24 -0
- data/lib/hrr_rb_ssh/message/031_ssh_msg_kexdh_reply.rb +26 -0
- data/lib/hrr_rb_ssh/message/050_ssh_msg_userauth_request.rb +58 -0
- data/lib/hrr_rb_ssh/message/051_ssh_msg_userauth_failure.rb +25 -0
- data/lib/hrr_rb_ssh/message/052_ssh_msg_userauth_success.rb +23 -0
- data/lib/hrr_rb_ssh/message/060_ssh_msg_userauth_pk_ok.rb +25 -0
- data/lib/hrr_rb_ssh/message/080_ssh_msg_global_request.rb +47 -0
- data/lib/hrr_rb_ssh/message/081_ssh_msg_request_success.rb +36 -0
- data/lib/hrr_rb_ssh/message/082_ssh_msg_request_failure.rb +23 -0
- data/lib/hrr_rb_ssh/message/090_ssh_msg_channel_open.rb +67 -0
- data/lib/hrr_rb_ssh/message/091_ssh_msg_channel_open_confirmation.rb +67 -0
- data/lib/hrr_rb_ssh/message/092_ssh_msg_channel_open_failure.rb +34 -0
- data/lib/hrr_rb_ssh/message/093_ssh_msg_channel_window_adjust.rb +25 -0
- data/lib/hrr_rb_ssh/message/094_ssh_msg_channel_data.rb +25 -0
- data/lib/hrr_rb_ssh/message/095_ssh_msg_channel_extended_data.rb +30 -0
- data/lib/hrr_rb_ssh/message/096_ssh_msg_channel_eof.rb +24 -0
- data/lib/hrr_rb_ssh/message/097_ssh_msg_channel_close.rb +24 -0
- data/lib/hrr_rb_ssh/message/098_ssh_msg_channel_request.rb +139 -0
- data/lib/hrr_rb_ssh/message/099_ssh_msg_channel_success.rb +24 -0
- data/lib/hrr_rb_ssh/message/100_ssh_msg_channel_failure.rb +24 -0
- data/lib/hrr_rb_ssh/message/codable.rb +67 -0
- data/lib/hrr_rb_ssh/message.rb +36 -0
- data/lib/hrr_rb_ssh/transport/compression_algorithm/none.rb +33 -0
- data/lib/hrr_rb_ssh/transport/compression_algorithm/zlib.rb +38 -0
- data/lib/hrr_rb_ssh/transport/compression_algorithm.rb +22 -0
- data/lib/hrr_rb_ssh/transport/constant.rb +11 -0
- data/lib/hrr_rb_ssh/transport/data_type.rb +163 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/aes_128_cbc.rb +73 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm/none.rb +49 -0
- data/lib/hrr_rb_ssh/transport/encryption_algorithm.rb +22 -0
- data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman.rb +129 -0
- data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman_group14_sha1.rb +42 -0
- data/lib/hrr_rb_ssh/transport/kex_algorithm/diffie_hellman_group1_sha1.rb +34 -0
- data/lib/hrr_rb_ssh/transport/kex_algorithm.rb +22 -0
- data/lib/hrr_rb_ssh/transport/mac_algorithm/hmac_sha1.rb +45 -0
- data/lib/hrr_rb_ssh/transport/mac_algorithm/none.rb +40 -0
- data/lib/hrr_rb_ssh/transport/mac_algorithm.rb +22 -0
- data/lib/hrr_rb_ssh/transport/mode.rb +11 -0
- data/lib/hrr_rb_ssh/transport/receiver.rb +75 -0
- data/lib/hrr_rb_ssh/transport/sender.rb +57 -0
- data/lib/hrr_rb_ssh/transport/sequence_number.rb +22 -0
- data/lib/hrr_rb_ssh/transport/server_host_key_algorithm/ssh_rsa.rb +108 -0
- data/lib/hrr_rb_ssh/transport/server_host_key_algorithm.rb +21 -0
- data/lib/hrr_rb_ssh/transport.rb +459 -0
- data/lib/hrr_rb_ssh/version.rb +6 -0
- data/lib/hrr_rb_ssh.rb +13 -0
- metadata +193 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_DEBUG
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 4
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_DEBUG'],
|
20
|
+
['boolean', 'always_display'],
|
21
|
+
['string', 'message'],
|
22
|
+
['string', 'language tag'],
|
23
|
+
]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_SERVICE_REQUEST
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 5
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_SERVICE_REQUEST'],
|
20
|
+
['string', 'service name'],
|
21
|
+
]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_SERVICE_ACCEPT
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 6
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_SERVICE_ACCEPT'],
|
20
|
+
['string', 'service name'],
|
21
|
+
]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_KEXINIT
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 20
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_KEXINIT'],
|
20
|
+
['byte', 'cookie (random byte)'],
|
21
|
+
['byte', 'cookie (random byte)'],
|
22
|
+
['byte', 'cookie (random byte)'],
|
23
|
+
['byte', 'cookie (random byte)'],
|
24
|
+
['byte', 'cookie (random byte)'],
|
25
|
+
['byte', 'cookie (random byte)'],
|
26
|
+
['byte', 'cookie (random byte)'],
|
27
|
+
['byte', 'cookie (random byte)'],
|
28
|
+
['byte', 'cookie (random byte)'],
|
29
|
+
['byte', 'cookie (random byte)'],
|
30
|
+
['byte', 'cookie (random byte)'],
|
31
|
+
['byte', 'cookie (random byte)'],
|
32
|
+
['byte', 'cookie (random byte)'],
|
33
|
+
['byte', 'cookie (random byte)'],
|
34
|
+
['byte', 'cookie (random byte)'],
|
35
|
+
['byte', 'cookie (random byte)'],
|
36
|
+
['name-list', 'kex_algorithms'],
|
37
|
+
['name-list', 'server_host_key_algorithms'],
|
38
|
+
['name-list', 'encryption_algorithms_client_to_server'],
|
39
|
+
['name-list', 'encryption_algorithms_server_to_client'],
|
40
|
+
['name-list', 'mac_algorithms_client_to_server'],
|
41
|
+
['name-list', 'mac_algorithms_server_to_client'],
|
42
|
+
['name-list', 'compression_algorithms_client_to_server'],
|
43
|
+
['name-list', 'compression_algorithms_server_to_client'],
|
44
|
+
['name-list', 'languages_client_to_server'],
|
45
|
+
['name-list', 'languages_server_to_client'],
|
46
|
+
['boolean', 'first_kex_packet_follows'],
|
47
|
+
['uint32', '0 (reserved for future extension)'],
|
48
|
+
]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_NEWKEYS
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 21
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_NEWKEYS'],
|
20
|
+
]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_KEXDH_INIT
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 30
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_KEXDH_INIT'],
|
20
|
+
['mpint', 'e'],
|
21
|
+
]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_KEXDH_REPLY
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 31
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_KEXDH_REPLY'],
|
20
|
+
['string', 'server public host key and certificates (K_S)'],
|
21
|
+
['mpint', 'f'],
|
22
|
+
['string', 'signature of H'],
|
23
|
+
]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_USERAUTH_REQUEST
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 50
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_USERAUTH_REQUEST'],
|
20
|
+
['string', 'user name'],
|
21
|
+
['string', 'service name'],
|
22
|
+
['string', 'method name'],
|
23
|
+
]
|
24
|
+
|
25
|
+
PUBLICKEY_DEFINITION = [
|
26
|
+
# [Data Type, Field Name]
|
27
|
+
# ['string', 'method name' : "publickey"],
|
28
|
+
['boolean', 'with signature'],
|
29
|
+
['string', 'public key algorithm name'],
|
30
|
+
['string', 'public key blob'],
|
31
|
+
]
|
32
|
+
|
33
|
+
PUBLICKEY_SIGNATURE_DEFINITION = [
|
34
|
+
# [Data Type, Field Name]
|
35
|
+
# ['string', 'with signature' : "TRUE"],
|
36
|
+
['string', 'signature'],
|
37
|
+
]
|
38
|
+
|
39
|
+
PASSWORD_DEFINITION = [
|
40
|
+
# [Data Type, Field Name]
|
41
|
+
# ['string', 'method name' : "password"],
|
42
|
+
['boolean', 'FALSE'],
|
43
|
+
['string', 'plaintext password'],
|
44
|
+
]
|
45
|
+
|
46
|
+
CONDITIONAL_DEFINITION = {
|
47
|
+
# Field Name => {Field Value => Conditional Definition}
|
48
|
+
'method name' => {
|
49
|
+
'publickey' => PUBLICKEY_DEFINITION,
|
50
|
+
'password' => PASSWORD_DEFINITION,
|
51
|
+
},
|
52
|
+
'with signature' => {
|
53
|
+
true => PUBLICKEY_SIGNATURE_DEFINITION,
|
54
|
+
},
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_USERAUTH_FAILURE
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 51
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_USERAUTH_FAILURE'],
|
20
|
+
['name-list', 'authentications that can continue'],
|
21
|
+
['boolean', 'partial success'],
|
22
|
+
]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_USERAUTH_SUCCESS
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 52
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_USERAUTH_SUCCESS'],
|
20
|
+
]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_USERAUTH_PK_OK
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 60
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_USERAUTH_PK_OK'],
|
20
|
+
['string', 'public key algorithm name from the request'],
|
21
|
+
['string', 'public key blob from the request'],
|
22
|
+
]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_GLOBAL_REQUEST
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 80
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_GLOBAL_REQUEST'],
|
20
|
+
['string', 'request name'],
|
21
|
+
['boolean', 'want reply'],
|
22
|
+
]
|
23
|
+
|
24
|
+
TCPIP_FORWARD_DEFINITION = [
|
25
|
+
# [Data Type, Field Name]
|
26
|
+
# ['string', 'request name' : "tcpip-forward"],
|
27
|
+
['string', 'address to bind'],
|
28
|
+
['uint32', 'port number to bind'],
|
29
|
+
]
|
30
|
+
|
31
|
+
CANCEL_TCPIP_FORWARD_DEFINITION = [
|
32
|
+
# [Data Type, Field Name]
|
33
|
+
# ['string', 'request name' : "cancel-tcpip-forward"],
|
34
|
+
['string', 'address to bind'],
|
35
|
+
['uint32', 'port number to bind'],
|
36
|
+
]
|
37
|
+
|
38
|
+
CONDITIONAL_DEFINITION = {
|
39
|
+
# Field Name => {Field Value => Conditional Definition}
|
40
|
+
'request name' => {
|
41
|
+
'tcpip-forward' => TCPIP_FORWARD_DEFINITION,
|
42
|
+
'cancel-tcpip-forward' => CANCEL_TCPIP_FORWARD_DEFINITION,
|
43
|
+
},
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_REQUEST_SUCCESS
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 81
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_REQUEST_SUCCESS'],
|
20
|
+
]
|
21
|
+
|
22
|
+
TCPIP_FORWARD_DEFINITION = [
|
23
|
+
# [Data Type, Field Name]
|
24
|
+
# ['string', 'request name' : "tcpip-forward"],
|
25
|
+
['uint32', 'port that was bound on the server'],
|
26
|
+
]
|
27
|
+
|
28
|
+
CONDITIONAL_DEFINITION = {
|
29
|
+
# Field Name => {Field Value => Conditional Definition}
|
30
|
+
'request name' => {
|
31
|
+
'tcpip-forward' => TCPIP_FORWARD_DEFINITION,
|
32
|
+
}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_REQUEST_FAILURE
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 82
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_REQUEST_FAILURE'],
|
20
|
+
]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_CHANNEL_OPEN
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 90
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_CHANNEL_OPEN'],
|
20
|
+
['string', 'channel type'],
|
21
|
+
['uint32', 'sender channel'],
|
22
|
+
['uint32', 'initial window size'],
|
23
|
+
['uint32', 'maximum packet size'],
|
24
|
+
]
|
25
|
+
|
26
|
+
SESSION_DEFINITION = [
|
27
|
+
# [Data Type, Field Name]
|
28
|
+
# ['string', 'channel type' : "session"],
|
29
|
+
]
|
30
|
+
|
31
|
+
X11_DEFINITION = [
|
32
|
+
# [Data Type, Field Name]
|
33
|
+
# ['string', 'channel type' : "x11"],
|
34
|
+
['string', 'originator address'],
|
35
|
+
['uint32', 'originator port'],
|
36
|
+
]
|
37
|
+
|
38
|
+
FORWARDED_TCPIP_DEFINITION = [
|
39
|
+
# [Data Type, Field Name]
|
40
|
+
# ['string', 'channel type' : "forwarded-tcpip"],
|
41
|
+
['string', 'address that was connected'],
|
42
|
+
['uint32', 'port that was connected'],
|
43
|
+
['string', 'originator IP address'],
|
44
|
+
['uint32', 'originator port'],
|
45
|
+
]
|
46
|
+
|
47
|
+
DIRECT_TCPIP_DEFINITION = [
|
48
|
+
# [Data Type, Field Name]
|
49
|
+
# ['string', 'channel type' : "direct-tcpip"],
|
50
|
+
['string', 'host to connect'],
|
51
|
+
['uint32', 'port to connect'],
|
52
|
+
['string', 'originator IP address'],
|
53
|
+
['uint32', 'originator port'],
|
54
|
+
]
|
55
|
+
|
56
|
+
CONDITIONAL_DEFINITION = {
|
57
|
+
# Field Name => {Field Value => Conditional Definition}
|
58
|
+
'channel type' => {
|
59
|
+
'session' => SESSION_DEFINITION,
|
60
|
+
'x11' => X11_DEFINITION,
|
61
|
+
'forwarded-tcpip' => FORWARDED_TCPIP_DEFINITION,
|
62
|
+
'direct-tcpip' => DIRECT_TCPIP_DEFINITION,
|
63
|
+
},
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_CHANNEL_OPEN_CONFIRMATION
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 91
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_CHANNEL_OPEN_CONFIRMATION'],
|
20
|
+
['uint32', 'recipient channel'],
|
21
|
+
['uint32', 'sender channel'],
|
22
|
+
['uint32', 'initial window size'],
|
23
|
+
['uint32', 'maximum packet size'],
|
24
|
+
]
|
25
|
+
|
26
|
+
SESSION_DEFINITION = [
|
27
|
+
# [Data Type, Field Name]
|
28
|
+
# ['string', 'channel type' : "session"],
|
29
|
+
]
|
30
|
+
|
31
|
+
X11_DEFINITION = [
|
32
|
+
# [Data Type, Field Name]
|
33
|
+
# ['string', 'channel type' : "x11"],
|
34
|
+
['string', 'originator address'],
|
35
|
+
['uint32', 'originator port'],
|
36
|
+
]
|
37
|
+
|
38
|
+
FORWARDED_TCPIP_DEFINITION = [
|
39
|
+
# [Data Type, Field Name]
|
40
|
+
# ['string', 'channel type' : "forwarded-tcpip"],
|
41
|
+
['string', 'address that was connected'],
|
42
|
+
['uint32', 'port that was connected'],
|
43
|
+
['string', 'originator IP address'],
|
44
|
+
['uint32', 'originator port'],
|
45
|
+
]
|
46
|
+
|
47
|
+
DIRECT_TCPIP_DEFINITION = [
|
48
|
+
# [Data Type, Field Name]
|
49
|
+
# ['string', 'channel type' : "direct-tcpip"],
|
50
|
+
['string', 'host to connect'],
|
51
|
+
['uint32', 'port to connect'],
|
52
|
+
['string', 'originator IP address'],
|
53
|
+
['uint32', 'originator port'],
|
54
|
+
]
|
55
|
+
|
56
|
+
CONDITIONAL_DEFINITION = {
|
57
|
+
# Field Name => {Field Value => Conditional Definition}
|
58
|
+
'channel type' => {
|
59
|
+
'session' => SESSION_DEFINITION,
|
60
|
+
'x11' => X11_DEFINITION,
|
61
|
+
'forwarded-tcpip' => FORWARDED_TCPIP_DEFINITION,
|
62
|
+
'direct-tcpip' => DIRECT_TCPIP_DEFINITION,
|
63
|
+
},
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_CHANNEL_OPEN_FAILURE
|
10
|
+
module ReasonCode
|
11
|
+
SSH_OPEN_ADMINISTRATIVELY_PROHIBITED = 1
|
12
|
+
SSH_OPEN_CONNECT_FAILED = 2
|
13
|
+
SSH_OPEN_UNKNOWN_CHANNEL_TYPE = 3
|
14
|
+
SSH_OPEN_RESOURCE_SHORTAGE = 4
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
include Codable
|
19
|
+
end
|
20
|
+
|
21
|
+
ID = self.name.split('::').last
|
22
|
+
VALUE = 92
|
23
|
+
|
24
|
+
DEFINITION = [
|
25
|
+
# [Data Type, Field Name]
|
26
|
+
['byte', 'SSH_MSG_CHANNEL_OPEN_FAILURE'],
|
27
|
+
['uint32', 'recipient channel'],
|
28
|
+
['uint32', 'reason code'],
|
29
|
+
['string', 'description'],
|
30
|
+
['string', 'language tag'],
|
31
|
+
]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_CHANNEL_WINDOW_ADJUST
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 93
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_CHANNEL_WINDOW_ADJUST'],
|
20
|
+
['uint32', 'recipient channel'],
|
21
|
+
['uint32', 'bytes to add'],
|
22
|
+
]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# vim: et ts=2 sw=2
|
3
|
+
|
4
|
+
require 'hrr_rb_ssh/logger'
|
5
|
+
require 'hrr_rb_ssh/message/codable'
|
6
|
+
|
7
|
+
module HrrRbSsh
|
8
|
+
module Message
|
9
|
+
module SSH_MSG_CHANNEL_DATA
|
10
|
+
class << self
|
11
|
+
include Codable
|
12
|
+
end
|
13
|
+
|
14
|
+
ID = self.name.split('::').last
|
15
|
+
VALUE = 94
|
16
|
+
|
17
|
+
DEFINITION = [
|
18
|
+
# [Data Type, Field Name]
|
19
|
+
['byte', 'SSH_MSG_CHANNEL_DATA'],
|
20
|
+
['uint32', 'recipient channel'],
|
21
|
+
['string', 'data'],
|
22
|
+
]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|