class Rex::Post::Meterpreter::Extensions::Stdapi::Stdapi

Standard ruby interface to remote entities for meterpreter. It provides basic access to files, network, system, and other properties of the remote machine that are fairly universal.

Public Class Methods

new(client) click to toggle source

Initializes an instance of the standard API extension.

Calls superclass method Rex::Post::Meterpreter::Extension::new
# File lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb, line 39
def initialize(client)
  super(client, 'stdapi')

  # Alias the following things on the client object so that they
  # can be directly referenced
  client.register_extension_aliases(
    [
      {
        'name' => 'fs',
        'ext'  => ObjectAliases.new(
          {
            'dir'      => self.dir,
            'file'     => self.file,
            'filestat' => self.filestat
          })
      },
      {
        'name' => 'sys',
        'ext'  => ObjectAliases.new(
          {
            'config'   => Sys::Config.new(client),
            'process'  => self.process,
            'registry' => self.registry,
            'eventlog' => self.eventlog,
            'power'    => self.power
          })
      },
      {
        'name' => 'net',
        'ext'  => ObjectAliases.new(
          {
            'config'   => Rex::Post::Meterpreter::Extensions::Stdapi::Net::Config.new(client),
            'socket'   => Rex::Post::Meterpreter::Extensions::Stdapi::Net::Socket.new(client),
            'resolve'  => Rex::Post::Meterpreter::Extensions::Stdapi::Net::Resolve.new(client)
          })
      },
      {
        'name' => 'railgun',
        'ext'  => Rex::Post::Meterpreter::Extensions::Stdapi::Railgun::Railgun.new(client)
      },
      {
        'name' => 'webcam',
        'ext'  => Rex::Post::Meterpreter::Extensions::Stdapi::Webcam::Webcam.new(client)
      },
      {
        'name' => 'ui',
        'ext'  => UI.new(client)
      }

    ])
end

Public Instance Methods

brand(klass) click to toggle source

Sets the client instance on a duplicated copy of the supplied class.

# File lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb, line 94
def brand(klass)
  klass = klass.dup
  klass.client = self.client
  return klass
end
dir() click to toggle source

Returns a copy of the Dir class.

# File lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb, line 103
def dir
  brand(Rex::Post::Meterpreter::Extensions::Stdapi::Fs::Dir)
end
eventlog() click to toggle source

Returns a copy of the EventLog class.

# File lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb, line 138
def eventlog
  brand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::EventLog)
end
file() click to toggle source

Returns a copy of the File class.

# File lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb, line 110
def file
  brand(Rex::Post::Meterpreter::Extensions::Stdapi::Fs::File)
end
filestat() click to toggle source

Returns a copy of the FileStat class.

# File lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb, line 117
def filestat
  brand(Rex::Post::Meterpreter::Extensions::Stdapi::Fs::FileStat)
end
power() click to toggle source

Returns a copy of the Power class.

# File lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb, line 145
def power
  brand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Power)
end
process() click to toggle source

Returns a copy of the Process class.

# File lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb, line 124
def process
  brand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Process)
end
registry() click to toggle source

Returns a copy of the Registry class.

# File lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb, line 131
def registry
  brand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Registry)
end