sneedmc/id.sh
2022-04-08 09:49:35 -04:00

26 lines
985 B
Bash
Executable File

#!/bin/sh
#git fetch --all
#git reset --hard origin/develop
wget "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
#sed -i "s/.*Launcher_MSA_CLIENT_ID.*/set(Launcher_MSA_CLIENT_ID \"$client_id\" CACHE STRING \"Client ID you can get from Microsoft Identity Platform when you register an application\")/g" CMakeLists.txt
#git commit -S -am "update to new MultiMC MSA ID" || echo "not changing ID" && (git remote | xargs -L1 git push --all)