Land #8589, Fix 64-bit support for the winpmem extension

bug/bundler_fix
Brent Cook 2017-06-23 19:27:31 -05:00
commit 1762fe56c9
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
3 changed files with 8 additions and 5 deletions

View File

@ -5,7 +5,7 @@ module Meterpreter
module Extensions
module Winpmem
TLV_TYPE_WINPMEM_ERROR_CODE = TLV_META_TYPE_UINT | (TLV_EXTENSIONS + 1)
TLV_TYPE_WINPMEM_MEMORY_SIZE = TLV_META_TYPE_UINT | (TLV_EXTENSIONS + 2)
TLV_TYPE_WINPMEM_MEMORY_SIZE = TLV_META_TYPE_QWORD | (TLV_EXTENSIONS + 2)
end
end
end

View File

@ -43,8 +43,10 @@ class Winpmem < Extension
channel_id = response.get_tlv_value(TLV_TYPE_CHANNEL_ID)
raise Exception, "We did not get a channel back!" if channel_id.nil?
#Open the compressed Channel
channel = Rex::Post::Meterpreter::Channels::Pool.new(client, channel_id, "winpmem", CHANNEL_FLAG_SYNCHRONOUS | CHANNEL_FLAG_COMPRESS)
# Open the compressed Channel
channel = Rex::Post::Meterpreter::Channels::Pool.new(client, channel_id, "winpmem",
CHANNEL_FLAG_SYNCHRONOUS | CHANNEL_FLAG_COMPRESS)
return memory_size, response_code, channel
end
end

View File

@ -60,12 +60,13 @@ module Ui
end
print_good("Driver PMEM loaded successfully")
#Arbitrary big buffer size, could be optimized
buffer_size = 2**17
buffer_size = 2 ** 17
bytes_read = 0
next_message_byte = memory_size / 10
print_good("Dumping #{memory_size} bytes (press Ctrl-C to abort)")
begin
data = channel.read(buffer_size)
until channel.eof
until channel.eof || data.nil?
fd.write(data)
bytes_read += data.length
data = channel.read(buffer_size)