On 24 Jun 2014 18:40, "Pedro Ribeiro" <pedrib () gmail com> wrote:
I'm building a multi platform exploit which has auto targeting and is
able to identify its Linux and Windows targets. I'm using a global variable
to store the chosen target. With that I set the arch and platform
correctly, and then invoke generate_payload_exe with those parameters.
However when my auto targeting function identifies a Linux target, the
generated payload defaults to the windows meterpreter.
I have a feeling that I have to tell metasploit which target I have
ended up choosing. I have tried to set the "target" variable, but it seems
to have local function scope only. Meaning if I set it in one function, it
resets to automatic in another function.
So I guess the question is - after I've chosen the target via my auto
targeting function, how do I set that as the "real" target (target 1 ,2 or
3, not 0 / auto) so that metasploit generates the correct platform
payload? Should I be using a global variable, or is there a cleaner way to
OK I had a look at other modules and it seems the same thing is
I still don't think this behaviour is correct, there must be a way to
select automatically a payload for the target platform?