Land #11938, fix cmd_exec tests on python/windows

Merge branch 'land-11938' into upstream-master
This commit is contained in:
bwatters-r7 2019-06-04 08:01:49 -05:00
commit cd182e2014
No known key found for this signature in database
GPG Key ID: ECC0F0A52E65F268
1 changed files with 8 additions and 2 deletions

View File

@ -71,7 +71,10 @@ class MetasploitModule < Msf::Post
it "should return the result of echo with single quotes" do
test_string = Rex::Text.rand_text_alpha(4)
if session.platform.eql? 'windows'
if session.platform.eql? 'windows' and session.arch == ARCH_PYTHON
output = cmd_exec("cmd.exe", "/c echo \"#{test_string}\"")
output == test_string
elsif session.platform.eql? 'windows'
output = cmd_exec("cmd.exe", "/c echo '#{test_string}'")
output == "'" + test_string + "'"
else
@ -82,7 +85,10 @@ class MetasploitModule < Msf::Post
it "should return the result of echo with double quotes" do
test_string = Rex::Text.rand_text_alpha(4)
if session.platform.eql? 'windows'
if session.platform.eql? 'windows' and session.arch == ARCH_PYTHON
output = cmd_exec("cmd.exe", "/c echo \"#{test_string}\"")
output == test_string
elsif session.platform.eql? 'windows'
output = cmd_exec("cmd.exe", "/c echo \"#{test_string}\"")
output == "\"" + test_string + "\""
else