Skip to content

Instantly share code, notes, and snippets.

@shmerl
Last active January 8, 2022 17:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shmerl/271659ca6831db943a37 to your computer and use it in GitHub Desktop.
Save shmerl/271659ca6831db943a37 to your computer and use it in GitHub Desktop.
#!/bin/bash
# $1 - exe part of the archive
# Note:
# Game ID can also be obtained as
# game_id=$(curl -s -o- "$gog_game_url" | pcregrep --buffer-size 1M -o1 "addToCart\('/cart/add/(\d+)'\)")
rar_header='526172211a07'
innoextract "$1"
bin_file=${1%%.exe}.bin
if [ ! -e "$bin_file" ]
then
exit
fi
header=$(xxd -p -l 6 "$bin_file")
if [[ "$header" == "$rar_header" ]]
then
game_id=$(ls -1 tmp/ | pcregrep -o1 '(\d+)\.ini')
game_pass=$(printf "$game_id" | md5sum | cut -d ' ' -f 1)
unrar x "$bin_file" -p"$game_pass"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment