yanchao891012 / WPF_WeChat

模仿微信
154 stars 74 forks source link

About Login Error / WxInit Error (Bad Request) #2

Open h4dex opened 7 years ago

h4dex commented 7 years ago

0x00::Login -> ScanQrcode -> CheckScan

  1. wx sync domain error ?
  2. request cookie not write ?

return : redirect_url

0x01::code exam [c#]

public object LoginCheck() { if(this.string_0 != null) { string[] strArray = new string[6]; strArray[0] = this.string_7; strArray[1] = this.string_0; strArray[2] = "&tip=0&r="; TimeSpan span =(TimeSpan)(DateTime.Now.ToUniversalTime() - new DateTime(0x7b2, 1, 1)); long totalMilliseconds =(long) span.TotalMilliseconds; strArray[3] = totalMilliseconds.ToString(); strArray[4] = "&_="; span =(TimeSpan)(DateTime.Now.ToUniversalTime() - new DateTime(0x7b2, 1, 1)); strArray[5] =((long) span.TotalMilliseconds).ToString(); byte[] bytes = this.httpService_0.SendGetRequest(string.Concat(strArray)); string str2 = Encoding.UTF8.GetString(bytes); if(str2.Contains("=201")) { string s = str2.Split(new string[] { "'" }, StringSplitOptions.None)[1].Split(new char[] { ',' })[1]; byte[] buffer = Convert.FromBase64String(s); MemoryStream stream = new MemoryStream(buffer, 0, buffer.Length); stream.Write(buffer, 0, buffer.Length); return Image.FromStream(stream); } if(str2.Contains("=200")) { string str3 = str2.Split(new string[] { "\"" }, StringSplitOptions.None)[1]; string domain = CheckData.Getdomain(str3); if(domain.IndexOf("wx2.qq.com") > -1) { this.string_1 = "https://wx2.qq.com/"; this.string_2 = "https://wx2.qq.com"; this.string_4 = "https://file2.wx.qq.com"; this.string_3 = "https://webpush2.weixin.qq.com"; return str3; } if(domain.IndexOf("qq.com") > -1) { this.string_2 = "https://wx.qq.com"; this.string_4 = "https://file.wx.qq.com"; this.string_3 = "https://webpush.weixin.qq.com"; return str3; } if(domain.IndexOf("web1.wechat.com") > -1) { this.string_2 = "https://web.wechat.com"; this.string_4 = "https://file1.wechat.com"; this.string_3 = "https://webpush1.wechat.com"; return str3; } if(domain.IndexOf("web2.wechat.com") > -1) { this.string_2 = "https://web.wechat.com"; this.string_4 = "https://file2.wechat.com"; this.string_3 = "https://webpush2.wechat.com"; return str3; } if(domain.IndexOf("wechat.com") > -1) { this.string_2 = "https://web.wechat.com"; this.string_4 = "https://file.wechat.com"; this.string_3 = "https://webpush.wechat.com"; return str3; } if(domain.IndexOf("web1.wechatapp.com") > -1) { this.string_2 = "https://web.wechatapp.com"; this.string_4 = "https://file1.wechatapp.com"; this.string_3 = "https://webpush1.wechatapp.com"; return str3; } this.string_2 = "https://web.wechatapp.com"; this.string_4 = "https://file.wechatapp.com"; this.string_3 = "https://webpush.wechatapp.com"; return str3; } } return null; }

yanchao891012 commented 7 years ago

打断点,看一下,是哪个地方出现的问题

h4dex commented 7 years ago

你的sync 代码 和 86 大神的一样 部分微信其他域交互的 BUG 只请求访问了 wx.qq.com 建议看下我上面的解决方法。 我是 根据redirect_url 自己索引匹配 push , file 域 ,这样才会支持所有账号登陆

yanchao891012 commented 7 years ago

恩,确实是用了他的交互,十分感谢你给的解决方法

h4dex commented 7 years ago

web微信采取了不同的域名来兼容各种用户 ... // 3105行左右 function () { var e = location.host, t = 'weixin.qq.com', o = 'file.wx.qq.com', n = 'webpush.weixin.qq.com'; e.indexOf('wx2.qq.com') > - 1 ? (t = 'weixin.qq.com', o = 'file2.wx.qq.com', n = 'webpush2.weixin.qq.com') : e.indexOf('qq.com') > - 1 ? (t = 'weixin.qq.com', o = 'file.wx.qq.com', n = 'webpush.weixin.qq.com') : e.indexOf('web1.wechat.com') > - 1 ? (t = 'wechat.com', o = 'file1.wechat.com', n = 'webpush1.wechat.com') : e.indexOf('web2.wechat.com') > - 1 ? (t = 'wechat.com', o = 'file2.wechat.com', n = 'webpush2.wechat.com') : e.indexOf('wechat.com') > - 1 ? (t = 'wechat.com', o = 'file.wechat.com', n = 'webpush.wechat.com') : e.indexOf('web1.wechatapp.com') > - 1 ? (t = 'wechatapp.com', o = 'file1.wechatapp.com', n = 'webpush1.wechatapp.com') : (t = 'wechatapp.com', o = 'file.wechatapp.com', n = 'webpush.wechatapp.com'); ...

yanchao891012 commented 7 years ago

哦,原来如此

yanchao891012 commented 7 years ago

十分感谢你提供的代码,我已修改,并测试,小号也可以获取用户列表和发信息了,谢谢,github已提交