intercepting cosmo

requirements

create a device

  1. install android studio and android SDK
  2. yay -S android-studio android-sdk-platform-tools
  3. run android-studio
  4. open the virtual device manager
  5. create a new device with the following settings
  6. device:         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
  7. boot the device
  8. open the play store and install cosmo

root the device

  1. download rootAVD
  2. git clone https://gitlab.com/newbit/rootAVD && cd rootAVD
  3. run the script
  4. ./rootAVD.sh ~/Android/Sdk/system-images/android-34/google_apis_playstore/x86_64/ramdisk.img
  5. restart the device (cold boot)

become a superuser

  1. download magisk
  2. curl -L https://github.com/topjohnwu/Magisk/releases/latest/download/app-release.apk -o magisk.apk
  3. sideload magisk onto the device
  4. adb install magisk.apk
  5. open magisk on the device, then update and reboot if required
  6. ask for root access
  7. adb shell
    su
  8. switch to the superuser tab in the magisk app and grant permissions when prompted

monitor network traffic

  1. install httptoolkit
  2. yay -S httptoolkit
  3. run httptoolkit and select Android Device via ADB
  4. confirm access on the device, ensuring system trust is enabled
  5. open cosmo and create an account
  6. monitor traffic inside httptoolkit to find tokens
  7. view a livestream to find api key located in a stream.io url

example responses

  1. authentication
  2. {
      "user": {
        "id": 123456,
        "email": "cosmo@mail.com",
        "address": "0x3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "nickname": "cosmo",
        "guid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      },
      "credentials": {
        "accessToken": "eyJxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "refreshToken": "eyJxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  3. livestream
  4. wss://video.stream-io-api.com/video/connect?api_key=XXXXXXXXXXXX&stream-auth-type=jwt&X-Stream-Client=stream-video-react_native-v1.24.0%7Cclient_bundle%3Dbrowser-esm"