document script invocation examples
[perl-Mifare-MAD.git] / dump-card.sh
1 #!/bin/sh -x
2
3 # http://code.google.com/p/nfc-tools/wiki/mfoc
4
5 uid=`nfc-list | grep UID | cut -d: -f2 | sed 's/ //g'`
6
7 if [ -z "$uid" ] ; then
8         echo "No card on reader"
9         nfc-list
10         exit 1
11 fi
12
13 mfoc -O $uid.mfd | tee $uid.log
14
15 md5=`md5sum $uid.mfd | cut -d" " -f1 || `
16 date=`date +%Y-%m-%dT%H%M%S`
17 mv $uid.mfd $uid.$date.$md5.mfd
18 mv $uid.log $uid.$date.$md5.log
19 ls -al $uid.*