add a test for stderr output to the cmd_exec tests

This commit is contained in:
Tim W
2020-05-18 19:20:34 +08:00
parent 6034f48e8f
commit 78bd74eaec
+16
View File
@@ -93,4 +93,20 @@ class MetasploitModule < Msf::Post
end
end
end
def test_cmd_exec_stderr
vprint_status("Starting cmd_exec stderr tests")
it "should return the stderr output" do
test_string = Rex::Text.rand_text_alpha(4)
if session.platform.eql? 'windows'
output = cmd_exec("cmd.exe", "/c echo #{test_string} 1>&2")
output.rstrip == test_string
else
output = cmd_exec("echo #{test_string} 1>&2")
output == test_string
end
end
end
end