Class: Rex::Post::Meterpreter::Extensions::Stdapi_Fs::Stdapi_Fs

Inherits:
Rex::Post::Meterpreter::Extension show all
Defined in:
lib/rex/post/meterpreter/extensions/stdapi_fs/stdapi_fs.rb

Instance Attribute Summary

Attributes inherited from Rex::Post::Meterpreter::Extension

#client, #name

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Stdapi_Fs

Initializes an instance of the Standard API (Fs Namespace) extension.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/rex/post/meterpreter/extensions/stdapi_fs/stdapi_fs.rb', line 33

def initialize(client)
  super(client, 'stdapi_fs')

  # 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,
            'mount'    => Fs::Mount.new(client)
          })
      },
    ])
end

Class Method Details

.extension_idObject



26
27
28
# File 'lib/rex/post/meterpreter/extensions/stdapi_fs/stdapi_fs.rb', line 26

def self.extension_id
  Rex::Post::Meterpreter::Extensions::Stdapi::EXTENSION_ID_STDAPI
end

Instance Method Details

#brand(klass) ⇒ Object

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



56
57
58
59
60
# File 'lib/rex/post/meterpreter/extensions/stdapi_fs/stdapi_fs.rb', line 56

def brand(klass)
  klass = klass.dup
  klass.client = self.client
  return klass
end

#dirObject

Returns a copy of the Dir class.



65
66
67
# File 'lib/rex/post/meterpreter/extensions/stdapi_fs/stdapi_fs.rb', line 65

def dir
  brand(Rex::Post::Meterpreter::Extensions::Stdapi_Fs::Fs::Dir)
end

#fileObject

Returns a copy of the File class.



72
73
74
# File 'lib/rex/post/meterpreter/extensions/stdapi_fs/stdapi_fs.rb', line 72

def file
  brand(Rex::Post::Meterpreter::Extensions::Stdapi_Fs::Fs::File)
end

#filestatObject

Returns a copy of the FileStat class.



79
80
81
# File 'lib/rex/post/meterpreter/extensions/stdapi_fs/stdapi_fs.rb', line 79

def filestat
  brand(Rex::Post::Meterpreter::Extensions::Stdapi_Fs::Fs::FileStat)
end