class TurboRex::Windows::ALPC::Client

Public Class Methods

new(port_name, opts = {}) click to toggle source
# File lib/turborex/windows/alpc.rb, line 654
def initialize(port_name, opts = {})
  if TurboRex::Windows::Utils.is_wow64?
    default_cpu = Metasm::Ia32
  else
    default_cpu = Metasm::X86_64
  end

  cpu = opts[:cpu] || default_cpu
  APIProxy.init(cpu)

  unless port_name.start_with? '\\'
    port_name = '\\' + port_name
  end
  @port_name = port_name

  @transport = Transport.new
end

Public Instance Methods

connect(opts = {}) { |server| ... } click to toggle source
# File lib/turborex/windows/alpc.rb, line 672
def connect(opts = {}, &block)
  opts[:port_name] = @port_name
  @communication_handle, msg = @transport.connect(opts)
  server_pid = msg.client_id&.unique_process
  server_tid = msg.client_id&.unique_thread
  @server = ServerProxy.new(@communication_handle, @transport, server_pid, server_tid)
  yield(@server) if block_given?
  [@server, msg]
end