diff --git a/customscripts/hibp-download-parser.sh b/customscripts/hibp-download-parser.sh new file mode 100644 index 0000000..72ca494 --- /dev/null +++ b/customscripts/hibp-download-parser.sh @@ -0,0 +1,22 @@ +#!/bin/bash +max=65535 # FFFF +txtfile="/mnt/e/2025-12-17_hibp_sha1.txt" +outdir="/mnt/e/hibp_parsed" + +if [ ! -d "$outdir" ]; then + echo "creating $outdir" + mkdir "$outdir" +else + echo "clearing $outdir" + rm -f "$outdir/*" +fi + +# remove the carriage returns from file +# sed -i "s/\x0d//g" "$txtfile" + +for ((i = 0; i <= $max; i++)); do + HEX_VAL=$(printf "%04X" $i) # %04X to give padding 0s up to four + echo "$HEX_VAL" + rg -N "^$HEX_VAL" "$txtfile" >> "$outdir/$HEX_VAL.txt" + echo $? +done \ No newline at end of file