mirror of
https://github.com/AuxXxilium/arc-c.git
synced 2024-11-23 23:11:08 +07:00
b1694ade0c
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
16 lines
511 B
Bash
Executable File
16 lines
511 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
read_u8() {
|
|
dd if=$1 bs=1 skip=$(($2)) count=1 2>/dev/null | od -An -tu1 | grep -Eo '[0-9]+'
|
|
}
|
|
read_u32() {
|
|
dd if=$1 bs=1 skip=$(($2)) count=4 2>/dev/null | od -An -tu4 | grep -Eo '[0-9]+'
|
|
}
|
|
|
|
set -x
|
|
setup_size=$(read_u8 $1 0x1f1)
|
|
payload_offset=$(read_u32 $1 0x248)
|
|
payload_length=$(read_u32 $1 0x24c)
|
|
inner_pos=$((($setup_size + 1) * 512))
|
|
|
|
tail -c+$(($inner_pos + 1)) $1 | tail -c+$(($payload_offset + 1)) | head -c $(($payload_length)) | head -c $(($payload_length - 4)) | unlzma >$2 |