Douyin APP cache extraction token

Douyin caches some data locally, including ck (device information, token, app version information, etc.), and the data can be extracted through the Android program for normal testing. Because the data is cached in the application's independent data directory, Android does not allow apps to access each other's independent data by default, and it can be extracted only after the phone is rooted.

Cache file directory:

The core operation extracted by /data/data/com.ss.android.ugc.aweme/shared_prefs
is to execute the script on the Android phone through Runtime, execute Runtime, execute su, then cat to view the contents of the cache file, and finally read the content output by cat. This part of the code is given here.

public static String execCmdForResult(String... cmds) {
    StringBuffer stringBuffer = new StringBuffer();
    try {
        Process process = Runtime.getRuntime().exec("su");
        OutputStream os = process.getOutputStream();
        process.getErrorStream();
        InputStream is = process.getInputStream();
        int i = cmds.length;
        for (int j = 0; j < i; j++) {
            String str = cmds[j];
            os.write((str + "\n").getBytes());
        }
        os.write("exit\n".getBytes());
        os.flush();
        os.close();
 
        stringBuffer.append(readStream(is));
 
        process.waitFor();
        process.destroy();
    } catch (Exception localException) {     }     return stringBuffer.toString(); } public static String readStream(InputStream inStream) throws Exception {     ByteArrayOutputStream outSteam = new ByteArrayOutputStream();     byte[] buffer = new byte[1024 ];     int len ​​= -1;     while ((len = inStream.read(buffer)) != -1) {         outSteam.write(buffer, 0, len);     }     outSteam.close();     inStream.close();     return new String(outSteam.toByteArray()); } We mainly extract these five files. The cache file contains data



 
 











ttnetCookieStore.xml cookie, involving sensitive data, the data needs to be decoded (decode method in the code below)
token_shared_preference.xml x-tt-token
wschannel_multi_process_config.xml Logged device information, including device_id install_id application version mobile phone version and other query general parameters. 
applog_stats.xml mac_addr fingerprint_codes, etc.
LoginSharePreferences.xml The account information of the last login.
The extracted content needs to be decrypted again, and the part is plain text

The five files are extracted and merged, and finally the following json is obtained, which can be used to test the Douyin interface (sensitive data has been coded)

{   "cookies": "n_mh=PNM9_mnN-Sn-enP8doLLQFlfusO7exHcL0lP4QE0MKg; install_id=code; passport_csrf_token_default=code; sid_guard=code%7C1623491553%7C5184000%7CWed%2C+11- Aug-2021+09%3A52%3A33+GMT ; odin_tt=code; odin_tt=code; sessionid_ss=5c91e35bbe600ff83e97f27b9bd2467b; sid_tt=code; uid_tt_ss=code; sessionid=code; uid_tt=code; d_ticket=6dfa101f3e38eb 553ac11d027b16a588a61ef; ttreq=1$4502faafefd6da2e3473b0bbcbc14a1a9a9c2afc; passport_csrf_token=code; ",   "token": "Coding-1.0.1",   "devices": {     "channel_id": 1239108,     "app_id": 1128,     "device_id": "xxx",     "install_id": "xxx",     "urls ": [       "wss://frontier-aweme.snssdk.com/ws/v2"     ],     "app_version": 100900,     "platform": 0,












    "fpid": 9,
    "app_kay": "e1bd35ec9db7b8d846de66ed140b1ad9",
    "extra": "os_api=23&device_type=MI 5s&manifest_version_code=100901&dpi=416&uuid=default&is_background=0&app_name=aweme&version _name=10.9.0&ts=1623491553&sid=device&app_type=normal&ac= wifi&host_abi=armeabi-v7a&update_version_code=10909900&channel=tengxun_new&_rticket=1623491553963&device_platform=android&iid=latest&ne=1&version_code=100900&cdid=latest &openudid=latest &device_id=design&resolution=1053*1872&os_version=6.0.1&language=zh&device_brand=Xiaomi&aid=1128"
    , os_api": "23",
    "device_type": "MI 5s",
    "manifest_version_code":"100901",
    "dpi": "416",
    "uuid": "打码",
    "is_background": "0",
    "app_name": "aweme",
    "version_name": "10.9.0",
    "ts": "1623491553",
    "sid": "xxx",
    "app_type": "normal",
    "ac": "wifi",
    "host_abi": "armeabi-v7a",
    "update_version_code": "10909900",
    "channel": "tengxun_new",
    "_rticket": "1623491553963",
    "device_platform": "android",
    "iid": "打码",
    "ne": "1",
    "version_code": "100900",
    "cdid": "打码",
    "openudid": "打码",
    "resolution": "1053*1872",
    "os_version": "6.0.1",
    "language": "zh",
    "device_brand": "Xiaomi",
    "aid": "1128"
  },
  "fingerprint_codes": "[1,2,3,4,5,6]",
  "mac_addr": "08:00:27:ED:打码:打码",
  "lastLoginInfo": {
    "phoneNumber": {
      "countryCode_": 86,
      "countryIso_": "CN",
      "nationalNumber_": 打码,
      "rawInput_": ""
    },
    "commonUserInfo": {
      "avatarUrl": "http://p9.douyinpic.com/aweme/100x100/打码.jpeg",
      "secUid": "打码-nFIdeSIthEH52a",
      "userName": "打码"
    },
    "expires": "Jul 12, 2021 5:52:33 PM",
    "lastIsReliableLogin": 0,
    "loginMethodName": "PHONE_SMS",
    "uid": "打码"
  }
}

https://blog.csdn.net/u014792378/article/details/118183398

Extracting token analysis through Douyin APP cache

AUTOJS backup restores Douyin CK data with php processing interface_XQMCN's blog-CSDN blog_Douyin ck backup

Guess you like

Origin blog.csdn.net/wuhualong1314/article/details/125640363