2005-04-12 05:37:11 +00:00
|
|
|
#!/usr/bin/ruby
|
|
|
|
|
|
|
|
require 'Rex/Post/Meterpreter/Channels/Pool'
|
2005-04-13 08:19:22 +00:00
|
|
|
require 'Rex/Post/Meterpreter/Extensions/Stdapi/Tlv'
|
2005-04-12 05:37:11 +00:00
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Post
|
|
|
|
module Meterpreter
|
|
|
|
module Channels
|
|
|
|
module Pools
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# File
|
|
|
|
# ----
|
|
|
|
#
|
|
|
|
# This class represents a channel that is associated with a file
|
|
|
|
# on the remote half of the meterpreter connection.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class File < Rex::Post::Meterpreter::Channels::Pool
|
|
|
|
|
2005-04-13 08:19:22 +00:00
|
|
|
##
|
|
|
|
#
|
|
|
|
# Factory
|
|
|
|
#
|
|
|
|
##
|
|
|
|
|
|
|
|
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' => name
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'type' => Rex::Post::Meterpreter::Extensions::Stdapi::TLV_TYPE_FILE_MODE,
|
|
|
|
'value' => mode + "b"
|
|
|
|
},
|
|
|
|
])
|
|
|
|
end
|
|
|
|
|
2005-04-12 05:37:11 +00:00
|
|
|
##
|
|
|
|
#
|
|
|
|
# Constructor
|
|
|
|
#
|
|
|
|
##
|
|
|
|
|
|
|
|
# Initializes the file channel instance
|
|
|
|
def initialize(client, cid, type, flags)
|
|
|
|
super(client, cid, type, flags)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end; end; end; end; end
|