From 53d5b9763491f505c9ce14a0efbff2b1d18495dc Mon Sep 17 00:00:00 2001 From: OJ Date: Tue, 7 Apr 2015 17:25:55 +1000 Subject: [PATCH] Add support for UUID generation in transport switching If the session doesn't have a payload UUID we now generate one as best we can. This code will probably go away when TCP related transports have had the UUID stuf baked in. --- lib/msf/core/handler/reverse_http.rb | 2 +- lib/rex/post/meterpreter/client_core.rb | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/msf/core/handler/reverse_http.rb b/lib/msf/core/handler/reverse_http.rb index 603960d6d7..7b84b0075f 100644 --- a/lib/msf/core/handler/reverse_http.rb +++ b/lib/msf/core/handler/reverse_http.rb @@ -351,7 +351,7 @@ protected }) else - print_status("#{cli.peerhost}:#{cli.peerport} Unknown request to #{uri_match} #{req.inspect}...") + print_status("#{cli.peerhost}:#{cli.peerport} Unknown request to #{req.relative_resource} #{req.inspect}...") resp.code = 200 resp.message = "OK" resp.body = datastore['HttpUnknownRequestResponse'].to_s diff --git a/lib/rex/post/meterpreter/client_core.rb b/lib/rex/post/meterpreter/client_core.rb index b5e1e10777..00d6e84ab6 100644 --- a/lib/rex/post/meterpreter/client_core.rb +++ b/lib/rex/post/meterpreter/client_core.rb @@ -278,7 +278,15 @@ class ClientCore < Extension # do more magic work for http(s) payloads unless opts[:transport].ends_with?('tcp') sum = uri_checksum_lookup(:connect) - url << generate_uri_uuid(sum, client.payload_uuid) + '/' + uuid = client.payload_uuid + unless uuid + arch, plat = client.platform.split('/') + uuid = Msf::Payload::UUID.new({ + arch: arch, + platform: plat.starts_with?('win') ? 'windows' : plat + }) + end + url << generate_uri_uuid(sum, uuid) + '/' opts[:comms_timeout] ||= DEFAULT_COMMS_TIMEOUT request.add_tlv(TLV_TYPE_TRANS_COMMS_TIMEOUT, opts[:comms_timeout])