File: Crack

package info (click to toggle)
crack 5.0a-12
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 9,016 kB
  • sloc: ansic: 7,444; perl: 1,375; sh: 1,062; makefile: 218
file content (47 lines) | stat: -rw-r--r-- 1,015 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Wrapper file for Crack
# written by Javier Fernández-Sanguino Peña for the Debian GNU/Linux distribution
# Heavily rewritten by Paweł Więcek
# 
# Licensed under the GNU GPL v2.
# See /usr/share/doc/common-licenses/GPL

# This is needed due to relative calls to 'dawg' and co.
PATH=/usr/lib/Crack:$PATH
export PATH

if [ "`id -u`" != "0" ]
then
  echo "Crack requires root priviledges to run."
  exit 1
fi

CRACKDIR=/usr/share/Crack

# Prepare parameters list expanding any filenames to their canonical names
unset PARAMS
declare -a PARAMS
n=1

while [ "${!n}" != "" ]
do
  if [ -f "${!n}" ]
  then
    PARAMS[$n]="`readlink -f "${!n}"`"
    if [ "${PARAMS[$n]}" = "/etc/passwd" -a -f /etc/shadow ]
    then
      # Need to merge passwd with shadow...
      MERGED=`tempfile -d $CRACKDIR/run`
      >$MERGED
      chmod 600 $MERGED
      sh $CRACKDIR/scripts/shadmrg.sv >$MERGED
      PARAMS[$n]=$MERGED
    fi
  else
    PARAMS[$n]="${!n}"
  fi
  ((n++))
done

cd $CRACKDIR
./Crack "${PARAMS[@]}"