Class: WinRM::PSRP::PowershellOutputDecoder

Inherits:
Object
  • Object
show all
Defined in:
lib/winrm/psrp/powershell_output_decoder.rb

Overview

Handles decoding a raw powershell output response

Instance Method Summary collapse

Instance Method Details

#decode(message) ⇒ String

rubocop:disable Metrics/CyclomaticComplexity Decode the raw SOAP output into decoded PSRP message, Removes BOM and replaces encoded line endings

Parameters:

  • raw_output (String)

    The raw encoded output

Returns:

  • (String)

    The decoded output



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/winrm/psrp/powershell_output_decoder.rb', line 28

def decode(message)
  case message.type
  when WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_output]
    decode_pipeline_output(message)
  when WinRM::PSRP::Message::MESSAGE_TYPES[:runspacepool_host_call]
    decode_host_call(message)
  when WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_host_call]
    decode_host_call(message)
  when WinRM::PSRP::Message::MESSAGE_TYPES[:error_record]
    decode_error_record(message)
  when WinRM::PSRP::Message::MESSAGE_TYPES[:pipeline_state]
    if message.parsed_data.pipeline_state == WinRM::PSRP::MessageData::PipelineState::FAILED
      decode_error_record(message)
    end
  end
end