支持多用户环境
GPU破解

由于这个系统将由一群人来访问,我想确保没有谁干扰到别人。我写了这个简单的封装程序,那样要是有谁试图使用oclHashcat或pyrit,而别人在使用,就会被告知不许这么做。

user@ubuntu:~$ cat /cracking/bin/gpu-crack
#!/bin/bash
#
# gpu-crack - Simple GPU cracker wrapper for multi-user
#             environments
#
# by Brad Antoniewicz
#
TMPFILE="/tmp/check.tmp"
ver="0.1"
SUDO_EXEC=/usr/bin/sudo
PYRIT_EXEC=/usr/local/bin/pyrit.real
HASHCAT_EXEC=/cracking/bin/oclhash/oclHashcat64.bin
isRunning=0;
echo -e "\n$0 v$ver"
echo "by brad a."
echo -e "-------------------------------------------------\n"
help() {
        echo "Usage:"
        echo -e "\t$0 [pyrit|hashcat] [options]\n"
        echo "Define what program you want to crack with (pyrit or hashcat)"
        echo "then provide the standard command line options that the cracker"
        echo "supports."
}
checkProc() {
        ps ax -o pid,user,etime,command | grep $1 | grep -v grep | grep -v $0 | sed -e 's/^ //' > $TMPFILE
        NUMPROC=`wc -l $TMPFILE | cut -d" " -f 1`
        if [[ $NUMPROC != 0 ]]; then
                echo -e "[!] Found $NUMPROC instance of $1 running\n"
                for ((i=1; i<=$NUMPROC; i++))
                do
#                        awk NR==$i "$TMPFILE"
                        PID=`awk NR==$i "$TMPFILE" | cut -d" " -f 1`
                        echo -e "\tPID: $PID"
                        echo -e "\tUser: `awk NR==$i "$TMPFILE" | cut -d" " -f 2`"
                        echo -e "\tRunning for: `awk NR==$i "$TMPFILE" | awk '{print $3}'`"
                        echo -e "\n"
                        isRunning=1;
                done
        else
                echo -e "[-] No instances of $1 found"
        fi
}
launchProc() {
        count=0;
        for x in "$@"
        do
                if [ $count != 0 ]; then
                        cmdlineArgs=$cmdlineArgs" "$x
                fi
                let count++
        done
        echo "[+] Launching $1 with the following options"
        echo -e "\t $cmdlineArgs"
        if [[ $1 == "pyrit" ]]; then
                echo "[+] Running Pyrit"
                $SUDO_EXEC $PYRIT_EXEC $cmdlineArgs
        elif [[ $1 == "hashcat" ]]; then
                echo "[+] Running oclHashcat"
                $SUDO_EXEC $HASHCAT_EXEC $cmdlineArgs
        fi
}
if  [[ $# -ge 2 ]]  && [[  $1 == "pyrit" || $1 == "hashcat" ]]; then
        echo "[+] Checking for conflicting processes"
        checkProc "pyrit"
        checkProc "oclHash"
        if [ $isRunning == 0 ]; then
                launchProc $@
        else
                echo "[!!] Found conflicting process, contact owner and make it stop!"
        fi
else
        help
fi


相关内容