rapid7/metasploit-framework — pull request #3933 by jvennix-r7 (2014-10-02 03:38:59+00:00)
Title: Fix cmd_exec with Python Meterpreter on OS X

Sometimes the channel is already closed on OSX, and attempting to re-close raises an IOError. I think it is okay to discard this error as at this point we have already buffered the command output.

This fixes issue #3887, and the repro steps are the same:

#### Verification
- [ ] get an osx python meterpreter session
- [ ] attempt to use the `check` method in `exploits/osx/local/vmware_bash_function_root`:

msf> use exploits/osx/local/vmware_bash_function_root
msf> set session 1 # this is a osx python meterpreter session
msf> check

- [ ] Verify it does not tell you: "Check failed: IOError closed stream", but instead gives you a vulnerable or nonvulnerable status