Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for platform-specific env. variables in post-API tests #11803

Merged
merged 2 commits into from May 6, 2019

Conversation

Projects
None yet
1 participant
@busterb
Copy link
Contributor

commented May 2, 2019

'USERNAME' is not a standard environment variable outside of Windows, which leads to this test failing on non-Windows Meterpreter platforms.

Verification

  • Run the following test to make sure that the 'get_env' test works on a Linux or other non-Windows payload:
$ ./msfconsole -qx 'use multi/handler; set payload linux/x64/meterpreter_reverse_tcp; set lhost 127.0.0.1; run; loadpath test/modules; use post/test/get_env; set session -1; run'
payload => linux/x64/meterpreter_reverse_tcp
lhost => 127.0.0.1
[!] You are binding to a loopback address by setting LHOST to 127.0.0.1. Did you want ReverseListenerBindAddress?
[*] Started reverse TCP handler on 127.0.0.1:4444 
[*] Meterpreter session 1 opened (127.0.0.1:4444 -> 127.0.0.1:56704) at 2019-05-02 09:54:37 -0500

meterpreter > background 
[*] Backgrounding session 1...
Loaded 35 modules:
    10 posts
    13 exploits
    12 auxiliarys
session => -1

[*] Running against session -1
[*] Session type is meterpreter and platform is linux
[+] should return multiple envs
[+] should return user
[+] should handle $ sign
[*] Passed: 3; Failed: 0
[*] Post module execution completed
msf5 post(test/get_env) >
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.
@busterb

This comment has been minimized.

Copy link
Contributor Author

commented May 2, 2019

Note that embedded platforms may also have many other subsets of variables available. I wonder if we could just get all environment variables for the platform, and noodle around with what exists, rather than making platform assumptions.

@busterb busterb requested a review from bwatters-r7 May 2, 2019

@busterb busterb self-assigned this May 6, 2019

@busterb busterb merged commit 625f383 into rapid7:master May 6, 2019

3 checks passed

Metasploit Automation - Sanity Test Execution Successfully completed all tests.
Details
Metasploit Automation - Test Execution Successfully completed all tests.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

busterb added a commit that referenced this pull request May 6, 2019

msjenkins-r7 added a commit that referenced this pull request May 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.