Beispiel #1
0
 private static string ReqLongParam() => "cur_buvid=NONE&client_timestamp="
 + LoginUtils.GetUnix(true) +
 "&sdk_type=1&isRoot=0&merchant_id=590&dp=2560*1440&mac=AA%3ABB%3ACC%3ADD%3AEE%3AFF&uid="
 + uid +
 "&support_abis=arm64-v8a%2Carmeabi-v7a%2Carmeabi&platform_type=3&old_buvid=NONE&operators=5&model=Mi+6&udid=bm9uZQ==&net=4&app_id=180&brand=Android&game_id=180&timestamp="
 + LoginUtils.GetUnix(true) +
 "&ver=3.8.0&c=1&version_code=280&server_id=378&version=1&domain_switch_count=0&pf_ver=9&access_key="
 + access_key +
 "domain=line1-sdk-center-login-sh.biligame.net&original_domain=&imei=123456789012345&sdk_log_type=1&sdk_ver=2.7.0&android_id=aabbccddeeff2333&channel_id=1";
Beispiel #2
0
        public static async void UserLoginAsync(string username, string password, string ticket)
        {
            try
            {
                //client/rsa
                string  postData = ReqLongParam();
                JObject tmp      = await LoginUtils.Bili.PostRequestAsync(BiliUrl.Client_GetRsa, postData);

                string publicKey = tmp["rsa_key"].ToString();
                string hash      = tmp["hash"].ToString();
                string pwd       = Uri.EscapeDataString(LoginUtils.Bili.GetPwd(publicKey, hash + password));

                //client/login
                postData = ReqLongParam() + "&pwd=" + pwd + "&user_id=" + username;
                tmp      = await LoginUtils.Bili.PostRequestAsync(
                    BiliUrl.Client_Login,
                    postData);

                if (tmp["code"].ToObject <int>() != 0)
                {
                    throw new Exception("登陆错误:" + tmp["message"].ToString());
                }
                access_key = tmp["access_key"].ToString();
                uid        = tmp["uid"].ToString();

                //client/user.info
                postData = ReqLongParam();
                await LoginUtils.Bili.PostRequestAsync(
                    BiliUrl.Client_UserInfo,
                    postData);

                //combo/granter/login
                string sign = LoginUtils.miHoYo.GetSign("app_id=1&channel_id=14&data={\"uid\":" + uid + ",\"access_key\":\"" + access_key + "\"}&device=aabbccddeeff2333aabbccddeeff2333");
                postData = "{\"data\":\"{\\\"uid\\\":" + uid + ",\\\"access_key\\\":\\\"" + access_key + "\\\"}\",\"sign\":\"" + sign + "\",\"app_id\":1,\"channel_id\":14,\"device\":\"aabbccddeeff2333aabbccddeeff2333\"}";
                tmp      = JObject.Parse(
                    LoginUtils.miHoYo.PhttpReq(
                        miHoYoUrl.Combo_Login,
                        postData,
                        true));

                if (tmp["retcode"].ToObject <int>() != 0)
                {
                    throw new Exception("login error");
                }
                string combo_token = tmp["data"]["combo_token"].ToString();
                string combo_id    = tmp["data"]["combo_id"].ToString();

                //combo/panda/qrcode/scan
                string ts = LoginUtils.GetUnix(true);
                sign     = LoginUtils.miHoYo.GetSign("app_id=1&device=aabbccddeeff2333aabbccddeeff2333&ticket=" + ticket + "&ts=" + ts);
                postData = "{\"sign\":\"" + sign + "\",\"ticket\":\"" + ticket + "\",\"app_id\":1,\"device\":\"aabbccddeeff2333aabbccddeeff2333\",\"ts\":" + ts + "}";
                tmp      = JObject.Parse(
                    LoginUtils.miHoYo.PhttpReq(
                        miHoYoUrl.Combo_QRScan,
                        postData));

                if (tmp["message"].ToString() != "OK")
                {
                    throw new Exception("qrscan error");
                }

                //combo/panda/qrcode/confirm
                ts   = LoginUtils.GetUnix(true);
                sign = LoginUtils.miHoYo.GetSign("app_id=1&device=aabbccddeeff2333aabbccddeeff2333&payload.ext={\"data\":{\"accountType\":2,\"accountID\":\"" + uid + "\",\"accountToken\":\"" + combo_token + "\",\"dispatch\":{\"account_url\":\"https://gameapi.account.mihoyo.com\", \"account_url_backup\":\"http://webapi.account.mihoyo.com\", \"asset_boundle_url\":\"https://bundle.bh3.com/asset_bundle/bb01/1.0\", \"ex_resource_url\":\"bundle.bh3.com/tmp/Original\", \"ext\":{\"data_use_asset_boundle\":\"1\", \"disable_msad\":\"1\", \"res_use_asset_boundle\":\"1\"}, \"gameserver\":{\"ip\":\"106.14.219.183\", \"port\":\"15100\"}, \"gateway\":{\"ip\":\"106.14.219.183\", \"port\":\"15100\"}, \"oaserver_url\":\"http://139.196.248.220:1080\", \"region_name\":\"bb01\", \"retcode\":\"0\", \"server_ext\":{\"cdkey_url\":\"https://api-takumi.mihoyo.com/common/\", \"is_official\":\"1\"}}}}&payload.proto=Combo&payload.raw={\"device_id\":\"aabbccddeeff2333aabbccddeeff2333\",\"open_id\":\"" + uid + "\",\"heartbeat\":false,\"asterisk_name\":\"" + username.Substring(0, 6) + "...\",\"app_id\":1,\"channel_id\":14,\"combo_id\":" + combo_id + ",\"combo_token\":\"" + combo_token + "\"}&ticket=" + ticket + "&ts=" + ts);

                postData = "{\"sign\":\"" + sign + "\",\"ticket\":\"" + ticket + "\",\"app_id\":1,\"device\":\"aabbccddeeff2333aabbccddeeff2333\",\"payload\":{\"ext\":\"{\\\"data\\\":{\\\"accountType\\\":2,\\\"accountID\\\":\\\"" + uid + "\\\",\\\"accountToken\\\":\\\"" + combo_token + "\\\",\\\"dispatch\\\":{\\\"account_url\\\":\\\"https://gameapi.account.mihoyo.com\\\", \\\"account_url_backup\\\":\\\"http://webapi.account.mihoyo.com\\\", \\\"asset_boundle_url\\\":\\\"https://bundle.bh3.com/asset_bundle/bb01/1.0\\\", \\\"ex_resource_url\\\":\\\"bundle.bh3.com/tmp/Original\\\", \\\"ext\\\":{\\\"data_use_asset_boundle\\\":\\\"1\\\", \\\"disable_msad\\\":\\\"1\\\", \\\"res_use_asset_boundle\\\":\\\"1\\\"}, \\\"gameserver\\\":{\\\"ip\\\":\\\"106.14.219.183\\\", \\\"port\\\":\\\"15100\\\"}, \\\"gateway\\\":{\\\"ip\\\":\\\"106.14.219.183\\\", \\\"port\\\":\\\"15100\\\"}, \\\"oaserver_url\\\":\\\"http://139.196.248.220:1080\\\", \\\"region_name\\\":\\\"bb01\\\", \\\"retcode\\\":\\\"0\\\", \\\"server_ext\\\":{\\\"cdkey_url\\\":\\\"https://api-takumi.mihoyo.com/common/\\\", \\\"is_official\\\":\\\"1\\\"}}}}\",\"raw\":\"{\\\"device_id\\\":\\\"aabbccddeeff2333aabbccddeeff2333\\\",\\\"open_id\\\":\\\"" + uid + "\\\",\\\"heartbeat\\\":false,\\\"asterisk_name\\\":\\\"" + username.Substring(0, 6) + "...\\\",\\\"app_id\\\":1,\\\"channel_id\\\":14,\\\"combo_id\\\":" + combo_id + ",\\\"combo_token\\\":\\\"" + combo_token + "\\\"}\",\"proto\":\"Combo\"},\"ts\":" + ts + "}";

                tmp = JObject.Parse(
                    LoginUtils.miHoYo.PhttpReq(
                        miHoYoUrl.Combo_Confirm,
                        postData));

                if (tmp["message"].ToString() != "OK")
                {
                    throw new Exception("qrscan confirm error.\r\n" + tmp["message"].ToString());
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }