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
|
# -*- shell-script -*-
match_or_exit () {
file_to_match="$1"
pattern_file="$2"
while read line_to_match <&3 && read pattern_line <&4 ; do
if [ "${line_to_match##$pattern_line}" ]; then
echo '!!! MISMATCH !!!' >&2
echo " Line: »${line_to_match}«" >&2
echo "Pattern: »${pattern_line}«" >&2
exit 1
fi;
done 3<"${file_to_match}" 4<"${pattern_file}"
}
create_empty_dict () {
mkdir -p /var/lib/Crack/dict
date >/var/lib/Crack/dict/.dictmade
}
remove_artefacts () {
rm /var/lib/Crack/?*.?*
}
run_crack_and_check_the_result () {
cp debian/tests/resources/$1-passwd /tmp/passwd
Crack /tmp/passwd 2>&1
sleep 5
Crack-Reporter >/tmp/crack-reporter.out
cat /tmp/crack-reporter.out
match_or_exit \
/tmp/crack-reporter.out \
debian/tests/resources/expected-result.patterns
}
|