a two-part guide for retreiving cosmo tokens. part one handles creating a rooted emulator device and retrieving your account tokens, which is as far as most users will need to go. part two handles retrieving the cosmo BASE64_ENCRYPTION_KEY value, which is the same for all users and not required by any of my tools.
android studio and android SDKyay -S android-studio android-sdk-platform-tools
android-studiodevice: pixel 8
API: API 34 android 14.0
services: google play store
system image: recommended x86_64 image
default boot: cold
camera: none
graphics: hardware acceleration
rootAVDgit clone "https://gitlab.com/newbit/rootAVD" && cd rootAVD
./rootAVD.sh ~/Android/Sdk/system-images/android-34/google_apis_playstore/x86_64/ramdisk.img
magiskcurl -Lo magisk.apk "https://github.com/topjohnwu/Magisk/releases/latest/download/app-release.apk"
magisk onto the deviceadb install magisk.apk
magisk on the device, then update and reboot if requiredadb shell
su
magisk app and grant permissions when promptedhttptoolkityay -S httptoolkit
httptoolkit and select Android Device via ADBhttptoolkit and look for an entry named /bff/v3/users/login-by-privyto my knowledge tokens expire after approximately one week. once expired, tokens can be refreshed using cosmo-refresh. this simple script saves you from having to open up an emulator and monitor the network traffic to get your new tokens every time the old ones expire.
fridapip install frida-tools
fridaFRIDA_VERSION=$(frida --version)
curl -Lo frida-server.xz "https://github.com/frida/frida/releases/download/${FRIDA_VERSION}/frida-server-${FRIDA_VERSION}-android-x86_64.xz"
unxz -f frida-server.xz
adb push frida-server /data/local/tmp/frida-server
adb shell chmod 755 /data/local/tmp/frida-server
adb shell "/data/local/tmp/frida-server &"
hook.jscurl -LO "https://codeberg.org/djvu/cosmo-util/raw/branch/master/cosmo-token/hook.js"
fridafrida -U -f com.modhaus.cosmo -l hook.js
frida output