sneedmc/id.sh
sneedium 478ee95ffe
Improved CurseForge API key checking.
Signed-off-by: sneedium <sneed@sneedmc.org>
2022-09-04 20:23:25 -04:00

19 lines
647 B
Bash
Executable File

#!/bin/sh
# Credit to Lenny for this script.
wget -q "https://files.multimc.org/downloads/mmc-stable-lin64.tar.gz"
tar xzf mmc-stable-lin64.tar.gz
#pushd MultiMC/bin
cd MultiMC/bin
client_id_asm=$(objdump -j '.text' --no-show-raw-insn -C --disassemble='Secrets::getMSAClientID(unsigned char)' MultiMC)
client_id="$(grep -oP '[a-z0-9]{2}(?=,%r[89]d)' <<< ${client_id_asm} | tac | tr -d '\n')$(grep -oP '(push.+0x)\K[a-z0-9]{2}' <<< ${client_id_asm} | tac | tr -d '\n')"
client_id="${client_id:0:8}-${client_id:8:4}-${client_id:12:4}-${client_id:16:4}-${client_id:20}"
#popd
cd ../../
echo -n $client_id
rm -rf mmc-stable-lin64.tar.gz* MultiMC