Ejemplo n.º 1
0
        public string Login(string name, string pwd)
        {
            name = Base64Cryptor.Encrypt(name);
            pwd  = Md5Cryptor.Encrypt(pwd);

            string         url_login = OrderService.host + ":8088/sysuser/login";
            HttpWebRequest request   = WebRequest.Create(url_login) as HttpWebRequest;

            request.Method      = "POST";
            request.ContentType = "application/json";
            string content = String.Format("{{\"username\":\"{0}\",\"loginPwd\":\"{1}\"}}", name, pwd);

            byte[] data = Encoding.UTF8.GetBytes(content);
            request.ContentLength = data.Length;
            request.Headers.Add("token", token);
            request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36";
            using (Stream reqStream = request.GetRequestStream())
            {
                reqStream.Write(data, 0, data.Length);
                reqStream.Close();
            }

            HttpWebResponse response  = (HttpWebResponse)request.GetResponse();
            string          retString = null;

            using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
            {
                retString = reader.ReadToEnd();
            }
            Stream myResponseStream = response.GetResponseStream();


            return(retString);
        }
Ejemplo n.º 2
0
        public UserSigInfo(uint uin, string password)
        {
            Uin = uin;

            PasswordMd5 = new Md5Cryptor().Encrypt(Encoding.UTF8.GetBytes(password));
            Tlv106Key   = new Md5Cryptor().Encrypt(PasswordMd5
                                                   .Concat(new byte[] { 0x00, 0x00, 0x00, 0x00 })
                                                   .Concat(BitConverter.GetBytes(uin).Reverse()).ToArray());

            DPassword = MakeDpassword();
            GSecret   = MakeGSecret(DeviceInfo.System.Imei, DPassword, null);

            SyncCookie = MakeSyncCookie();
        }
Ejemplo n.º 3
0
            public TlvBody(ushort subCmd, uint uin, string password, uint ssoseq,
                           byte[] tgtgKey) : base()
            {
                // 設備訊息上報
                var deviceReport = new DeviceReport
                {
                    Bootloader   = Encoding.UTF8.GetBytes(DeviceInfo.Build.Bootloader),
                    Version      = new byte[0], // Encoding.UTF8.GetBytes(DeviceInfo.System.OsVersion),
                    CodeName     = Encoding.UTF8.GetBytes(DeviceInfo.Build.CodeName),
                    Incremental  = Encoding.UTF8.GetBytes(DeviceInfo.Build.Incremental),
                    Fingerprint  = Encoding.UTF8.GetBytes(DeviceInfo.Build.Fingerprint),
                    BootId       = new byte[0], // Encoding.UTF8.GetBytes(DeviceInfo.BootId),
                    AndroidId    = Encoding.UTF8.GetBytes(DeviceInfo.System.AndroidId),
                    BaseBand     = Encoding.UTF8.GetBytes(DeviceInfo.Build.BaseBand),
                    InnerVersion = Encoding.UTF8.GetBytes(DeviceInfo.Build.InnerVersion)
                };
                MemoryStream reportData = new MemoryStream();

                Serializer.Serialize(reportData, deviceReport);

                var passwordMd5 = new Md5Cryptor().Encrypt(Encoding.UTF8.GetBytes(password));

                // 構建 tlv
                TlvPacker tlvs = new TlvPacker();

                tlvs.PutTlv(new T18(AppInfo.appId, AppInfo.appClientVersion, uin));
                tlvs.PutTlv(new T1(uin, DeviceInfo.Network.Wifi.IpAddress));
                tlvs.PutTlv(new T106(AppInfo.appId, AppInfo.subAppId, AppInfo.appClientVersion, uin,
                                     new byte[4], true, passwordMd5, 0, tgtgKey, true, DeviceInfo.Guid, LoginType.Password));
                tlvs.PutTlv(new T116(184024956, 66560));
                tlvs.PutTlv(new T100(AppInfo.appId, AppInfo.subAppId, AppInfo.appClientVersion));
                tlvs.PutTlv(new T107(0, 0, 0));
                tlvs.PutTlv(new T142(AppInfo.apkPackageName));
                tlvs.PutTlv(new T144(DeviceInfo.System.AndroidId, reportData.ToArray(), DeviceInfo.System.Os,
                                     DeviceInfo.System.OsVersion, DeviceInfo.Network.Type, DeviceInfo.Network.Mobile.OperatorName,
                                     DeviceInfo.Network.Wifi.ApnName, true, true, false, DeviceInfo.Guid, 285212672,
                                     DeviceInfo.System.ModelName, DeviceInfo.System.Manufacturer, tgtgKey));
                tlvs.PutTlv(new T145(DeviceInfo.Guid));
                tlvs.PutTlv(new T147(AppInfo.appId, AppInfo.apkVersionName, AppInfo.apkSignature));
                // tlvs.PushTlv(new 166());
                tlvs.PutTlv(new T154(ssoseq));
                tlvs.PutTlv(new T141(DeviceInfo.Network.Mobile.OperatorName, DeviceInfo.Network.Type, DeviceInfo.Network.Wifi.ApnName));
                tlvs.PutTlv(new T8());
                tlvs.PutTlv(new T511(new string[]
                {
                    "office.qq.com",
                    "qun.qq.com",
                    "gamecenter.qq.com",
                    "docs.qq.com",
                    "mail.qq.com",
                    "ti.qq.com",
                    "vip.qq.com",
                    "tenpay.com",
                    "qqweb.qq.com",
                    "qzone.qq.com",
                    "mma.qq.com",
                    "game.qq.com",
                    "openmobile.qq.com",
                    "connect.qq.com",
                }));
                tlvs.PutTlv(new T187(DeviceInfo.Network.Wifi.MacAddress));
                tlvs.PutTlv(new T188(DeviceInfo.System.AndroidId));
                // tlvs.PushTlv(Tlv.194());
                tlvs.PutTlv(new T191());
                tlvs.PutTlv(new T202(DeviceInfo.Network.Wifi.ApMacAddress, DeviceInfo.Network.Wifi.Ssid));
                tlvs.PutTlv(new T177(AppInfo.WtLoginSdk.buildTime, AppInfo.WtLoginSdk.sdkVersion));
                tlvs.PutTlv(new T516());
                tlvs.PutTlv(new T521());
                tlvs.PutTlv(new T525(new T536(new byte[] { 0x01, 0x00 })));
                // tlvs.PushTlv(new T544());
                // tlvs.PushTlv(new T545());

                PutUshortBE(subCmd);
                PutBytes(tlvs.GetBytes(true));
            }