rex 2.0.4 → 2.0.5
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/lib/rex/arch/x86.rb +16 -0
- data/lib/rex/constants.rb +1 -0
- data/lib/rex/constants/windows.rb +147 -0
- data/lib/rex/encoder/xdr.rb +3 -2
- data/lib/rex/exceptions.rb +37 -5
- data/lib/rex/exploitation/cmdstager/bourne.rb +9 -1
- data/lib/rex/exploitation/cmdstager/tftp.rb +5 -5
- data/lib/rex/java.rb +3 -0
- data/lib/rex/java/serialization.rb +54 -0
- data/lib/rex/java/serialization/model.rb +20 -0
- data/lib/rex/java/serialization/model/annotation.rb +69 -0
- data/lib/rex/java/serialization/model/block_data.rb +70 -0
- data/lib/rex/java/serialization/model/block_data_long.rb +72 -0
- data/lib/rex/java/serialization/model/class_desc.rb +64 -0
- data/lib/rex/java/serialization/model/contents.rb +156 -0
- data/lib/rex/java/serialization/model/element.rb +44 -0
- data/lib/rex/java/serialization/model/end_block_data.rb +12 -0
- data/lib/rex/java/serialization/model/field.rb +172 -0
- data/lib/rex/java/serialization/model/long_utf.rb +48 -0
- data/lib/rex/java/serialization/model/new_array.rb +225 -0
- data/lib/rex/java/serialization/model/new_class_desc.rb +155 -0
- data/lib/rex/java/serialization/model/new_enum.rb +79 -0
- data/lib/rex/java/serialization/model/new_object.rb +223 -0
- data/lib/rex/java/serialization/model/null_reference.rb +12 -0
- data/lib/rex/java/serialization/model/reference.rb +61 -0
- data/lib/rex/java/serialization/model/reset.rb +12 -0
- data/lib/rex/java/serialization/model/stream.rb +123 -0
- data/lib/rex/java/serialization/model/utf.rb +69 -0
- data/lib/rex/mime/message.rb +9 -14
- data/lib/rex/payloads.rb +1 -0
- data/lib/rex/payloads/meterpreter.rb +2 -0
- data/lib/rex/payloads/meterpreter/patch.rb +136 -0
- data/lib/rex/payloads/win32/kernel/stager.rb +26 -25
- data/lib/rex/post/meterpreter/client.rb +50 -60
- data/lib/rex/post/meterpreter/client_core.rb +18 -25
- data/lib/rex/post/meterpreter/extensions/extapi/adsi/adsi.rb +102 -8
- data/lib/rex/post/meterpreter/extensions/extapi/tlv.rb +24 -14
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb +18 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/tlv.rb +1 -0
- data/lib/rex/post/meterpreter/packet_dispatcher.rb +1 -1
- data/lib/rex/post/meterpreter/ui/console.rb +1 -1
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb +43 -1
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/incognito.rb +1 -1
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb +9 -0
- data/lib/rex/proto/dcerpc/svcctl.rb +2 -0
- data/lib/rex/proto/dcerpc/svcctl/packet.rb +304 -0
- data/lib/rex/proto/kademlia.rb +8 -0
- data/lib/rex/proto/kademlia/bootstrap_request.rb +19 -0
- data/lib/rex/proto/kademlia/bootstrap_response.rb +79 -0
- data/lib/rex/proto/kademlia/message.rb +72 -0
- data/lib/rex/proto/kademlia/ping.rb +19 -0
- data/lib/rex/proto/kademlia/pong.rb +41 -0
- data/lib/rex/proto/kademlia/util.rb +22 -0
- data/lib/rex/proto/natpmp/packet.rb +30 -2
- data/lib/rex/proto/quake.rb +3 -0
- data/lib/rex/proto/quake/message.rb +73 -0
- data/lib/rex/proto/smb/client.rb +1 -0
- data/lib/rex/proto/smb/simpleclient.rb +4 -0
- data/lib/rex/proto/sunrpc/client.rb +14 -3
- data/lib/rex/socket/comm/local.rb +10 -7
- data/lib/rex/socket/ssl_tcp_server.rb +79 -40
- data/lib/rex/ui/text/input/readline.rb +33 -6
- data/lib/rex/ui/text/output/file.rb +2 -2
- data/lib/rex/ui/text/output/stdio.rb +70 -14
- data/rex.gemspec +1 -1
- metadata +38 -3
@@ -0,0 +1,223 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
|
3
|
+
module Rex
|
4
|
+
module Java
|
5
|
+
module Serialization
|
6
|
+
module Model
|
7
|
+
# This class provides a NewObject (Java Object) representation
|
8
|
+
class NewObject < Element
|
9
|
+
|
10
|
+
include Rex::Java::Serialization::Model::Contents
|
11
|
+
|
12
|
+
# @!attribute class_desc
|
13
|
+
# @return [Rex::Java::Serialization::Model::ClassDesc] The description of the object
|
14
|
+
attr_accessor :class_desc
|
15
|
+
# @!attribute class_data
|
16
|
+
# @return [Array] The data of the object
|
17
|
+
attr_accessor :class_data
|
18
|
+
|
19
|
+
# @param stream [Rex::Java::Serialization::Model::Stream] the stream where it belongs to
|
20
|
+
def initialize(stream = nil)
|
21
|
+
super(stream)
|
22
|
+
self.class_desc = nil
|
23
|
+
self.class_data = []
|
24
|
+
end
|
25
|
+
|
26
|
+
# Deserializes a Rex::Java::Serialization::Model::NewObject
|
27
|
+
#
|
28
|
+
# @param io [IO] the io to read from
|
29
|
+
# @return [self] if deserialization succeeds
|
30
|
+
# @raise [RuntimeError] if deserialization doesn't succeed
|
31
|
+
def decode(io)
|
32
|
+
self.class_desc = ClassDesc.decode(io, stream)
|
33
|
+
stream.add_reference(self) unless stream.nil?
|
34
|
+
|
35
|
+
if class_desc.description.class == NewClassDesc
|
36
|
+
self.class_data = decode_class_data(io, class_desc.description)
|
37
|
+
elsif class_desc.description.class == Reference
|
38
|
+
ref = class_desc.description.handle - BASE_WIRE_HANDLE
|
39
|
+
self.class_data = decode_class_data(io, stream.references[ref])
|
40
|
+
end
|
41
|
+
|
42
|
+
self
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serializes the Rex::Java::Serialization::Model::NewObject
|
46
|
+
#
|
47
|
+
# @return [String] if serialization succeeds
|
48
|
+
# @raise [RuntimeError] if serialization doesn't succeed
|
49
|
+
def encode
|
50
|
+
unless class_desc.class == ClassDesc
|
51
|
+
raise ::RuntimeError, 'Failed to serialize NewObject'
|
52
|
+
end
|
53
|
+
|
54
|
+
encoded = ''
|
55
|
+
encoded << class_desc.encode
|
56
|
+
|
57
|
+
class_data.each do |value|
|
58
|
+
if value.class == Array
|
59
|
+
encoded << encode_value(value)
|
60
|
+
else
|
61
|
+
encoded << encode_content(value)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
encoded
|
66
|
+
end
|
67
|
+
|
68
|
+
# Creates a print-friendly string representation
|
69
|
+
#
|
70
|
+
# @return [String]
|
71
|
+
def to_s
|
72
|
+
str = ''
|
73
|
+
if class_desc.description.class == NewClassDesc
|
74
|
+
str << class_desc.description.class_name.to_s
|
75
|
+
elsif class_desc.description.class == Reference
|
76
|
+
str << (class_desc.description.handle - BASE_WIRE_HANDLE).to_s(16)
|
77
|
+
end
|
78
|
+
|
79
|
+
str << ' => { '
|
80
|
+
data = class_data.collect { |data| data.to_s }
|
81
|
+
str << data.join(', ')
|
82
|
+
str << ' }'
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
# Deserializes the class_data for a class_desc and its super classes
|
88
|
+
#
|
89
|
+
# @param io [IO] the io to read from
|
90
|
+
# @param my_class_desc [Rex::Java::Serialization::Model::NewClassDesc] the class description whose data is being extracted
|
91
|
+
# @return [Array] class_data values if deserialization succeeds
|
92
|
+
# @raise [RuntimeError] if deserialization doesn't succeed
|
93
|
+
def decode_class_data(io, my_class_desc)
|
94
|
+
values = []
|
95
|
+
|
96
|
+
unless my_class_desc.super_class.description.class == NullReference
|
97
|
+
values += decode_class_data(io, my_class_desc.super_class.description)
|
98
|
+
end
|
99
|
+
|
100
|
+
values += decode_class_fields(io, my_class_desc)
|
101
|
+
|
102
|
+
values
|
103
|
+
end
|
104
|
+
|
105
|
+
# Deserializes the fields data for a class_desc
|
106
|
+
#
|
107
|
+
# @param io [IO] the io to read from
|
108
|
+
# @param my_class_desc [Rex::Java::Serialization::Model::NewClassDesc] the class description whose data is being extracted
|
109
|
+
# @return [Array] class_data values if deserialization succeeds
|
110
|
+
# @raise [RuntimeError] if deserialization doesn't succeed
|
111
|
+
def decode_class_fields(io, my_class_desc)
|
112
|
+
values = []
|
113
|
+
|
114
|
+
my_class_desc.fields.each do |field|
|
115
|
+
if field.is_primitive?
|
116
|
+
values << decode_value(io, field.type)
|
117
|
+
else
|
118
|
+
content = decode_content(io, stream)
|
119
|
+
values << content
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
values
|
124
|
+
end
|
125
|
+
|
126
|
+
# Deserializes a class_data value
|
127
|
+
#
|
128
|
+
# @param io [IO] the io to read from
|
129
|
+
# @param type [String] the type of the value to deserialize
|
130
|
+
# @return [Array(String, <Fixnum, Float>)] type and value if deserialization succeeds
|
131
|
+
# @raise [RuntimeError] if deserialization fails
|
132
|
+
def decode_value(io, type)
|
133
|
+
value = []
|
134
|
+
|
135
|
+
case type
|
136
|
+
when 'byte'
|
137
|
+
value_raw = io.read(1)
|
138
|
+
raise ::RuntimeError, 'Failed to deserialize NewArray value' if value_raw.nil?
|
139
|
+
value.push('byte', value_raw.unpack('c')[0])
|
140
|
+
when 'char'
|
141
|
+
value_raw = io.read(2)
|
142
|
+
unless value_raw && value_raw.length == 2
|
143
|
+
raise ::RuntimeError, 'Failed to deserialize NewArray value'
|
144
|
+
end
|
145
|
+
value.push('char', value_raw.unpack('s>')[0])
|
146
|
+
when 'double'
|
147
|
+
value_raw = io.read(8)
|
148
|
+
unless value_raw && value_raw.length == 8
|
149
|
+
raise ::RuntimeError, 'Failed to deserialize NewArray value'
|
150
|
+
end
|
151
|
+
value.push('double', value = value_raw.unpack('G')[0])
|
152
|
+
when 'float'
|
153
|
+
value_raw = io.read(4)
|
154
|
+
unless value_raw && value_raw.length == 4
|
155
|
+
raise ::RuntimeError, 'Failed to deserialize NewArray value'
|
156
|
+
end
|
157
|
+
value.push('float', value_raw.unpack('g')[0])
|
158
|
+
when 'int'
|
159
|
+
value_raw = io.read(4)
|
160
|
+
unless value_raw && value_raw.length == 4
|
161
|
+
raise ::RuntimeError, 'Failed to deserialize NewArray value'
|
162
|
+
end
|
163
|
+
value.push('int', value_raw.unpack('l>')[0])
|
164
|
+
when 'long'
|
165
|
+
value_raw = io.read(8)
|
166
|
+
unless value_raw && value_raw.length == 8
|
167
|
+
raise ::RuntimeError, 'Failed to deserialize NewArray value'
|
168
|
+
end
|
169
|
+
value.push('long', value_raw.unpack('q>')[0])
|
170
|
+
when 'short'
|
171
|
+
value_raw = io.read(2)
|
172
|
+
unless value_raw && value_raw.length == 2
|
173
|
+
raise ::RuntimeError, 'Failed to deserialize NewArray value'
|
174
|
+
end
|
175
|
+
value.push('short', value_raw.unpack('s>')[0])
|
176
|
+
when 'boolean'
|
177
|
+
value_raw = io.read(1)
|
178
|
+
raise ::RuntimeError, 'Failed to deserialize NewArray value' if value_raw.nil?
|
179
|
+
value.push('boolean', value_raw.unpack('c')[0])
|
180
|
+
else
|
181
|
+
raise ::RuntimeError, 'Unsupported NewArray type'
|
182
|
+
end
|
183
|
+
|
184
|
+
value
|
185
|
+
end
|
186
|
+
|
187
|
+
# Serializes an class_data value
|
188
|
+
#
|
189
|
+
# @param value [Array] the type and value to serialize
|
190
|
+
# @return [String] the serialized value
|
191
|
+
# @raise [RuntimeError] if serialization fails
|
192
|
+
def encode_value(value)
|
193
|
+
res = ''
|
194
|
+
|
195
|
+
case value[0]
|
196
|
+
when 'byte'
|
197
|
+
res = [value[1]].pack('c')
|
198
|
+
when 'char'
|
199
|
+
res = [value[1]].pack('s>')
|
200
|
+
when 'double'
|
201
|
+
res = [value[1]].pack('G')
|
202
|
+
when 'float'
|
203
|
+
res = [value[1]].pack('g')
|
204
|
+
when 'int'
|
205
|
+
res = [value[1]].pack('l>')
|
206
|
+
when 'long'
|
207
|
+
res = [value[1]].pack('q>')
|
208
|
+
when 'short'
|
209
|
+
res = [value[1]].pack('s>')
|
210
|
+
when 'boolean'
|
211
|
+
res = [value[1]].pack('c')
|
212
|
+
else
|
213
|
+
raise ::RuntimeError, 'Unsupported NewArray type'
|
214
|
+
end
|
215
|
+
|
216
|
+
res
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
|
3
|
+
module Rex
|
4
|
+
module Java
|
5
|
+
module Serialization
|
6
|
+
module Model
|
7
|
+
# This class provides a Java Reference representation.
|
8
|
+
class Reference < Element
|
9
|
+
|
10
|
+
# @!attribute contents
|
11
|
+
# @return [Fixnum] The stream handle being referenced
|
12
|
+
attr_accessor :handle
|
13
|
+
|
14
|
+
# @param stream [Rex::Java::Serialization::Model::Stream] the stream where it belongs to
|
15
|
+
def initialize(stream = nil)
|
16
|
+
super(stream)
|
17
|
+
self.handle = 0
|
18
|
+
end
|
19
|
+
|
20
|
+
# Deserializes a Rex::Java::Serialization::Model::Reference
|
21
|
+
#
|
22
|
+
# @param io [IO] the io to read from
|
23
|
+
# @return [self] if deserialization succeeds
|
24
|
+
# @raise [RuntimeError] if deserialization doesn't succeed
|
25
|
+
def decode(io)
|
26
|
+
handle_raw = io.read(4)
|
27
|
+
unless handle_raw && handle_raw.length == 4
|
28
|
+
raise ::RuntimeError, 'Failed to unserialize Reference'
|
29
|
+
end
|
30
|
+
|
31
|
+
self.handle = handle_raw.unpack('N')[0]
|
32
|
+
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
36
|
+
# Serializes the Rex::Java::Serialization::Model::Reference
|
37
|
+
#
|
38
|
+
# @return [String] if serialization succeeds
|
39
|
+
# @raise [RuntimeError] if serialization doesn't succeed
|
40
|
+
def encode
|
41
|
+
if handle < BASE_WIRE_HANDLE
|
42
|
+
raise ::RuntimeError, 'Failed to serialize Reference'
|
43
|
+
end
|
44
|
+
|
45
|
+
encoded = ''
|
46
|
+
encoded << [handle].pack('N')
|
47
|
+
|
48
|
+
encoded
|
49
|
+
end
|
50
|
+
|
51
|
+
# Creates a print-friendly string representation
|
52
|
+
#
|
53
|
+
# @return [String]
|
54
|
+
def to_s
|
55
|
+
"0x#{handle.to_s(16)}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
|
3
|
+
module Rex
|
4
|
+
module Java
|
5
|
+
module Serialization
|
6
|
+
module Model
|
7
|
+
# This class provides a Java Stream representation
|
8
|
+
class Stream < Element
|
9
|
+
|
10
|
+
include Rex::Java::Serialization::Model::Contents
|
11
|
+
|
12
|
+
# @!attribute magic
|
13
|
+
# @return [Fixnum] The stream signature
|
14
|
+
attr_accessor :magic
|
15
|
+
# @!attribute version
|
16
|
+
# @return [Fixnum] The stream version
|
17
|
+
attr_accessor :version
|
18
|
+
# @!attribute contents
|
19
|
+
# @return [Array] The stream contents
|
20
|
+
attr_accessor :contents
|
21
|
+
# @!attribute references
|
22
|
+
# @return [Array] The stream objects to be referenced through handles
|
23
|
+
attr_accessor :references
|
24
|
+
|
25
|
+
def initialize(stream = nil)
|
26
|
+
super(nil)
|
27
|
+
self.magic = STREAM_MAGIC
|
28
|
+
self.version = STREAM_VERSION
|
29
|
+
self.contents = []
|
30
|
+
self.references = []
|
31
|
+
end
|
32
|
+
|
33
|
+
# Deserializes a Rex::Java::Serialization::Model::Stream
|
34
|
+
#
|
35
|
+
# @param io [IO] the io to read from
|
36
|
+
# @return [self] if deserialization succeeds
|
37
|
+
# @raise [RuntimeError] if deserialization doesn't succeed
|
38
|
+
def decode(io)
|
39
|
+
self.magic = decode_magic(io)
|
40
|
+
self.version = decode_version(io)
|
41
|
+
|
42
|
+
until io.eof?
|
43
|
+
content = decode_content(io, self)
|
44
|
+
self.contents << content
|
45
|
+
end
|
46
|
+
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
50
|
+
# Serializes the Rex::Java::Serialization::Model::Stream
|
51
|
+
#
|
52
|
+
# @return [String] if serialization succeeds
|
53
|
+
# @raise [RuntimeError] if serialization doesn't succeed
|
54
|
+
def encode
|
55
|
+
encoded = ''
|
56
|
+
encoded << [magic].pack('n')
|
57
|
+
encoded << [version].pack('n')
|
58
|
+
contents.each do |content|
|
59
|
+
encoded << encode_content(content)
|
60
|
+
end
|
61
|
+
encoded
|
62
|
+
end
|
63
|
+
|
64
|
+
# Adds an element to the references array
|
65
|
+
#
|
66
|
+
# @param io [Rex::Java::Serialization::Model::Element] the object to save as reference dst
|
67
|
+
def add_reference(ref)
|
68
|
+
self.references.push(ref)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Creates a print-friendly string representation
|
72
|
+
#
|
73
|
+
# @return [String]
|
74
|
+
def to_s
|
75
|
+
str = "@magic: 0x#{magic.to_s(16)}\n"
|
76
|
+
str << "@version: #{version}\n"
|
77
|
+
str << "@contents: [\n"
|
78
|
+
contents.each do |content|
|
79
|
+
str << " #{print_content(content)}\n"
|
80
|
+
end
|
81
|
+
str << "]\n"
|
82
|
+
str << "@references: [\n"
|
83
|
+
references.each do |ref|
|
84
|
+
str << " [#{(references.index(ref) + BASE_WIRE_HANDLE).to_s(16)}] #{print_content(ref)}\n"
|
85
|
+
end
|
86
|
+
str << "]\n"
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
# Deserializes the magic stream value
|
92
|
+
#
|
93
|
+
# @param io [IO] the io to read from
|
94
|
+
# @return [String] if deserialization succeeds
|
95
|
+
# @raise [RuntimeError] if deserialization doesn't succeed
|
96
|
+
def decode_magic(io)
|
97
|
+
magic = io.read(2)
|
98
|
+
|
99
|
+
unless magic && magic.length == 2 && magic.unpack('n')[0] == STREAM_MAGIC
|
100
|
+
raise ::RuntimeError, 'Failed to unserialize Stream'
|
101
|
+
end
|
102
|
+
|
103
|
+
STREAM_MAGIC
|
104
|
+
end
|
105
|
+
|
106
|
+
# Deserializes the version stream
|
107
|
+
#
|
108
|
+
# @param io [IO] the io to read from
|
109
|
+
# @return [Fixnum] if deserialization succeeds
|
110
|
+
# @raise [RuntimeError] if deserialization doesn't succeed
|
111
|
+
def decode_version(io)
|
112
|
+
version = io.read(2)
|
113
|
+
unless version && version.unpack('n')[0] == STREAM_VERSION
|
114
|
+
raise ::RuntimeError, 'Failed to unserialize Stream'
|
115
|
+
end
|
116
|
+
|
117
|
+
STREAM_VERSION
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# -*- coding: binary -*-
|
2
|
+
|
3
|
+
module Rex
|
4
|
+
module Java
|
5
|
+
module Serialization
|
6
|
+
module Model
|
7
|
+
# This class provides a Utf string representation
|
8
|
+
class Utf < Element
|
9
|
+
|
10
|
+
# @!attribute length
|
11
|
+
# @return [Integer] the length of the string
|
12
|
+
attr_accessor :length
|
13
|
+
# @!attribute contents
|
14
|
+
# @return [String] the contents of the string
|
15
|
+
attr_accessor :contents
|
16
|
+
|
17
|
+
# @param stream [Rex::Java::Serialization::Model::Stream] the stream where it belongs to
|
18
|
+
# @param contents [String] the contents of the utf string
|
19
|
+
def initialize(stream = nil, contents = '')
|
20
|
+
super(stream)
|
21
|
+
self.contents = contents
|
22
|
+
self.length = contents.length
|
23
|
+
end
|
24
|
+
|
25
|
+
# Deserializes a Rex::Java::Serialization::Model::Utf
|
26
|
+
#
|
27
|
+
# @param io [IO] the io to read from
|
28
|
+
# @return [self] if deserialization succeeds
|
29
|
+
# @raise [RuntimeError] if deserialization doesn't succeed
|
30
|
+
def decode(io)
|
31
|
+
raw_length = io.read(2)
|
32
|
+
if raw_length.nil? || raw_length.length != 2
|
33
|
+
raise ::RuntimeError, 'Failed to unserialize Utf'
|
34
|
+
end
|
35
|
+
self.length = raw_length.unpack('n')[0]
|
36
|
+
|
37
|
+
if length == 0
|
38
|
+
self.contents = ''
|
39
|
+
else
|
40
|
+
self.contents = io.read(length)
|
41
|
+
if contents.nil? || contents.length != length
|
42
|
+
raise ::RuntimeError, 'Failed to unserialize Utf'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
self
|
47
|
+
end
|
48
|
+
|
49
|
+
# Serializes the Rex::Java::Serialization::Model::Utf
|
50
|
+
#
|
51
|
+
# @return [String]
|
52
|
+
def encode
|
53
|
+
encoded = [length].pack('n')
|
54
|
+
encoded << contents
|
55
|
+
|
56
|
+
encoded
|
57
|
+
end
|
58
|
+
|
59
|
+
# Creates a print-friendly string representation
|
60
|
+
#
|
61
|
+
# @return [String]
|
62
|
+
def to_s
|
63
|
+
contents
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|