home *** CD-ROM | disk | FTP | other *** search
- #!/bin/csh
-
- ###
- # This program written by ADE Muffett (aem@aber.ac.uk), August 1991,
- # as part of the 'Crack' password cracking package.
- ###
-
- ###
- # You must put DOUBLE QUOTES around this is you work relative to ~username
- ###
-
- setenv CRACK_HOME "~aem/SEC/CRACK32"
-
- set trash="/dev/null"
- set remote="FALSE"
- set default_bin="generic"
- set tmpfile="/tmp/cpwfs.$$"
- set net_cf="Scripts/network.conf"
-
- ###
- # Check existance of a home directory
- ###
-
- if ( -d $CRACK_HOME ) then
- cd $CRACK_HOME || exit 1
- else
- echo "Error: The directory $CRACK_HOME does not exist."
- echo ""
- echo "Please set the value of CRACK_HOME in the Crack script to the CRACK31"
- echo "installation directory."
- echo ""
- echo "The current working directory is" `pwd`
- exit 1
- endif
-
- ###
- # Announce ourselves.
- ###
-
- echo "Crack 3.2a Password Cracker by ADE Muffett, 1991"
-
- ###
- # Check that we have arguments
- ###
-
- if ( "$1" == "" ) then
- echo "Usage: $0 [options] [bindir] passwdfile [...]"
- echo "Or: $0 -network [options] passwdfile [...]"
- echo "With options:-"
- echo " -v - to produce verbose output (if configured)"
- echo " -nnicevalue - to run niced"
- echo " -rpointfile - to recover a crashed-out job"
- echo " -Rpointfile - to recover (with verify) a crashed-out job"
- exit 1
- endif
-
- ###
- # Parse command line
- ###
-
- set argl=()
-
- while ( 1 )
- switch ( $1 )
- case -network: # push onto the remote machines
- if ( ! -f $net_cf ) then
- echo "$0: error: no file $net_cf"
- exit 1
- endif
- shift
- Scripts/Crack.network $*
- exit 0
- breaksw # redundant
- case -remote: # This is being called remotely
- echo "Invoked: $0 $*"
- set remote="TRUE"
- shift
- breaksw
- case -v*: # verbose
- case -n*: # nice
- case -r*: # recover
- case -R*: # recover/verify
- set argl=($argl $1)
- shift
- breaksw
- case -*: # anything else
- echo "Crack: unknown argument $1"
- shift
- breaksw
- default:
- break
- breaksw # redundant
- endsw
- end
-
- ###
- # Test first non-switch argument for existance
- ###
-
- if ( -f "$1" ) then
- setenv CRACK_ARCH $CRACK_HOME/$default_bin
- if ( ! -d $default_bin ) then
- echo "Making default binary directory: $default_bin"
- mkdir $default_bin || exit 1
- endif
- else if ( -d "$1" ) then
- setenv CRACK_ARCH $CRACK_HOME/$1
- shift
- else
- echo "Crack: error: There is no directory or file $1."
- echo "Crack: warning: Creating directory $1"
- mkdir $1 || exit 1
- setenv CRACK_ARCH $CRACK_HOME/$1
- shift
- endif
-
- ###
- # Double check the dictionary directory
- ###
-
- if ( ! -d $CRACK_HOME/Dicts ) then
- echo "Crack: error: There is no directory or file Dicts."
- echo "Crack: warning: Creating directory Dicts"
- mkdir Dicts || exit 1
- endif
-
- ###
- # Now to tidy up a bit
- ###
-
- make -f Scripts/crack.mf cleanprogs >& /dev/null
-
- echo "Using binaries in directory: $CRACK_ARCH"
-
- cd $CRACK_ARCH || exit 1 # Can we get there from here ?
-
- ###
- # Install makefiles if necessary.
- ###
-
- if ( ! -f Makefile ) then # Has it a Makefile ?
- cp $CRACK_HOME/Scripts/install.mf Makefile
- endif
-
- make crack-pwc || exit 1 # Check binaries are OK
-
- cd $CRACK_HOME # Get back to home base
-
- make -f Scripts/crack.mf dictstamp || exit 1 # Make the dictionaries
-
- ###
- # Check how we have been invoked : ergo how we get our data.
- ###
-
- if ( "$remote" == "TRUE" ) then
- cat > $tmpfile # Use stdin
- else
- Scripts/joinfiles $* > $tmpfile || exit 1 # Process the passwords
- endif
-
- echo "Backgrounding program. Output will be written to a file in this directory."
-
- $CRACK_ARCH/crack-pwc $argl -i$tmpfile Dicts/dict.* < /dev/null >& $trash &
-
- ###
- # There are horrible timeraces involved in removing $tmpfile, so I dont.
- ###
-