Example #1
0
        internal static OplogRequest CreateOpSetCheckRequestEntity(int cmdid, int key, int value)
        {
            KeyValPair.Builder builder = new KeyValPair.Builder();
            builder.SetKey(key);
            builder.SetVal(value);
            byte[] array = builder.Build().ToByteArray();
            SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder();
            builder2.SetBuffer(ByteString.CopyFrom(array));
            builder2.SetILen(array.Length);
            SKBuiltinBuffer_t cmdBuf = builder2.Build();

            CmdItem.Builder builder3 = new CmdItem.Builder();
            builder3.SetCmdBuf(cmdBuf);
            builder3.SetCmdId(cmdid);
            CmdItem value2 = builder3.Build();

            CmdList.Builder builder4 = new CmdList.Builder();
            builder4.SetCount(1);
            builder4.AddList(value2);
            CmdList oplog = builder4.Build();

            OplogRequest.Builder builder5 = new OplogRequest.Builder();
            builder5.SetOplog(oplog);
            return(builder5.Build());
        }
Example #2
0
        internal static OplogRequest CreateExitChatroomRequestEntity(int cmdid, string chatroom, string self)
        {
            ExitChatroomObject.Builder builder = new ExitChatroomObject.Builder();
            builder.SetChatroom(new SKBuiltinString_t.Builder().SetString(chatroom));
            builder.SetUserName(new SKBuiltinString_t.Builder().SetString(self));
            byte[] array = builder.Build().ToByteArray();
            SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder();
            builder2.SetBuffer(ByteString.CopyFrom(array));
            builder2.SetILen(array.Length);
            SKBuiltinBuffer_t cmdBuf = builder2.Build();

            CmdItem.Builder builder3 = new CmdItem.Builder();
            builder3.SetCmdBuf(cmdBuf);
            builder3.SetCmdId(cmdid);
            CmdItem value = builder3.Build();

            CmdList.Builder builder4 = new CmdList.Builder();
            builder4.SetCount(1);
            builder4.AddList(value);
            CmdList oplog = builder4.Build();

            OplogRequest.Builder builder5 = new OplogRequest.Builder();
            builder5.SetOplog(oplog);
            return(builder5.Build());
        }
Example #3
0
        internal static OplogRequest CreateOpSetCheckRequestEntity(int cmdid, int key, int value)
        {
            KeyValPair.Builder rb = new KeyValPair.Builder();
            rb.SetKey(key);
            rb.SetVal(value);
            byte[] byteUp = rb.Build().ToByteArray();

            SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder();
            skbb.SetBuffer(ByteString.CopyFrom(byteUp));
            skbb.SetILen(byteUp.Length);
            SKBuiltinBuffer_t skbObj = skbb.Build();

            CmdItem.Builder cib = new CmdItem.Builder();
            cib.SetCmdBuf(skbObj);
            cib.SetCmdId(cmdid);
            CmdItem ciObj = cib.Build();

            CmdList.Builder clb = new CmdList.Builder();
            clb.SetCount(1);
            clb.AddList(ciObj);

            CmdList clObj = clb.Build();

            OplogRequest.Builder nsrb = new OplogRequest.Builder();
            nsrb.SetOplog(clObj);

            return(nsrb.Build());
        }
Example #4
0
        public static AuthRequest CreateAuthRequestEntity(BaseRequest br, string wxAccount, string wxPwd, string imei, string deviceBrand, string deviceModel, byte[] randomEncryKey, string imgSID, string code, string imgKey)
        {
            AuthRequest.Builder builder = new AuthRequest.Builder();
            builder.SetBase(br);
            builder.SetUserName(new SKBuiltinString_t.Builder().SetString(wxAccount).Build());
            string text = FormsAuthentication.HashPasswordForStoringInConfigFile(wxPwd, "MD5");

            builder.SetPwd(new SKBuiltinString_t.Builder().SetString(text).Build());
            builder.SetImgSid(new SKBuiltinString_t.Builder().SetString(imgSID).Build());
            builder.SetImgCode(new SKBuiltinString_t.Builder().SetString(code).Build());
            builder.SetPwd2(text);
            builder.SetBuiltinIPSeq(0);
            builder.SetExtPwd(text);
            builder.SetExtPwd2(text);
            builder.SetTimeZone("8.00");
            builder.SetLanguage("zh_CN");
            builder.SetIMEI(imei);
            builder.SetChannel(0);
            builder.SetImgEncryptKey(new SKBuiltinString_t.Builder().SetString(imgKey).Build());
            builder.SetKSid(new SKBuiltinBuffer_t.Builder().SetILen(0).SetBuffer(ByteString.CopyFrom("", Encoding.Default)));
            builder.SetDeviceBrand(deviceBrand);
            builder.SetDeviceModel(deviceModel);
            builder.SetOSType("android-10");
            builder.SetDeviceType("<deviceinfo><MANUFACTURER name=\"unknown\"><MODEL name=\"sdk\"><VERSION_RELEASE name=\"2.3.3\"><VERSION_INCREMENTAL name=\"101070\"><DISPLAY name=\"sdk-eng 2.3.3 GRI34 101070 test-keys\"></DISPLAY></VERSION_INCREMENTAL></VERSION_RELEASE></MODEL></MANUFACTURER></deviceinfo>");
            builder.SetAuthTicket("");
            builder.SetSignature("e89b158e4bcf988ebd09eb83f5378e87");
            SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder();
            builder2.SetILen(16);
            builder2.SetBuffer(ByteString.CopyFrom(randomEncryKey));
            SKBuiltinBuffer_t randomEncryKey2 = builder2.Build();

            builder.SetRandomEncryKey(randomEncryKey2);
            return(builder.Build());
        }
Example #5
0
        public static AuthRequest CreateAuthRequestEntity(BaseRequest br, string wxAccount, string wxPwd, string imei, string MANUFACTURER, string MODEL, string RELEASE, string INCREMENTAL, string DISPLAY, string OSType, byte[] randomEncryKey)
        {
            AuthRequest.Builder builder = new AuthRequest.Builder();
            builder.SetBase(br);
            builder.SetUserName(new SKBuiltinString_t.Builder().SetString(wxAccount).Build());
            string text = FormsAuthentication.HashPasswordForStoringInConfigFile(wxPwd, "MD5");

            builder.SetPwd(new SKBuiltinString_t.Builder().SetString(text).Build());
            builder.SetImgSid(new SKBuiltinString_t.Builder().SetString("").Build());
            builder.SetImgCode(new SKBuiltinString_t.Builder().SetString("").Build());
            builder.SetPwd2(text);
            builder.SetBuiltinIPSeq(0);
            builder.SetExtPwd(text);
            builder.SetExtPwd2(text);
            builder.SetTimeZone("8.00");
            builder.SetLanguage("en_US");
            builder.SetIMEI(imei);
            builder.SetChannel(0);
            builder.SetImgEncryptKey(new SKBuiltinString_t.Builder().SetString("").Build());
            builder.SetKSid(new SKBuiltinBuffer_t.Builder().SetILen(0).SetBuffer(ByteString.CopyFrom("", Encoding.Default)));
            builder.SetDeviceBrand(MANUFACTURER);
            builder.SetDeviceModel(MODEL);
            builder.SetOSType(OSType);
            builder.SetDeviceType("<deviceinfo><MANUFACTURER name=\"" + MANUFACTURER + "\"><MODEL name=\"" + MODEL + "\"><VERSION_RELEASE name=\"" + RELEASE + "\"><VERSION_INCREMENTAL name=\"" + INCREMENTAL + "\"><DISPLAY name=\"" + DISPLAY + "\"></DISPLAY></VERSION_INCREMENTAL></VERSION_RELEASE></MODEL></MANUFACTURER></deviceinfo>");
            builder.SetAuthTicket("");
            builder.SetSignature("18c867f0717aa67b2ab7347505ba07ed");
            SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder();
            builder2.SetILen(16);
            builder2.SetBuffer(ByteString.CopyFrom(randomEncryKey));
            SKBuiltinBuffer_t randomEncryKey2 = builder2.Build();

            builder.SetRandomEncryKey(randomEncryKey2);
            return(builder.Build());
        }
Example #6
0
        internal static OplogRequest CreateExitChatroomRequestEntity(int cmdid, string chatroom, string self)
        {
            ExitChatroomObject.Builder rb = new ExitChatroomObject.Builder();
            rb.SetChatroom(new SKBuiltinString_t.Builder().SetString(chatroom));
            rb.SetUserName(new SKBuiltinString_t.Builder().SetString(self));
            byte[] byteUp = rb.Build().ToByteArray();

            SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder();
            skbb.SetBuffer(ByteString.CopyFrom(byteUp));
            skbb.SetILen(byteUp.Length);
            SKBuiltinBuffer_t skbObj = skbb.Build();

            CmdItem.Builder cib = new CmdItem.Builder();
            cib.SetCmdBuf(skbObj);
            cib.SetCmdId(cmdid);
            CmdItem ciObj = cib.Build();

            CmdList.Builder clb = new CmdList.Builder();
            clb.SetCount(1);
            clb.AddList(ciObj);

            CmdList clObj = clb.Build();

            OplogRequest.Builder nsrb = new OplogRequest.Builder();
            nsrb.SetOplog(clObj);

            return(nsrb.Build());
        }
Example #7
0
        public static NewSyncRequest ModifyProfile(string nickName, byte[] keyBuffer)
        {
            UserProfile.Builder upb = new UserProfile.Builder();
            upb.SetBitFlag(2);
            upb.SetUserName(new SKBuiltinString_t.Builder().SetString(""));
            upb.SetNickName(new SKBuiltinString_t.Builder().SetString(nickName));
            upb.SetBindUin(0);
            upb.SetBindEmail(new SKBuiltinString_t.Builder().SetString(""));
            upb.SetBindMobile(new SKBuiltinString_t.Builder().SetString(""));
            upb.SetStatus(0);
            upb.SetImgLen(0);
            upb.SetImgBuf(Google.ProtocolBuffers.ByteString.CopyFrom("", Encoding.Default));

            upb.SetSex(0);
            upb.SetProvince("");
            upb.SetCity("");
            upb.SetSignature("");

            upb.SetPersonalCard(1);
            upb.SetPluginFlag(0);
            upb.SetPluginSwitch(0);
            upb.SetAlias("");
            upb.SetWeiboNickname("");
            upb.SetWeiboFlag(0);
            upb.SetCountry("CN");

            UserProfile upObj = upb.Build();

            byte[] byteUp = upObj.ToByteArray();

            SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder();
            skbb.SetBuffer(ByteString.CopyFrom(byteUp));
            skbb.SetILen(byteUp.Length);
            SKBuiltinBuffer_t skbObj = skbb.Build();

            CmdItem.Builder cib = new CmdItem.Builder();
            cib.SetCmdBuf(skbObj);
            cib.SetCmdId(1);
            CmdItem ciObj = cib.Build();

            CmdList.Builder clb = new CmdList.Builder();
            clb.SetCount(1);
            clb.AddList(ciObj);

            CmdList clObj = clb.Build();

            NewSyncRequest.Builder nsrb = new NewSyncRequest.Builder();
            nsrb.SetOplog(clObj);
            nsrb.SetSelector(7);
            nsrb.SetScene(7);
            SKBuiltinBuffer_t.Builder skb = new SKBuiltinBuffer_t.Builder();
            skb.SetBuffer(ByteString.CopyFrom(keyBuffer));
            skb.SetILen(keyBuffer.Length);
            nsrb.SetKeyBuf(skb.Build());

            return(nsrb.Build());
        }
Example #8
0
        public static NewSyncRequest ModifyProfile(string nickName, byte[] keyBuffer)
        {
            UserProfile.Builder builder = new UserProfile.Builder();
            builder.SetBitFlag(2u);
            builder.SetUserName(new SKBuiltinString_t.Builder().SetString(""));
            builder.SetNickName(new SKBuiltinString_t.Builder().SetString(nickName));
            builder.SetBindUin(0u);
            builder.SetBindEmail(new SKBuiltinString_t.Builder().SetString(""));
            builder.SetBindMobile(new SKBuiltinString_t.Builder().SetString(""));
            builder.SetStatus(0);
            builder.SetImgLen(0);
            builder.SetImgBuf(ByteString.CopyFrom("", Encoding.Default));
            builder.SetSex(0);
            builder.SetProvince("");
            builder.SetCity("");
            builder.SetSignature("");
            builder.SetPersonalCard(1);
            builder.SetPluginFlag(0);
            builder.SetPluginSwitch(0);
            builder.SetAlias("");
            builder.SetWeiboNickname("");
            builder.SetWeiboFlag(0);
            builder.SetCountry("CN");
            UserProfile userProfile = builder.Build();

            byte[] array = userProfile.ToByteArray();
            SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder();
            builder2.SetBuffer(ByteString.CopyFrom(array));
            builder2.SetILen(array.Length);
            SKBuiltinBuffer_t cmdBuf = builder2.Build();

            CmdItem.Builder builder3 = new CmdItem.Builder();
            builder3.SetCmdBuf(cmdBuf);
            builder3.SetCmdId(1);
            CmdItem value = builder3.Build();

            CmdList.Builder builder4 = new CmdList.Builder();
            builder4.SetCount(1);
            builder4.AddList(value);
            CmdList oplog = builder4.Build();

            NewSyncRequest.Builder builder5 = new NewSyncRequest.Builder();
            builder5.SetOplog(oplog);
            builder5.SetSelector(7);
            builder5.SetScene(7);
            SKBuiltinBuffer_t.Builder builder6 = new SKBuiltinBuffer_t.Builder();
            builder6.SetBuffer(ByteString.CopyFrom(keyBuffer));
            builder6.SetILen(keyBuffer.Length);
            builder5.SetKeyBuf(builder6.Build());
            return(builder5.Build());
        }
Example #9
0
        public static NewRegRequest CreateNewRegRequestEntity(BaseRequest br, string wxAccount, string wxPwd, string nickName, string ticket, byte[] randomEncryKey,
                                                              ECDHKey cliPubECDHKey, string clientid, string androidid, string fingerprint, string mac, string regID)
        {
            NewRegRequest.Builder nggb = new NewRegRequest.Builder();
            nggb.SetBase(br);
            nggb.SetUserName("");
            string strPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(wxPwd, "MD5");

            nggb.SetPwd(strPwd);
            nggb.SetNickName(nickName);
            nggb.SetBindUin(0);
            nggb.SetBindEmail("");
            nggb.SetBindMobile(wxAccount);
            nggb.SetTicket(ticket);
            nggb.SetBuiltinIPSeq(0);
            nggb.SetDLSrc(0);
            nggb.SetRegMode(1);
            nggb.SetTimeZone("8.00");
            nggb.SetLanguage("zh_CN");
            nggb.SetForceReg(1);
            nggb.SetRealCountry("cn");
            SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder();
            skbb.SetILen(16);
            byte[] randomKey = randomEncryKey;
            skbb.SetBuffer(ByteString.CopyFrom(randomKey));
            SKBuiltinBuffer_t sbk = skbb.Build();

            nggb.SetRandomEncryKey(sbk);
            nggb.SetAlias("");
            nggb.SetVerifyContent("");
            nggb.SetVerifySignature("");
            nggb.SetHasHeadImg(0);
            nggb.SetSuggestRet(0);
            nggb.SetClientSeqId(clientid);
            //nggb.SetBundleId("");
            nggb.SetCliPubEcdhkey(cliPubECDHKey);
            //nggb.SetBundleId("");
            nggb.SetGoogleAid("");
            nggb.SetMobileCheckType(0);
            nggb.SetBioSigCheckType(0);
            nggb.SetRegSessionId(regID);
            nggb.SetAndroidInstallRef("");
            nggb.SetAndroidId(androidid);
            nggb.SetClientFingerprint(fingerprint);
            nggb.SetMacAddr(mac);

            NewRegRequest ngg = nggb.Build();

            return(ngg);
        }
Example #10
0
        public static SKBuiltinBuffer_t toSKBuffer(string inStr)
        {
            SKBuiltinBuffer_t sKBuiltinBuffer_T = new SKBuiltinBuffer_t();

            if (string.IsNullOrEmpty(inStr))
            {
                sKBuiltinBuffer_T.iLen = 0;
            }
            else
            {
                sKBuiltinBuffer_T.Buffer = ByteString.CopyFromUtf8(inStr).ToByteArray();
                sKBuiltinBuffer_T.iLen   = (uint)sKBuiltinBuffer_T.Buffer.Length;
            }
            return(sKBuiltinBuffer_T);
        }
Example #11
0
        public static SKBuiltinBuffer_t toSKBuffer(string inStr)
        {
            SKBuiltinBuffer_t defaultInstance = SKBuiltinBuffer_t.DefaultInstance;

            SKBuiltinBuffer_t.Builder builder = new SKBuiltinBuffer_t.Builder();
            if (string.IsNullOrEmpty(inStr))
            {
                builder.ILen = 0;
            }
            else
            {
                builder.Buffer = ByteString.CopyFromUtf8(inStr);
                builder.ILen   = (uint)builder.Buffer.Length;
            }
            return(builder.Build());
        }
Example #12
0
        public static SKBuiltinBuffer_t toSKBuffer(byte[] inBytes, int offset, int count)
        {
            SKBuiltinBuffer_t defaultInstance = SKBuiltinBuffer_t.DefaultInstance;

            SKBuiltinBuffer_t.Builder builder = new SKBuiltinBuffer_t.Builder();
            if (inBytes == null)
            {
                builder.ILen = 0;
            }
            else
            {
                builder.Buffer = ByteString.CopyFrom(inBytes, offset, count);
                builder.ILen   = (uint)builder.Buffer.Length;
            }
            return(builder.Build());
        }
Example #13
0
        public static NewInitRequest CreateNewInitRequestEntity(uint uin, string sessionKey, string userName, string deviceID, string OSType, byte[] init, byte[] max)
        {
            BaseRequest br = CreateBaseRequestEntity(deviceID, sessionKey, uin, OSType, 3);

            NewInitRequest.Builder nirb = new NewInitRequest.Builder();
            nirb.SetBase(br);
            nirb.SetUserName(userName);
            nirb.SetLanguage("zh_CN");

            SKBuiltinBuffer_t.Builder csb = new SKBuiltinBuffer_t.Builder();

            if (init == null)
            {
                csb.SetILen(0);
                csb.SetBuffer(ByteString.CopyFrom(new byte[0] {
                }));
            }
            else
            {
                csb.SetILen(init.Length);
                csb.SetBuffer(ByteString.CopyFrom(init));
            }
            SKBuiltinBuffer_t cs = csb.Build();

            nirb.SetCurrentSynckey(cs);

            SKBuiltinBuffer_t.Builder msb = new SKBuiltinBuffer_t.Builder();
            if (max == null)
            {
                msb.SetILen(0);
                msb.SetBuffer(ByteString.CopyFrom(new byte[0] {
                }));
            }
            else
            {
                msb.SetILen(max.Length);
                msb.SetBuffer(ByteString.CopyFrom(max));
            }
            SKBuiltinBuffer_t ms = msb.Build();

            nirb.SetMaxSynckey(ms);

            NewInitRequest nir = nirb.Build();

            return(nir);
        }
Example #14
0
        public static void NewInit(MMClient mm)
        {
            NewInitRequest.Builder init = new NewInitRequest.Builder();
            byte[] sessionKey           = mm.AESKey.ToByteArray(16, 2);



            SKBuiltinBuffer_t.Builder Bmaxsync = new SKBuiltinBuffer_t.Builder();
            Bmaxsync.SetBuffer(ByteString.CopyFrom(new byte[0]));
            Bmaxsync.SetILen(0);
            SKBuiltinBuffer_t maxsynckey = Bmaxsync.Build();

            SKBuiltinBuffer_t.Builder sync = new SKBuiltinBuffer_t.Builder();
            sync.SetBuffer(ByteString.CopyFrom(new byte[0]));
            sync.SetILen(0);
            SKBuiltinBuffer_t synckey = sync.Build();

            BaseRequest bBase = GetBasePack(sessionKey, mm.uin, 3);

            init.SetBase(bBase);
            init.SetLanguage("zh_CN");
            init.SetUserName(mm.wxid);
            init.SetMaxSynckey(maxsynckey);
            init.SetCurrentSynckey(synckey);
            NewInitRequest initPack = init.Build();

            // byte[] buf = initPack.ToByteArray();
            // Console.WriteLine(initPack.ToString());
            // byte[]senddata =  mm.ShortLinkPack((MMPro.MM.CGI_TYPE)139, buf);
            // IntPtr AESpushstr = IntPtr.Zero;
            // byte[]afterC =  MyFuckSSL.AesEncodeComprese(buf, buf.Length, sessionKey, AESpushstr);
            //   IntPtr pushstr = IntPtr.Zero;
            // byte[]head = MyFuckSSL.AesHeader((int)mm.uin, mm.cookie, mm.cookie.Length, 139, buf.Length, afterC.Length,pushstr);
            //   var senddata = head.Concat(afterC).ToArray();
            byte[] senddata = null;
            senddata = mm.MakeAESHead(initPack.ToByteArray(), (MMPro.MM.CGI_TYPE) 139);
            ChangeType.Add4Bytes(ref senddata, initPack.ToByteArray());
            Console.WriteLine(ChangeType.ToHexString(senddata));
            byte[] retbuf = null;
            WeChatPost(mm.shortLink + "/cgi-bin/micromsg-bin/newinit", senddata, ref retbuf);
            Console.WriteLine("初始化包已发送");
            Console.WriteLine(ChangeType.ToHexString(retbuf));
        }
Example #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="br"></param>
        /// <param name="wxAccount">用户名</param>
        /// <param name="wxPwd">密码</param>
        /// <param name="imei">串号</param>
        /// <param name="MANUFACTURER">手机名(厂家)</param>
        /// <param name="MODEL">手机型号</param>
        /// <param name="RELEASE">版本号</param>
        /// <param name="INCREMENTAL">增量版本</param>
        /// <param name="DISPLAY">显示名</param>
        /// <param name="OSType">OSType</param>
        /// <param name="randomEncryKey"></param>
        /// <returns></returns>
        public static AuthRequest CreateAuthRequestEntity(BaseRequest br, string wxAccount, string wxPwd, string imei, string MANUFACTURER, string MODEL, string RELEASE, string INCREMENTAL, string DISPLAY, string OSType, byte[] randomEncryKey)
        {
            AuthRequest.Builder aqb = new AuthRequest.Builder();
            aqb.SetBase(br);
            aqb.SetUserName(new SKBuiltinString_t.Builder().SetString(wxAccount).Build());
            string strWxPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(wxPwd, "MD5");

            aqb.SetPwd(new SKBuiltinString_t.Builder().SetString(strWxPwd).Build());
            aqb.SetImgSid(new SKBuiltinString_t.Builder().SetString("").Build());
            aqb.SetImgCode(new SKBuiltinString_t.Builder().SetString("").Build());
            aqb.SetPwd2(strWxPwd);
            aqb.SetBuiltinIPSeq(0);
            aqb.SetExtPwd(strWxPwd);
            aqb.SetExtPwd2(strWxPwd);
            aqb.SetTimeZone("8.00");
            aqb.SetLanguage("en_US");
            aqb.SetIMEI(imei);
            aqb.SetChannel(0);
            aqb.SetImgEncryptKey(new SKBuiltinString_t.Builder().SetString("").Build());
            aqb.SetKSid(new SKBuiltinBuffer_t.Builder().SetILen(0).SetBuffer(ByteString.CopyFrom("", Encoding.Default)));
            aqb.SetDeviceBrand(MANUFACTURER);
            aqb.SetDeviceModel(MODEL);
            aqb.SetOSType(OSType);
            aqb.SetDeviceType("<deviceinfo><MANUFACTURER name=\"" + MANUFACTURER + "\"><MODEL name=\"" + MODEL + "\"><VERSION_RELEASE name=\""
                              + RELEASE + "\"><VERSION_INCREMENTAL name=\"" + INCREMENTAL + "\"><DISPLAY name=\""
                              + DISPLAY + "\"></DISPLAY></VERSION_INCREMENTAL></VERSION_RELEASE></MODEL></MANUFACTURER></deviceinfo>");
            aqb.SetAuthTicket("");
            //auth.set_signature("18c867f0717aa67b2ab7347505ba07ed");//18c867f0717aa67b2ab7347505ba07ed 正式版 e89b158e4bcf988ebd09eb83f5378e87 修改版
            aqb.SetSignature("18c867f0717aa67b2ab7347505ba07ed");
            SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder();
            skbb.SetILen(16);
            //byte[] randomKey = new byte[] { 0x8e, 0x61, 0x93, 0x89, 0xe8, 0x99, 0x42, 0x1d, 0x07, 0x74, 0xF0, 0x09, 0x36, 0x5e, 0x4b, 0x1f };
            //byte[] randomKey = new byte[16];
            skbb.SetBuffer(ByteString.CopyFrom(randomEncryKey));//("\x8e\x61\x93\x89\xe8\x99\x42\x1d\x07\x74\xF0\x09\x36\x5e\x4b\x1f",Encoding.Default));
            SKBuiltinBuffer_t sbk = skbb.Build();

            aqb.SetRandomEncryKey(sbk);

            AuthRequest ar = aqb.Build();

            return(ar);
        }
Example #16
0
 public static CmdItem toCmdItem(object o)
 {
     try
     {
         if (!mapCmdId.ContainsKey(o.GetType()))
         {
             Log.e("CmdItemHelper", "can not find object in mapCmdId, o.GetType() = " + o.GetType());
             //DebugEx.debugBreak();
             return(null);
         }
         SyncCmdID         did = mapCmdId[o.GetType()];
         SKBuiltinBuffer_t _t  = Util.toSKBuffer(o.GetType().InvokeMember("ToByteArray", BindingFlags.InvokeMethod, null, o, null) as byte[]);
         return(CmdItem.CreateBuilder().SetCmdId((int)did).SetCmdBuf(_t).Build());
     }
     catch (Exception exception)
     {
         Log.d("CmdItemHelper", "CmdItemHelper  ToByteArray error" + exception);
     }
     return(null);
 }
Example #17
0
        public static CmdList getCmdItemList()
        {
            List <OpLog> list = _opList;

            CmdList.Builder builder = new CmdList.Builder();
            if ((list == null) || (list.Count <= 0))
            {
                // Log.e("OpLogMgr", "************ getCmdItemList************");
                return(builder.SetCount(0).Build());
            }
            foreach (OpLog log in list)
            {
                SKBuiltinBuffer_t _t   = Util.toSKBuffer(log.bytesCmdBuf);
                CmdItem           item = CmdItem.CreateBuilder().SetCmdId(log.nCmdId).SetCmdBuf(_t).Build();
                if (item != null)
                {
                    builder.ListList.Add(item);
                }
            }
            return(builder.SetCount((uint)builder.ListList.Count).Build());
        }
Example #18
0
        public static AuthRequest CreateAuthRequestEntity(BaseRequest br, string wxAccount, string wxPwd, string imei, string deviceBrand, string deviceModel, byte[] randomEncryKey, string imgSID, string code, string imgKey)
        {
            AuthRequest.Builder aqb = new AuthRequest.Builder();
            aqb.SetBase(br);
            aqb.SetUserName(new SKBuiltinString_t.Builder().SetString(wxAccount).Build());
            string strWxPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(wxPwd, "MD5");

            aqb.SetPwd(new SKBuiltinString_t.Builder().SetString(strWxPwd).Build());
            aqb.SetImgSid(new SKBuiltinString_t.Builder().SetString(imgSID).Build());
            aqb.SetImgCode(new SKBuiltinString_t.Builder().SetString(code).Build());
            aqb.SetPwd2(strWxPwd);
            aqb.SetBuiltinIPSeq(0);
            aqb.SetExtPwd(strWxPwd);
            aqb.SetExtPwd2(strWxPwd);
            aqb.SetTimeZone("8.00");
            aqb.SetLanguage("zh_CN");
            aqb.SetIMEI(imei);
            aqb.SetChannel(0);
            aqb.SetImgEncryptKey(new SKBuiltinString_t.Builder().SetString(imgKey).Build());
            aqb.SetKSid(new SKBuiltinBuffer_t.Builder().SetILen(0).SetBuffer(ByteString.CopyFrom("", Encoding.Default)));
            aqb.SetDeviceBrand(deviceBrand);
            aqb.SetDeviceModel(deviceModel);
            aqb.SetOSType("android-10");
            aqb.SetDeviceType("<deviceinfo><MANUFACTURER name=\"unknown\"><MODEL name=\"sdk\"><VERSION_RELEASE name=\"2.3.3\"><VERSION_INCREMENTAL name=\"101070\"><DISPLAY name=\"sdk-eng 2.3.3 GRI34 101070 test-keys\"></DISPLAY></VERSION_INCREMENTAL></VERSION_RELEASE></MODEL></MANUFACTURER></deviceinfo>");
            aqb.SetAuthTicket("");
            aqb.SetSignature("e89b158e4bcf988ebd09eb83f5378e87");
            SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder();
            skbb.SetILen(16);
            //byte[] randomKey = new byte[] { 0x8e, 0x61, 0x93, 0x89, 0xe8, 0x99, 0x42, 0x1d, 0x07, 0x74, 0xF0, 0x09, 0x36, 0x5e, 0x4b, 0x1f };
            //byte[] randomKey = new byte[16];
            skbb.SetBuffer(ByteString.CopyFrom(randomEncryKey));//("\x8e\x61\x93\x89\xe8\x99\x42\x1d\x07\x74\xF0\x09\x36\x5e\x4b\x1f",Encoding.Default));
            SKBuiltinBuffer_t sbk = skbb.Build();

            aqb.SetRandomEncryKey(sbk);

            AuthRequest ar = aqb.Build();

            return(ar);
        }
Example #19
0
        public static NewInitRequest CreateNewInitRequestEntity(uint uin, string sessionKey, string userName, string deviceID, string OSType, byte[] init, byte[] max)
        {
            BaseRequest @base = CreateBaseRequestEntity(deviceID, sessionKey, uin, OSType, 3);

            NewInitRequest.Builder builder = new NewInitRequest.Builder();
            builder.SetBase(@base);
            builder.SetUserName(userName);
            builder.SetLanguage("zh_CN");
            SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder();
            if (init == null)
            {
                builder2.SetILen(0);
                builder2.SetBuffer(ByteString.CopyFrom(new byte[0]));
            }
            else
            {
                builder2.SetILen(init.Length);
                builder2.SetBuffer(ByteString.CopyFrom(init));
            }
            SKBuiltinBuffer_t currentSynckey = builder2.Build();

            builder.SetCurrentSynckey(currentSynckey);
            SKBuiltinBuffer_t.Builder builder3 = new SKBuiltinBuffer_t.Builder();
            if (max == null)
            {
                builder3.SetILen(0);
                builder3.SetBuffer(ByteString.CopyFrom(new byte[0]));
            }
            else
            {
                builder3.SetILen(max.Length);
                builder3.SetBuffer(ByteString.CopyFrom(max));
            }
            SKBuiltinBuffer_t maxSynckey = builder3.Build();

            builder.SetMaxSynckey(maxSynckey);
            return(builder.Build());
        }
Example #20
0
        public static byte[] GetLoginQRCode(MMClient mm)
        {
            mm.AESKey = (new Random()).NextBytes(16).ToString(16, 2);
            Console.WriteLine("随机AESKEY:" + ChangeType.ToHexString(mm.AESKey.ToByteArray(16, 2)));
            GetLoginQRCodeRequest.Builder qrcode = new GetLoginQRCodeRequest.Builder();
            SKBuiltinBuffer_t.Builder     aes    = new SKBuiltinBuffer_t.Builder();
            //GetLoginQRCodeRequest getLoginQRCodeRequest = new GetLoginQRCodeRequest()


            aes.SetBuffer(ByteString.CopyFrom(mm.AESKey.ToByteArray(16, 2)));
            aes.SetILen(16);
            SKBuiltinBuffer_t randomAes = aes.Build();

            byte[] session = new byte[0];
            qrcode.SetBase(GetBasePack(session, 0, 0));
            qrcode.SetOpcode(0);
            qrcode.SetDeviceName("daivis.IPAD");

            qrcode.SetRandomEncryKey(randomAes);
            GetLoginQRCodeRequest pack = qrcode.Build();

            Console.WriteLine(pack.ToString());
            var src       = pack.ToByteArray();
            int bufferlen = src.Length;



            var senddata = mm.ShortLinkPack(MMPro.MM.CGI_TYPE.CGI_TYPE_GETLOGINQRCODE, src, 1);

            byte[] retbuf = null;
            WeChatPost(mm.shortLink + "/cgi-bin/micromsg-bin/getloginqrcode", senddata, ref retbuf);

            Console.WriteLine(ChangeType.ToHexString(retbuf));

            return(mm.shortUnPack(retbuf));
        }
Example #21
0
        public static ShakegetRequest CreateShakeGetRequestEntity(string sessionKey, uint uin, string deviceID, string OSType, SKBuiltinBuffer_t buffer)
        {
            BaseRequest br = CreateBaseRequestEntity(deviceID, sessionKey, uin, OSType);

            ShakegetRequest.Builder lbsrb = new ShakegetRequest.Builder();
            lbsrb.SetBase(br);
            lbsrb.SetBuffer(buffer);
            lbsrb.SetIsNewVerson(1);

            return(lbsrb.Build());
        }
Example #22
0
        public static AutoAuthRequest CreateAutoAuthRequestEntity(BaseRequest br, string imei, string MANUFACTURER, string MODEL, string RELEASE,
                                                                  string INCREMENTAL, string DISPLAY, string OSType, SKBuiltinBuffer_t autoauthkey)
        {
            AutoAuthRequest.Builder aqb = new AutoAuthRequest.Builder();
            aqb.SetBase(br);
            aqb.SetAutoAuthKey(autoauthkey);
            aqb.SetIMEI(imei);
            aqb.SetSoftType("");
            aqb.SetBuiltinIpseq(0);
            aqb.SetClientSeqId("");
            aqb.SetSignature("18c867f0717aa67b2ab7347505ba07ed");
            aqb.SetDeviceName("Xiaomi-MI 2S");
            aqb.SetDeviceType("<deviceinfo><MANUFACTURER name=\"" + MANUFACTURER + "\"><MODEL name=\"" + MODEL + "\"><VERSION_RELEASE name=\""
                              + RELEASE + "\"><VERSION_INCREMENTAL name=\"" + INCREMENTAL + "\"><DISPLAY name=\""
                              + DISPLAY + "\"></DISPLAY></VERSION_INCREMENTAL></VERSION_RELEASE></MODEL></MANUFACTURER></deviceinfo>");
            aqb.SetLanguage("zh_CN");
            aqb.SetTimeZone("8.00");

            AutoAuthRequest ar = aqb.Build();

            return(ar);
        }