Class: Rex::Post::Meterpreter::Channels::Pools::File

Inherits:
Rex::Post::Meterpreter::Channels::Pool show all
Defined in:
lib/rex/post/meterpreter/channels/pools/file.rb

Overview

File


This class represents a channel that is associated with a file on the remote half of the meterpreter connection.

Instance Attribute Summary

Attributes inherited from Rex::Post::Meterpreter::Channels::Pool

#_eof

Attributes inherited from Rex::Post::Meterpreter::Channel

#cid, #client, #cls, #flags, #params, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Rex::Post::Meterpreter::Channels::Pool

cls, #eof, #pos, #read, #seek, #tell

Methods inherited from Rex::Post::Meterpreter::Channel

_close, #_close, #_read, #_write, #cleanup, #close, #close_read, #close_write, #closed?, create, #dio_close_handler, #dio_handler, #dio_map, #dio_read_handler, #dio_write_handler, finalize, #flag?, #interactive, #read, request_handler, #synchronous?, #write

Methods included from InboundPacketHandler

#request_handler, #response_handler

Constructor Details

#initialize(client, cid, type, flags, packet, **_) ⇒ File

Initializes the file channel instance



55
56
57
# File 'lib/rex/post/meterpreter/channels/pools/file.rb', line 55

def initialize(client, cid, type, flags, packet, **_)
  super(client, cid, type, flags, packet)
end

Class Method Details

.open(client, name, mode = "r", perm = 0) ⇒ Object

This method returns an instance of a file pool channel that can be read from, written to, seeked on, and other interacted with.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rex/post/meterpreter/channels/pools/file.rb', line 33

def File.open(client, name, mode = "r", perm = 0)
  Channel.create(client, 'stdapi_fs_file',
    self, CHANNEL_FLAG_SYNCHRONOUS,
    [
      {
        'type'  => Rex::Post::Meterpreter::Extensions::Stdapi::TLV_TYPE_FILE_PATH,
        'value' => client.unicode_filter_decode( name )
      },
      {
        'type'  => Rex::Post::Meterpreter::Extensions::Stdapi::TLV_TYPE_FILE_MODE,
        'value' => mode + "b"
      },
    ])
end