Class: PSRP::MessageDecoder
Constant Summary
Constants inherited from Message
PSRP::Message::BLOB_HEADER_LEN, PSRP::Message::BLOB_MAX_LEN, PSRP::Message::MESSAGE_TYPES
Instance Attribute Summary collapse
-
#blob_length ⇒ Object
readonly
Returns the value of attribute blob_length.
-
#client_pid ⇒ Object
readonly
Returns the value of attribute client_pid.
-
#client_runspace ⇒ Object
readonly
Returns the value of attribute client_runspace.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#fragment_flags ⇒ Object
readonly
Returns the value of attribute fragment_flags.
-
#fragment_id ⇒ Object
readonly
Returns the value of attribute fragment_id.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#message_type ⇒ Object
readonly
Returns the value of attribute message_type.
Instance Method Summary collapse
-
#initialize(raw_text) ⇒ MessageDecoder
constructor
A new instance of MessageDecoder.
- #is_end_fragment? ⇒ Boolean
- #is_start_fragment? ⇒ Boolean
Methods inherited from Message
Constructor Details
#initialize(raw_text) ⇒ MessageDecoder
Returns a new instance of MessageDecoder.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/wsmv/psrp_message.rb', line 92 def initialize(raw_text) # Message ID - 8bytes # Fragment ID - 8bytes # reserved - 6bits # end fragment - 1bit # start fragment - 1bit # blob_length - 4bytes # destination - 4bytes # message_type - 4bytes # client runspace GUID - 16bytes # client PID GUID - 16bytes # BOM 3bytes # # Data - blob_length - 43 bytes (40 blob bytes + BOM) unencoded = Base64.decode64(raw_text) fields = unencoded.unpack('Q>2CL>L<2h32h32C3A*') = fields[0] @fragment_id = fields[1] @fragment_flags = fields[2] @blob_length = fields[3] if is_start_fragment? @destination = fields[4] = fields[5] @client_runspace = fields[6] @client_pid = fields[7] @data = fields[11] else fields = unencoded.unpack('Q>2CL>A*') @destination = nil = nil @client_runspace = nil @client_pid = nil @data = fields[4] end end |
Instance Attribute Details
#blob_length ⇒ Object (readonly)
Returns the value of attribute blob_length.
90 91 92 |
# File 'lib/wsmv/psrp_message.rb', line 90 def blob_length @blob_length end |
#client_pid ⇒ Object (readonly)
Returns the value of attribute client_pid.
90 91 92 |
# File 'lib/wsmv/psrp_message.rb', line 90 def client_pid @client_pid end |
#client_runspace ⇒ Object (readonly)
Returns the value of attribute client_runspace.
90 91 92 |
# File 'lib/wsmv/psrp_message.rb', line 90 def client_runspace @client_runspace end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
90 91 92 |
# File 'lib/wsmv/psrp_message.rb', line 90 def data @data end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
90 91 92 |
# File 'lib/wsmv/psrp_message.rb', line 90 def destination @destination end |
#fragment_flags ⇒ Object (readonly)
Returns the value of attribute fragment_flags.
90 91 92 |
# File 'lib/wsmv/psrp_message.rb', line 90 def fragment_flags @fragment_flags end |
#fragment_id ⇒ Object (readonly)
Returns the value of attribute fragment_id.
90 91 92 |
# File 'lib/wsmv/psrp_message.rb', line 90 def fragment_id @fragment_id end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
90 91 92 |
# File 'lib/wsmv/psrp_message.rb', line 90 def end |
#message_type ⇒ Object (readonly)
Returns the value of attribute message_type.
90 91 92 |
# File 'lib/wsmv/psrp_message.rb', line 90 def end |
Instance Method Details
#is_end_fragment? ⇒ Boolean
130 131 132 |
# File 'lib/wsmv/psrp_message.rb', line 130 def is_end_fragment? (@fragment_flags & 2) != 0 end |
#is_start_fragment? ⇒ Boolean
134 135 136 |
# File 'lib/wsmv/psrp_message.rb', line 134 def is_start_fragment? (@fragment_flags & 1) != 0 end |