2020-02-18 07:49:29 +08:00
|
|
|
#!/usr/bin/env bash
|
2011-09-01 17:03:20 +08:00
|
|
|
|
|
|
|
# Andrei Costin <zveriu@gmail.com>, 2011
|
|
|
|
# gen_pm3mfsim_script.sh
|
|
|
|
# Generates Mifare Classic emulation script file that will load a given EML dump into PM3 and start emulation automagically
|
|
|
|
|
|
|
|
# http://www.linuxquestions.org/questions/programming-9/bash-script-parsing-optional-parameters-621728/
|
|
|
|
|
|
|
|
# show program usage
|
|
|
|
show_usage()
|
|
|
|
{
|
|
|
|
echo
|
|
|
|
echo "Usage:"
|
2020-07-19 07:26:45 +08:00
|
|
|
echo "${0##/} input_eml_without_extension output.cmd"
|
2011-09-01 17:03:20 +08:00
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
# Minimum number of arguments needed by this program
|
|
|
|
MINARGS=2
|
|
|
|
|
|
|
|
# get the number of command-line arguments given
|
|
|
|
ARGC=$#
|
|
|
|
|
|
|
|
# check to make sure enough arguments were given or exit
|
|
|
|
if [[ $ARGC -lt $MINARGS ]] ; then
|
|
|
|
echo "Too few arguments given (Minimum:$MINARGS)"
|
|
|
|
echo
|
|
|
|
show_usage
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm $2
|
|
|
|
echo "hf mf eclr" >> $2
|
|
|
|
echo "hf mf eload" $1 >> $2
|
|
|
|
echo "hf mf ekeyprn" >> $2
|
2020-07-19 07:34:17 +08:00
|
|
|
echo "hf mf sim u" `cat $1.eml | (read -n 8 uid; echo $uid)` >> $2
|