class Rex::Post::Meterpreter::Channels::Pools::File

File


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

Public Class Methods

new(client, cid, type, flags) click to toggle source

Initializes the file channel instance

# File lib/rex/post/meterpreter/channels/pools/file.rb, line 54
def initialize(client, cid, type, flags)
  super(client, cid, type, flags)
end
open(client, name, mode = "r", perm = 0) click to toggle source

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

# File lib/rex/post/meterpreter/channels/pools/file.rb, line 32
def File.open(client, name, mode = "r", perm = 0)
  return 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