diff --git a/miLazyCracker.sh b/miLazyCracker.sh index c0677a2..a284ac7 100755 --- a/miLazyCracker.sh +++ b/miLazyCracker.sh @@ -21,12 +21,12 @@ while [ $keepTrying -eq 1 ]; do echo "MFOC not possible, detected hardened Mifare Classic" if [ "$mfocResult" -eq 9 ]; then count=0 - while read LINE; do + while read -r LINE; do let count++ #echo "$count $LINE" done < "$TMPFILE_UNK" - arr=(`echo $LINE | tr ';' ' '`) + arr=($(echo "$LINE" | tr ';' ' ')) #echo ${arr[0]} #echo ${arr[1]} #echo ${arr[2]} @@ -38,8 +38,8 @@ while [ $keepTrying -eq 1 ]; do knownKeyLetter=${arr[2]} unknownSectorNum=${arr[3]} unknownKeyLetter=${arr[4]} - knownBlockNum=$(($knownSectorNum * 4)) - unknownBlockNum=$(($unknownSectorNum * 4)) + knownBlockNum=$((knownSectorNum * 4)) + unknownBlockNum=$((unknownSectorNum * 4)) echo "Trying HardNested Attack..." mycmd=(libnfc_crypto1_crack "$knownKey" "$knownBlockNum" "$knownKeyLetter" "$unknownBlockNum" "$unknownKeyLetter" "$TMPFILE_FND") echo "${mycmd[@]}" @@ -51,7 +51,7 @@ while [ $keepTrying -eq 1 ]; do cryptoCrackResult=$? if [ "$cryptoCrackResult" -eq 0 ];then - while read LINE + while read -r LINE do echo "$LINE" done < "$TMPFILE_FND" diff --git a/miLazyCrackerFreshInstall.sh b/miLazyCrackerFreshInstall.sh index b3ae19e..e580cc5 100755 --- a/miLazyCrackerFreshInstall.sh +++ b/miLazyCrackerFreshInstall.sh @@ -8,34 +8,35 @@ sudo apt-get install git libnfc-bin autoconf libnfc-dev # install MFOC [ -d mfoc ] || git clone https://github.com/nfc-tools/mfoc.git -cd mfoc -git reset --hard -git clean -dfx -# patch initially done against commit 48156f9b: -patch -p1 < ../mfoc_test_prng.diff -patch -p1 < ../mfoc_fix_4k_and_mini.diff -patch -p1 < ../mfoc_support_tnp.diff -patch -p1 < ../mfoc_support_2k.diff -autoreconf -vfi -./configure -make -sudo make install - -cd .. +( + cd mfoc || exit 1 + git reset --hard + git clean -dfx + # patch initially done against commit 48156f9b: + patch -p1 < ../mfoc_test_prng.diff + patch -p1 < ../mfoc_fix_4k_and_mini.diff + patch -p1 < ../mfoc_support_tnp.diff + patch -p1 < ../mfoc_support_2k.diff + autoreconf -vfi + ./configure + make + sudo make install +) # install Hardnested Attack Tool [ -d crypto1_bs ] || git clone https://github.com/aczid/crypto1_bs -cd crypto1_bs -git reset --hard -git clean -dfx -# patch initially done against commit 957702be: -patch -p1 < ../crypto1_bs.diff -make get_craptev1 -make get_crapto1 -make -sudo cp -a libnfc_crypto1_crack /usr/local/bin - -cd .. +( + cd crypto1_bs || exit 1 + git reset --hard + git clean -dfx + # patch initially done against commit 957702be: + patch -p1 < ../crypto1_bs.diff + make get_craptev1 + make get_crapto1 + make + sudo cp -a libnfc_crypto1_crack /usr/local/bin +) # install our script sudo cp -a miLazyCracker.sh /usr/local/bin/miLazyCracker +echo "Done."