rapid7 / meterpreter

THIS REPO IS OBSOLETE. USE https://github.com/rapid7/metasploit-payloads INSTEAD
Other
328 stars 143 forks source link

POSIX and Windows meterpreter, inconsistent return types for interface in routes #99

Open todb-r7 opened 10 years ago

todb-r7 commented 10 years ago

This issue was RM8702, originally filed by by @jlee-r7

Expected: The interface attribute of Rex::Post::Meterpreter::Extensions::Stdapi::Net::Route should be comparable to an attribute on Rex::Post::Meterpreter::Extensions::Stdapi::Net::Interface. As it stands, Windows returns a Stringified version of Interface#index, while Linux returns Interface#mac_name.

Actual: In this example, I have two sessions, the first Windows, the second Linux.

framework.sessions.values.each { |s| p s.net.config.routes.first.interface }; nil
# Returns:
"11"
"eth0"

@OJ asked what it should look like, and @jlee-r7 responded: I think that depends on whether we can rely on Linux's indexes to remain consistent. If so, then it should just be a TLV_TYPE_UINT for the index on both. Otherwise, I think we have to use the name, which sorta sucks because they're ridiculous on windows.

@jlee-r7 also provided a workaround on the Ruby side, here: https://github.com/jlee-r7/metasploit-framework/commit/c6e1e590de358d70c175f7020d47cab29972063f#diff-6f1044d7b2cf3f1f66d9c1871ede170cR327