aboutsummaryrefslogtreecommitdiffstats
path: root/build-and-run-shellcode.sh
blob: 0a8a34bbaeb19c353db59097219212d40f4198f5 (plain) (blame)
1
2
3
4
5
6
#!/bin/sh
if [ "$1" == "32" ]; then
	nasm -o /dev/stdout shellcode-32.s | msfencode4.0 -t c -e generic/none -b '\x00' > harness.c && echo "void main() { (*(void(*)())buf)(); }" >> harness.c && gcc -m32 -fno-stack-protector -z execstack -o harness harness.c && ./harness
else
	nasm -o /dev/stdout shellcode-64.s | msfencode4.0 -t c -e generic/none -b '\x00' > harness.c && echo "void main() { (*(void(*)())buf)(); }" >> harness.c && gcc -fno-stack-protector -z execstack -o harness harness.c && ./harness
fi