Skip to content

Instantly share code, notes, and snippets.

@R0rt1z2
Created April 8, 2022 11:55
Show Gist options
  • Save R0rt1z2/5ab72761cc3defd95140ca267188194c to your computer and use it in GitHub Desktop.
Save R0rt1z2/5ab72761cc3defd95140ca267188194c to your computer and use it in GitHub Desktop.
original_lk=$1
modified_lk=$2
if [ ! -f "$original_lk" ] && [ ! -f "$modified_lk" ];
then
echo "[-] Invalid image(s)!"
exit 1
fi
header=$(dd if="$original_lk" bs=1 skip=8 count=2 2>/dev/null)
if [ "$header" != "lk" ] && [ "$header" != "LK" ];
then
echo "[-] Can't find the LK header in $original_lk!"
exit 1
fi
dd if="$original_lk" of=out_buf.bin bs=$((0x200)) count=1 2>/dev/null
cat $modified_lk >> out_buf.bin && rm "$modified_lk"
mv out_buf.bin $modified_lk && echo "[+] Ok"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment