其实很早之前看到有人说用chevronwp7越狱时会修改系统hosts文件的时候就意识到:chevronwp7 是把自己伪装成微软验证服务器来与手机交互达到官方unlock的效果.今天看到一篇好文章,正好验证了我的想法.但让人惊讶的是,微软的这套验证机制就藏在SDK的Windows Phone Developer Registration工具中,而且代码没有混淆过,这才让chevronwp7 Team能够轻而易举获得越狱方法!今天突然在Windows Phone 7 SDK中看到了Windows Phone Developer Registration这个工具,索性操起工具对其进行反编译,结果让人出乎意料,反编译后的代码简直可以称得上就是"源代码",微软竟然不采取任何混淆措施... 尔后又看了一下经过简单代码混淆的chevronwp7工具,可以看出,chevronwp7 team正是参考的微软官方解锁程序的代码.
通过TcpClient,利用27077端口和手机进行通讯
- this.client = new TcpClient();
- this.client.SendTimeout = 2000;
- this.client.ReceiveTimeout = 2000;
- this.client.LingerState.Enabled = true;
- this.client.LingerState.LingerTime = 0;
- this.client.NoDelay = true;
- this.client.Connect("127.0.0.1", 27077);
检查手机状态的代码
- byte[] buffer = new byte[4];
- buffer[0] = 16;
- buffer[1] = 1;
- this.commandData = buffer;
unlock手机的代码段
- List<byte> list = new List<byte>();
- ASCIIEncoding encoding = new ASCIIEncoding();
- ushort num = (ushort)(((authToken.Length + 3) + 2) + 3);
- list.AddRange(new byte[] { 16, 3 });
- list.AddRange(BitConverter.GetBytes(num));
- list.Add(1);
- list.AddRange(BitConverter.GetBytes((ushort)authToken.Length));
- list.AddRange(encoding.GetBytes(authToken));
- list.Add(2);
- list.AddRange(BitConverter.GetBytes((ushort)2));
- ushort num2 = isInt ? ((ushort)0) : ((ushort)1);
- list.AddRange(BitConverter.GetBytes(num2));
- this.commandData = list.ToArray();
手机的任何请求都发送到一个http服务器(chevronwp7通过修改hosts文件把所有数据都重定向到本机, 而chevronwp7就把自己伪装成服务器来回应手机发来的请求).
下面是允许解锁的返回数据:
- <ResponseOfRegisteredDeviceStatus xmlns="Microsoft.WindowsMobile.Service.Marketplace" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ResponseCode>0x00000000</ResponseCode>
- <ResponseMessage i:nil="true"/>
- <Entity xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.WindowsMobile.Service.Marketplace.BLLDevPortal.Entities">
- <a:DaysLeft>365</a:DaysLeft>
- <a:AppsAllowed>10</a:AppsAllowed>
- </Entity>
<a:AppsAllowed>10</a:AppsAllowed> 这里代表可以最多安装10个xap包
锁定手机代码段:
- internal LockCommand(string authToken)
- {
- List<byte> list = new List<byte>();
- ASCIIEncoding encoding = new ASCIIEncoding();
- ushort num = (ushort) (authToken.Length + 3);
- list.AddRange(new byte[] { 16, 2 });
- list.AddRange(BitConverter.GetBytes(num));
- list.Add(1);
- list.AddRange(BitConverter.GetBytes((ushort) authToken.Length));
- list.AddRange(encoding.GetBytes(authToken));
- this.commandData = list.ToArray();
- }
不得不佩服chevronwp7 team对越狱所做的贡献,但是微软竟把这些东西毫无保留的"开放"给外界...匪夷所思...