Module: ObjectPwnStream::ObjectInputStream
Constant Summary
Constants included
from Constants
Constants::BASE_WIRE_HANDLE, Constants::STREAM_MAGIC, Constants::STREAM_VERSION, Constants::TC_ARRAY, Constants::TC_BLOCKDATA, Constants::TC_BLOCKDATALONG, Constants::TC_CLASS, Constants::TC_CLASSDESC, Constants::TC_ENDBLOCKDATA, Constants::TC_ENUM, Constants::TC_EXCEPTION, Constants::TC_LONGSTRING, Constants::TC_NULL, Constants::TC_OBJECT, Constants::TC_PROXYCLASSDESC, Constants::TC_REFERENCE, Constants::TC_RESET, Constants::TC_STRING
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Method Details
#handle_reset ⇒ Object
57
58
59
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 57
def handle_reset
check_stream_reset(@instream.getbyte)
end
|
9
10
11
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 9
def open_input_stream
()
end
|
#read_boolean ⇒ Object
51
52
53
54
55
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 51
def read_boolean
bool = @instream.getbyte
bool != 0
end
|
#read_byte ⇒ Object
35
36
37
38
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 35
def read_byte
@instream.getbyte
end
|
#read_bytes ⇒ Object
40
41
42
43
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 40
def read_bytes
_, length =
@instream.read(length).unpack("C*")
end
|
#read_char ⇒ Object
26
27
28
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 26
def read_char
[read_short].pack("U")
end
|
#read_chars ⇒ Object
30
31
32
33
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 30
def read_chars
_, length =
@instream.read(length).unpack("S>*").pack("U*")
end
|
#read_double ⇒ Object
66
67
68
69
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 66
def read_double
_, length =
@instream.read(length).unpack("G")[0]
end
|
#read_float ⇒ Object
61
62
63
64
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 61
def read_float
_, length =
@instream.read(length).unpack("g")[0]
end
|
#read_int(signed: false) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 13
def read_int(signed: false)
_, length =
template = (signed ? "l>" : "L>")
@instream.read(length).unpack(template)[0]
end
|
#read_long(signed: false) ⇒ Object
71
72
73
74
75
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 71
def read_long(signed: false)
_, length =
template = signed ? "q>" : "Q>"
@instream.read(length).unpack(template)[0]
end
|
#read_object ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 77
def read_object
unless @file_mode
bytes = [@instream.getbyte]
while @instream.ready?
bytes << @instream.getbyte
end
else
bytes = @instream.each_byte.to_a
end
bytes.pack("C*")
end
|
#read_short(signed: false) ⇒ Object
20
21
22
23
24
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 20
def read_short(signed: false)
_, length =
template = (signed ? "s>" : "S>")
@instream.read(length).unpack(template)[0]
end
|
#read_utf ⇒ Object
45
46
47
48
49
|
# File 'lib/ObjectPwnStream/ObjectInputStream.rb', line 45
def read_utf
_, block_length =
length = @instream.read(2).unpack("S>")[0]
@instream.read(length).unpack("U*").pack("U*")
end
|