FlagVM/hexer.sh
cannoli-fruit d23a3e49ff Init
2026-07-24 02:56:45 -04:00

20 lines
No EOL
294 B
Bash
Executable file

#!/usr/bin/env bash
set -e
if [ $# -lt 1 ]; then
echo "Usage: $0 input.hex [output.bin]"
exit 1
fi
input="$1"
if [ $# -ge 2 ]; then
output="$2"
else
output="${input%.*}.bin"
fi
perl -ne 's/#.*//; print pack("H*", $_ =~ s/\s+//gr)' "$input" > "$output"
echo "Wrote $output"