Class: WinRM::PSRP::ReceiveResponseReader
- Inherits:
-
WSMV::ReceiveResponseReader
- Object
- WSMV::ReceiveResponseReader
- WinRM::PSRP::ReceiveResponseReader
- Defined in:
- lib/winrm/psrp/receive_response_reader.rb
Overview
Class for reading powershell responses in Receive_Response messages
Constant Summary
Constants included from WSMV::Header
WSMV::Header::RESOURCE_URI_CMD, WSMV::Header::RESOURCE_URI_POWERSHELL
Constants included from WSMV::SOAP
WSMV::SOAP::NS_ADDRESSING, WSMV::SOAP::NS_CIMBINDING, WSMV::SOAP::NS_ENUM, WSMV::SOAP::NS_SCHEMA_INST, WSMV::SOAP::NS_SOAP_ENV, WSMV::SOAP::NS_TRANSFER, WSMV::SOAP::NS_WIN_SHELL, WSMV::SOAP::NS_WSMAN_CONF, WSMV::SOAP::NS_WSMAN_DMTF, WSMV::SOAP::NS_WSMAN_FAULT, WSMV::SOAP::NS_WSMAN_MSFT
Instance Attribute Summary
Attributes inherited from WSMV::ReceiveResponseReader
Instance Method Summary collapse
-
#initialize(transport, logger) ⇒ ReceiveResponseReader
constructor
Creates a new ReceiveResponseReader.
-
#read_message(wsmv_message, wait_for_done_state = false) {|Message| ... } ⇒ Object
Reads PSRP messages sent in one or more receive response messages.
-
#read_output(wsmv_message) {|standard, standard| ... } ⇒ Object
Reads streams and returns decoded output.
Methods inherited from WSMV::ReceiveResponseReader
Methods included from WSMV::Header
#action_command, #action_delete, #action_enumerate, #action_enumerate_pull, #action_get, #action_receive, #action_send, #action_signal, #merge_headers, #resource_uri_cmd, #resource_uri_shell, #resource_uri_wmi, #selector_shell_id, #shared_headers
Methods included from WSMV::SOAP
Constructor Details
#initialize(transport, logger) ⇒ ReceiveResponseReader
Creates a new ReceiveResponseReader
26 27 28 29 |
# File 'lib/winrm/psrp/receive_response_reader.rb', line 26 def initialize(transport, logger) super @output_decoder = PowershellOutputDecoder.new end |
Instance Method Details
#read_message(wsmv_message, wait_for_done_state = false) {|Message| ... } ⇒ Object
Reads PSRP messages sent in one or more receive response messages
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/winrm/psrp/receive_response_reader.rb', line 36 def (, wait_for_done_state = false) = [] defragmenter = MessageDefragmenter.new read_response(, wait_for_done_state) do |stream| = defragmenter.defragment(stream[:text]) next unless if block_given? yield else .push() end end unless block_given? end |
#read_output(wsmv_message) {|standard, standard| ... } ⇒ Object
Reads streams and returns decoded output
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/winrm/psrp/receive_response_reader.rb', line 57 def read_output() with_output do |output| (, true) do || exit_code = find_exit_code() output.exitcode = exit_code if exit_code decoded_text = @output_decoder.decode() next unless decoded_text out = { stream_type() => decoded_text } output << out yield [out[:stdout], out[:stderr]] if block_given? end end end |