diff --git a/test/modules/post/test/cmd_exec.rb b/test/modules/post/test/cmd_exec.rb index b8f8a8c216..f8d80e511b 100644 --- a/test/modules/post/test/cmd_exec.rb +++ b/test/modules/post/test/cmd_exec.rb @@ -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