Class: WinRM::PSRP::Message
- Inherits:
-
Object
- Object
- WinRM::PSRP::Message
- Includes:
- UUID
- Defined in:
- lib/winrm/psrp/message.rb
Overview
PowerShell Remoting Protocol base message. download.microsoft.com/download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/%5BMS-PSRP%5D.pdf
Constant Summary collapse
- CLIENT_DESTINATION =
Value of message destination when sent to a client
1
- SERVER_DESTINATION =
Value of message destination when sent to a server
2
- MESSAGE_TYPES =
All known PSRP message types
{ session_capability: 0x00010002, init_runspacepool: 0x00010004, public_key: 0x00010005, encrypted_session_key: 0x00010006, public_key_request: 0x00010007, connect_runspacepool: 0x00010008, runspace_init_data: 0x0002100b, reset_runspace_state: 0x0002100c, set_max_runspaces: 0x00021002, set_min_runspaces: 0x00021003, runspace_availability: 0x00021004, runspacepool_state: 0x00021005, create_pipeline: 0x00021006, get_available_runspaces: 0x00021007, user_event: 0x00021008, application_private_data: 0x00021009, get_command_metadata: 0x0002100a, runspacepool_host_call: 0x00021100, runspacepool_host_response: 0x00021101, pipeline_input: 0x00041002, end_of_pipeline_input: 0x00041003, pipeline_output: 0x00041004, error_record: 0x00041005, pipeline_state: 0x00041006, debug_record: 0x00041007, verbose_record: 0x00041008, warning_record: 0x00041009, progress_record: 0x00041010, information_record: 0x00041011, pipeline_host_call: 0x00041100, pipeline_host_response: 0x00041101 }.freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#pipeline_id ⇒ Object
readonly
Returns the value of attribute pipeline_id.
-
#runspace_pool_id ⇒ Object
readonly
Returns the value of attribute runspace_pool_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#bytes ⇒ Array<Byte>
Returns the raw PSRP message bytes ready for transfer to Windows inside a WinRM message.
-
#initialize(runspace_pool_id, type, data, pipeline_id = nil, destination = SERVER_DESTINATION) ⇒ Message
constructor
Creates a new PSRP message instance specified in hex, e.g.
-
#parsed_data ⇒ MessageData::Base
Parses the raw data to a MessageData class.
Methods included from UUID
Constructor Details
#initialize(runspace_pool_id, type, data, pipeline_id = nil, destination = SERVER_DESTINATION) ⇒ Message
Creates a new PSRP message instance specified in hex, e.g. 0x00010002.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/winrm/psrp/message.rb', line 75 def initialize( runspace_pool_id, type, data, pipeline_id = nil, destination = SERVER_DESTINATION ) raise 'invalid message type' unless MESSAGE_TYPES.value?(type) @data = data @destination = destination @type = type @pipeline_id = pipeline_id @runspace_pool_id = runspace_pool_id end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
91 92 93 |
# File 'lib/winrm/psrp/message.rb', line 91 def data @data end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
91 92 93 |
# File 'lib/winrm/psrp/message.rb', line 91 def destination @destination end |
#pipeline_id ⇒ Object (readonly)
Returns the value of attribute pipeline_id.
91 92 93 |
# File 'lib/winrm/psrp/message.rb', line 91 def pipeline_id @pipeline_id end |
#runspace_pool_id ⇒ Object (readonly)
Returns the value of attribute runspace_pool_id.
91 92 93 |
# File 'lib/winrm/psrp/message.rb', line 91 def runspace_pool_id @runspace_pool_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
91 92 93 |
# File 'lib/winrm/psrp/message.rb', line 91 def type @type end |
Instance Method Details
#bytes ⇒ Array<Byte>
Returns the raw PSRP message bytes ready for transfer to Windows inside a WinRM message.
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/winrm/psrp/message.rb', line 96 def bytes [ int16le(destination), int16le(type), uuid_to_windows_guid_bytes(runspace_pool_id), uuid_to_windows_guid_bytes(pipeline_id), byte_order_mark, data_bytes ].flatten end |
#parsed_data ⇒ MessageData::Base
Parses the raw data to a MessageData class
109 110 111 |
# File 'lib/winrm/psrp/message.rb', line 109 def parsed_data @parsed_data ||= MessageData.parse(self) end |