Path: blob/master/lib/rex/post/meterpreter/channels/pools/file.rb
19593 views
# -*- coding: binary -*-12require 'rex/post/meterpreter/channels/pool'3require 'rex/post/meterpreter/extensions/stdapi/tlv'45module Rex6module Post7module Meterpreter8module Channels9module Pools1011###12#13# File14# ----15#16# This class represents a channel that is associated with a file17# on the remote half of the meterpreter connection.18#19###20class File < Rex::Post::Meterpreter::Channels::Pool2122##23#24# Factory25#26##2728#29# This method returns an instance of a file pool channel that can be read30# from, written to, seeked on, and other interacted with.31#32def File.open(client, name, mode = "r", perm = 0)33Channel.create(client, 'stdapi_fs_file',34self, CHANNEL_FLAG_SYNCHRONOUS,35[36{37'type' => Rex::Post::Meterpreter::Extensions::Stdapi::TLV_TYPE_FILE_PATH,38'value' => client.unicode_filter_decode( name )39},40{41'type' => Rex::Post::Meterpreter::Extensions::Stdapi::TLV_TYPE_FILE_MODE,42'value' => mode + "b"43},44])45end4647##48#49# Constructor50#51##5253# Initializes the file channel instance54def initialize(client, cid, type, flags, packet, **_)55super(client, cid, type, flags, packet)56end5758end5960end; end; end; end; end61626364