rlogin 1.0.0 → 1.0.1
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.
- data/lib/rlogin.rb +85 -5
- metadata +3 -3
data/lib/rlogin.rb
CHANGED
@@ -3,20 +3,100 @@ require 'socket'
|
|
3
3
|
module Net
|
4
4
|
# This class implements the BSD Rlogin as it is defined in the RFC 1282.
|
5
5
|
class Rlogin
|
6
|
+
# The server returns a zero byte to indicate that it has received four
|
7
|
+
# null-terminated strings
|
6
8
|
RECEIVED_SETTINGS = 0x00
|
9
|
+
|
10
|
+
# The window change control sequence is 12 bytes in length, consisting
|
11
|
+
# of a magic cookie (two consecutive bytes of hex FF), followed by two
|
12
|
+
# bytes containing lower-case ASCII "s", then 8 bytes containing the
|
13
|
+
# 16-bit values for the number of character rows, the number of
|
14
|
+
# characters per row, the number of pixels in the X direction, and the
|
15
|
+
# number of pixels in the Y direction, in network byte order. Thus:
|
16
|
+
#
|
17
|
+
# FF FF s s rr cc xp yp
|
18
|
+
#
|
19
|
+
# Other flags than "ss" may be used in future for other in-band control
|
20
|
+
# messages. None are currently defined.
|
7
21
|
WINDOW_SIZE_MAGIC_COOKIE = "\xff\xffss"
|
22
|
+
|
23
|
+
# A control byte of hex 02 causes the client to discard all buffered
|
24
|
+
# data received from the server that has not yet been written to the
|
25
|
+
# client user's screen.
|
8
26
|
REQUEST_CLEAR_BUFFER = 0x02
|
27
|
+
|
28
|
+
# A control byte of hex 10 commands the client to switch to "raw"
|
29
|
+
# mode, where the START and STOP characters are no longer handled by
|
30
|
+
# the client, but are instead treated as plain data.
|
9
31
|
REQUEST_SWITCH_TO_RAW = 0x10
|
32
|
+
|
33
|
+
# A control byte of hex 20 commands the client to resume interception
|
34
|
+
# and local processing of START and STOP flow control characters.
|
10
35
|
REQUEST_SWITCH_TO_NORMAL = 0x20
|
36
|
+
|
37
|
+
# The client responds by sending the current window size as above.
|
11
38
|
REQUEST_WINDOW_SIZE = 0x80
|
12
39
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
40
|
+
# hostname, dns or ipadress of the remote server
|
41
|
+
attr_reader :host
|
42
|
+
|
43
|
+
# port of the rlogind daemon on the remote server (DEFAULT: 513)
|
44
|
+
attr_reader :port
|
45
|
+
|
46
|
+
# username used for login
|
47
|
+
attr_reader :username
|
48
|
+
|
49
|
+
# password used for login
|
50
|
+
attr_reader :password
|
51
|
+
|
52
|
+
# the interface to connect from (DEFAULT: 0.0.0.0)
|
53
|
+
attr_reader :local_host
|
54
|
+
|
55
|
+
# the port to connect from (DEFAULT: 1023)
|
56
|
+
attr_reader :local_port
|
57
|
+
|
58
|
+
# client user name (DEFAULT: "")
|
59
|
+
attr_reader :client_user_name
|
60
|
+
|
61
|
+
# server user name (DEFAULT: "")
|
62
|
+
attr_reader :server_user_name
|
63
|
+
|
64
|
+
# the terminal type (DEFAULT: xterm)
|
65
|
+
attr_reader :terminal_type
|
66
|
+
|
67
|
+
# the terminal boud rate (DEFAULT: 38400)
|
68
|
+
attr_reader :speed
|
69
|
+
|
70
|
+
# rows of the emulated terminal (DEFAULT: 24)
|
71
|
+
attr_reader :rows
|
72
|
+
|
73
|
+
# columns of the emulated terminal (DEFAULT: 80)
|
74
|
+
attr_reader :columns
|
75
|
+
|
76
|
+
# x pixel of the emulated terminal (DEFAULT: 0)
|
77
|
+
attr_reader :pixel_x
|
78
|
+
|
79
|
+
# y pixel of the emulated terminal (DEFAULT: 0)
|
80
|
+
attr_reader :pixel_y
|
81
|
+
|
82
|
+
# the login regex (DEFAULT: /login:\s$/)
|
83
|
+
attr_reader :login_token
|
84
|
+
|
85
|
+
# the password regex (DEFAULT: /Password:\s$/)
|
86
|
+
attr_reader :password_token
|
87
|
+
|
88
|
+
# the prompt regex (DEFAULT: /^[^\n]*[#\$]> $/)
|
89
|
+
attr_reader :prompt
|
90
|
+
|
91
|
+
# the logout regex (DEFAULT: /exit\s+logout$/)
|
92
|
+
attr_reader :logout_token
|
93
|
+
|
94
|
+
# the logger that will be used for logging messages
|
95
|
+
attr_reader :logger
|
17
96
|
|
18
97
|
# Creates a new Rlogin client for the passed host and username. Additonal
|
19
|
-
# parameter can be passed as a options hash.
|
98
|
+
# parameter can be passed as a options hash. If no password is passed,
|
99
|
+
# the client will connect without password auth. Options are:
|
20
100
|
# :host:: hostname, dns or ipadress of the remote server
|
21
101
|
# :port:: port of the rlogind daemon on the remote server (DEFAULT: 513)
|
22
102
|
# :username:: username used for login
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rlogin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Landgraf
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-24 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: Ruby library to connect to a BSD Rlogin server (RFC 1282).
|
17
17
|
email: vilandgr+rlogin@googlemail.com
|
18
18
|
executables: []
|
19
19
|
|