rapid7/metasploit-framework — pull request #2821 by OJ (2014-01-02 22:13:40+00:00)
Title: Adjust the getenv API

The `getenv` call in `sys/config.rb` was renamed to `getenvs` and now uses the splat operator so that arrays don't have to be passed in. A new function called `getenv` was added which takes a single argument and returns a single value back (for ease of use).

This PR was pulled out of https://github.com/rapid7/metasploit-framework/pull/2782/ so that the change can be included prior to all the other modules being tested.

Sample run from the session prompt:
```
meterpreter > getenv USERPROFILE TEMP USERNAME

Environment Variables
=====================

Variable Value
-------- -----
USERPROFILE C:\Users\OJ
TEMP C:\Users\OJ\AppData\Local\Temp
USERNAME OJ
```
And here's what it looks like in irb:

```
meterpreter > irb
[*] Starting IRB shell
[*] The 'client' variable holds the meterpreter client

>> client.sys.config.getenv('TEMP')
=> "C:\\Users\\OJ\\AppData\\Local\\Temp"
>> client.sys.config.getenvs('TEMP', 'USERPROFILE')
=> {"TEMP"=>"C:\\Users\\OJ\\AppData\\Local\\Temp", "USERPROFILE"=>"C:\\Users\\OJ"}
>> client.sys.config.getenv('DOESNOTEXIST')
=> nil
```