check for platform-specific env. variables

'USERNAME' is not a standard environment variable outside of Windows,
which leads to this test failing on non-Windows Meterpreter platforms.
This commit is contained in:
Brent Cook 2019-05-02 09:55:58 -05:00
parent def3112dde
commit ad1190b5c1
1 changed files with 6 additions and 2 deletions

View File

@ -53,8 +53,12 @@ class MetasploitModule < Msf::Post
def test_get_envs
it "should return multiple envs" do
res = get_envs('PATH','USERNAME')
!res['PATH'].blank? && !res['USERNAME'].blank?
res = get_envs('PATH','USERNAME','USER')
if session.platform =~ /win/i
!res['PATH'].blank? && !res['USERNAME'].blank?
else
!res['PATH'].blank? && !res['USER'].nil?
end
end
end