Merge pull request #1327 from Pondorasti/patch-1
[RRG-proxmark3.git] / client / gen_pm3mfsim_script.sh
blob6947c9bdac79f832ad9478650916362377e281aa
1 #!/usr/bin/env bash
3 # Andrei Costin <zveriu@gmail.com>, 2011
4 # gen_pm3mfsim_script.sh
5 # Generates Mifare Classic emulation script file that will load a given EML dump into PM3 and start emulation automagically
7 # http://www.linuxquestions.org/questions/programming-9/bash-script-parsing-optional-parameters-621728/
9 # show program usage
10 show_usage()
12 echo
13 echo "Usage:"
14 echo "${0##/} input_eml_without_extension output.cmd"
15 exit
18 # Minimum number of arguments needed by this program
19 MINARGS=2
21 # get the number of command-line arguments given
22 ARGC=$#
24 # check to make sure enough arguments were given or exit
25 if [[ $ARGC -lt $MINARGS ]] ; then
26 echo "Too few arguments given (Minimum:$MINARGS)"
27 echo
28 show_usage
31 rm $2
32 echo "hf mf eclr" >> $2
33 echo "hf mf eload" $1 >> $2
34 echo "hf mf ekeyprn" >> $2
35 echo "hf mf sim -u" `cat $1.eml | (read -n 8 uid; echo $uid)` >> $2