rapid7/metasploit-framework — pull request #2944 by jvazquez-r7 (2014-02-04 20:41:02+00:00)
Title: Use the platform when selecting the payload

While handling https://github.com/rapid7/metasploit-framework/pull/2939 figured out which the Platform isn't had into account when selecting compatible encoders :\. Because of that, for example, is hard to write an ARCH_CMD exploit for Windows Platforms, because non compatible encoders apply, even when payload.raw can be used still it doesn't look like the correct solution.

I see two options to fix the thing:

1) Have into account the platform when selecting the encoder : I feel like it should be the correct solution, but dangerous. This pull request, indeed, tries to do it. I guess I should be forgetting things, so please, review carefully, probably feedback from @jlee-r7 / @todb-r7 is needed.
2) Tweak the ARCH_CMD encoders to just raise an exception if the target platform isn't unix: It would be just a patch, but I guess would be safer, shouldn't break nothing. It could be done by defining the ```init_platform``` method on the ARCH_CMD encoders and raise an exception if the platform isn't unix.

Thoughts and feedback is super welcome!