Advertisement
Guest User

Untitled

a guest
Feb 17th, 2013
1,385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.78 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Crypto-Brute.sh v0.9(c) JF1976 2012 - for legal purposes only
  4. #
  5.  
  6.  
  7. wordlist=${1}                    #
  8. wordcount=`wc -l ${1} | awk '{print $1}'`
  9. dfile=${2}                    #
  10. tmpfile="/tmp/$(basename $2).$$.tmp"     #
  11. # ${3} Expected output type (ASCII, ELF, Bourne-Again, ...)
  12.  
  13. for cipher in `openssl list-cipher-commands`
  14. do
  15.      echo -en "[TRYING\t${cipher} | $wordcount Word(s)\t]\n"
  16.      while getword=`line`
  17.      do
  18.           # build a list of paramaters form our variables.
  19.           myargs="enc -d -$cipher -in $dfile -out $tmpfile -k $getword"
  20.           # call openssl with our arguments / paramaters send stderr(2) stdout(1) to /dev/null
  21.           `openssl $myargs >/dev/null 2>&1`
  22.           if [ -f ${tmpfile} ]; then
  23.                validate=`head -n 1 ${tmpfile} | file --brief - | awk '{print $1}'`
  24.                # awk '{print $0}' give the whole string and would be much better for validation.
  25.                # ASCII text, with CRLF line terminators
  26.                # awk '{print $1}' give just the first word / string returned but is not reliable.
  27.                #
  28.                # echo $validate # to debug returned values.
  29.           fi
  30.           if [ "$validate" != "ASCII" ]; then # text, with CRLF line terminators' ]; then
  31.                if [ -f ${tmpfile} ]; then
  32.                     rm ${tmpfile}
  33.                fi
  34.           else
  35. #               echo -e "i'v3 g0t th3 c00ki3s if y0u'v3 g0tmi1k"     # thanks for the inspiration ;)
  36.                echo -e "[CIPHER\t\t${cipher}\t| PASS\t\e[1;32${getword}\e[00m\t]\a"     # enjoy.
  37.                echo -e "[CMD openssl $myargs ]"
  38.                exit 1
  39.           fi
  40.      done < ${wordlist}
  41. done
  42. echo "[DONE!] all ${wordcount} word(s) tested with no results :( "
  43. exit 0
  44.  
  45.  
  46. # --[ The END. ]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement