diff --git a/lib/rex/post/meterpreter/client_core.rb b/lib/rex/post/meterpreter/client_core.rb index 8cc2b8e457..ab67096026 100644 --- a/lib/rex/post/meterpreter/client_core.rb +++ b/lib/rex/post/meterpreter/client_core.rb @@ -159,15 +159,13 @@ class ClientCore < Extension path = MeterpreterBinaries.path(modname, client.binary_suffix) if opts['ExtensionPath'] - path = opts['ExtensionPath'] + path = ::File.expand_path(opts['ExtensionPath']) end if path.nil? raise RuntimeError, "No module of the name #{modname}.#{client.binary_suffix} found", caller end - path = ::File.expand_path(path) - # Load the extension DLL commands = load_library( 'LibraryFilePath' => path, diff --git a/lib/rex/post/meterpreter/extensions/priv/priv.rb b/lib/rex/post/meterpreter/extensions/priv/priv.rb index ddd037c992..71575128f9 100644 --- a/lib/rex/post/meterpreter/extensions/priv/priv.rb +++ b/lib/rex/post/meterpreter/extensions/priv/priv.rb @@ -50,8 +50,6 @@ class Priv < Extension raise RuntimeError, "elevator.#{binary_suffix} not found", caller end - elevator_path = ::File.expand_path( elevator_path ) - elevator_data = "" ::File.open( elevator_path, "rb" ) { |f| diff --git a/lib/rex/post/meterpreter/extensions/stdapi/ui.rb b/lib/rex/post/meterpreter/extensions/stdapi/ui.rb index fcabf627f8..f176d7f84c 100644 --- a/lib/rex/post/meterpreter/extensions/stdapi/ui.rb +++ b/lib/rex/post/meterpreter/extensions/stdapi/ui.rb @@ -154,37 +154,43 @@ class UI < Rex::Post::UI def screenshot( quality=50 ) request = Packet.create_request( 'stdapi_ui_desktop_screenshot' ) request.add_tlv( TLV_TYPE_DESKTOP_SCREENSHOT_QUALITY, quality ) + # include the x64 screenshot dll if the host OS is x64 if( client.sys.config.sysinfo['Architecture'] =~ /^\S*x64\S*/ ) screenshot_path = MeterpreterBinaries.path('screenshot','x64.dll') if screenshot_path.nil? raise RuntimeError, "screenshot.x64.dll not found", caller end - screenshot_path = ::File.expand_path( screenshot_path ) + screenshot_dll = '' ::File.open( screenshot_path, 'rb' ) do |f| screenshot_dll += f.read( f.stat.size ) end + request.add_tlv( TLV_TYPE_DESKTOP_SCREENSHOT_PE64DLL_BUFFER, screenshot_dll, false, true ) request.add_tlv( TLV_TYPE_DESKTOP_SCREENSHOT_PE64DLL_LENGTH, screenshot_dll.length ) end + # but always include the x86 screenshot dll as we can use it for wow64 processes if we are on x64 screenshot_path = MeterpreterBinaries.path('screenshot','x86.dll') if screenshot_path.nil? raise RuntimeError, "screenshot.x86.dll not found", caller end - screenshot_path = ::File.expand_path( screenshot_path ) + screenshot_dll = '' ::File.open( screenshot_path, 'rb' ) do |f| screenshot_dll += f.read( f.stat.size ) end + request.add_tlv( TLV_TYPE_DESKTOP_SCREENSHOT_PE32DLL_BUFFER, screenshot_dll, false, true ) request.add_tlv( TLV_TYPE_DESKTOP_SCREENSHOT_PE32DLL_LENGTH, screenshot_dll.length ) + # send the request and return the jpeg image if successfull. response = client.send_request( request ) if( response.result == 0 ) return response.get_tlv_value( TLV_TYPE_DESKTOP_SCREENSHOT ) end + return nil end