File pm3-firmware of Package proxmark3
#!/bin/bash
if [ -f ~/.proxmark3/firmware ]; then
. ~/.proxmark3/firmware
fi
PORT="${PORT:-/dev/ttyACM0}"
FIRMWARE_DIR="${FIRMWARE_DIR:-/usr/share/proxmark3/firmware/}"
if ! [ -d "$FIRMWARE_DIR" ]; then
echo "Firmware directory not found: $FIRMWARE_DIR"
exit 1
fi
# TODO: ideally read descriptions from somewhere and add it between ()
VARIANTS=`find $FIRMWARE_DIR -maxdepth 1 -mindepth 1 -type d -printf "%f ()\n"`
exec 3>&1
_variant=`dialog --clear --title "Variant" --menu "Select the variant you want to see available firmware for" 20 78 4 $VARIANTS 2>&1 1>&3`
_rv=$?
exec 3>&-
# relevant codes: 0 (ok), 1 (cancel), 255 (ESC)
case $_rv in
0)
FIRMWARE=`find $FIRMWARE_DIR/$_variant -maxdepth 1 -mindepth 1 -type d -printf "%f ()\n"`
exec 3>&1
_firmware=`dialog --clear --title "Payload" --menu "Select the firmware you'd like to flash to your proxmark at $PORT. Set PORT if it is at a different port." 40 78 8 $FIRMWARE 2>&1 1>&3`
_rv=$?
exec 3>&-
case $_rv in
0)
proxmark3 -p $PORT --flash --image $FIRMWARE_DIR/$_variant/$_firmware/fullimage.elf
;;
*)
echo "Bye."
;;
esac
;;
*)
echo "Bye."
;;
esac