scenario

Consider a mobile page that the developer has restricted so that it can only be opened in the wechat client. Debugging pages are notoriously bad on mobile phones, so you need to be able to open and debug them on your computer. Here’s an analysis of three common types of pages to get around their limitations (don’t use them for bad, of course)

Tools to prepare

  1. Easy to debug browser. Personally like Chrome, this article is based on Chrome 43.0.2357.130 (official version) M (32-bit) environment.
  2. Fiddler4 is recommended, but Wireshark is fine if you prefer, as long as you can catch cookies
  3. A browser plug-in that can edit cookies. For Chrome, I recommend EditThisCookie, and for Firefox, try out Firebug’s built-in editing function

Bypass method

There are three common types of restrictions (though I suspect there is no fourth), and they are progressively more difficult to get around. The following will analyze one by one from the two perspectives of confirming the restriction method and bypassing the restriction.

There is no obvious restriction

Example: Roll over Little Rock has the most pages and basically does nothing.

Inspection methods

Other browsers on your phone can also open the page and view the page properly. You can debug the page on your PC by opening the Chrome emulator.

Bypass method

  1. Ctrl+Shift+IOpen the chromeDeveloper Center
  2. Click the small icon in the upper right corner of the Developer Center toolbar, as shown in the picture:

    3. If you find that you can’t simulate the touch screen because it is not enabled in the Settings, click the small arrow icon in the upper right corner of the developer center toolbar and thenEmulation>Sensors>Emulate touch screen, just tick the box. As shown in the figure:

Breezed through.

Check UA to limit

Example: Multi-play -doNotTouchWhite Because this site requires login to play, so put a public number for testing, do not abuse. <

User: duopaotestdada PWD: duopaotestCopy the code

Detection method

When the mobile browser opens, it will jump to the rest of the developer’s own page or pop up, but it will not jump to the open.weixin.qq.com domain.

Looking at this, you can be sure that nine out of ten are based on UA (UserAgent) detection. So the crack method is very simple, simulate UA. Chrome has this feature built in.

Bypass method

  1. Open the emulator in your browser (see above)
  2. Paste the following UA in the UA at the upper right corner of the simulator and re-enter the original page (not refresh directly because some pages will jump according to UA)

    Mozilla / 5.0 (Linux; U; Android 4.1.2. zh-cn; Chitanda/Akari) AppleWebKit / 534.30 (KHTML, Like Gecko) Version/4.0 Mobile Safari/534.30 MicroMessenger/ 6.0.0.58_R884092.501 NetType/WIFICopy the code

    As shown in figure:

    The above is the UA of wechat of Android mobile phone, and another UA of iOS is attached

    
    Copy the code

    In general, the two functions are the same, and in fact, according to most front-end conventions, even a single MicroMessenger field in the UA can be circumnavigated.

  3. Although the above method can bypass the limitation, but ultimately not convenient, each time to manually change a UA. In fact, newer versions of Chrome are customizableDevice. Click on the gear icon in the upper right corner of the Developer Center and thenDevices>Add custom device, you can add a simulator with wechat UA, and then in the simulator interfaceDeviceYou can switch. As shown in figure:

Use wechat Oauth to do the limit

Example: Save the Pacific wheel because of the above game link is no longer valid, so change the page, the same type, available for testing: Both of the above two kinds of lucky wheel are relatively common and can easily bypass restrictions, while some pages with high requirements for user authentication will use wechat OAUTH to pull openID for authentication, which is not only easy to bypass by changing UA. Fortunately, it is not without solutions. Since the authentication is usually stored in cookies, we can directly forge cookies for the PC emulator to make the page mistakenly think that we are authenticating in wechat.

PS: This is a general method, but currently for the pages in wechat, wechat official provides debugging support, you can check the updated content

Detection method

The mobile browser will jump toopen.weixin.qq.comDomain name, and page promptPlease open the link on wechat client.

As shown in figure:

Bypass method

  1. Change the browser UA to wechat, and then refresh the page, you will find that this time no longer promptPlease open the link on wechat clientBut the whole page went blank.
  2. Turn on Fiddler and set up your phone’s wifi connection to make sure all your data passes through Fiddler.

    The configuration of Fiddler can be referred to this article. The two configurations of HTTPS must be done, otherwise wechat packets cannot be caught. In addition, if you are sure that the mobile phone is connected to Fiddler but wechat packets are not caught, you can forcibly close the wechat app first and then open it again

  3. Click on the page link in wechat to make it enter the page normally, then pay attention to the record of the relevant domain name on Fiddler and find itTunnel to open.weixin.qq.comThe record in the back. You’ll notice that the original link is now attachedoauthParameters. Copy the link at this time

    As shown in figure:

  4. Open the previously copied link in your browser and the screen is still blank, right click the page and select EditThisCookies and you will see that there are two cookies under the page.

    You can also check the number of cookies on the current page at Developer Tools Resources> Cookies >wxoauth.wucai.com. The reason why we didn’t directly create cookies is that in addition to the Value attribute, cookies also have Domain, Path, Expires/ max-age and other attributes that need to be set, and these attributes cannot be found by ourselves, so we can only rely on the page server to create them first. Then change the Value directly

  5. Go back to Fiddler and select the link you just selectedHeaders, and you see two cookies below, along with the corresponding values. Select one and right clickCopy Value only, copy the value to the one opened in the previous browserEditThisCookiesPage. As shown in figure:

    And the important thing to notice is that what I’m copying here isThe name of the cookies+Cookies valueWhileEditThisCookiesAll you need to do is fill in the cookies, so make sure you copy them incookies Name =Let’s get rid of this part. As shown below, in the green boxPHPSESSID=I don’t need it. Just delete it. As shown in figure:

  6. Repeat step 5, after all the cookies have been changed, go back to the previous browser page and enter the original home page link. Success.

    In wechat, there is usually a jump after the completion of the authentication page, but because it is manually changed here, there is no way to trigger the jump, we need to manually simulate a time. Because the cookies in the previous page are in, the page server will also assume that we have authenticated, so we will directly skip. Final successful screenshot:

Done. It looks complicated, but it’s actually very simple. Personally, the most troublesome part of this process actually lies in the second step: to connect the mobile phone to Fiddler, first disconnect the previous wireless, manually input the proxy setting to wifi, and then connect it again. So I think the most need now is a tool under Android can store wifi proxy link Settings = =

update

Updated on October 12, 2015, for the third page to be verified by OpenID: In addition to the method of capturing cookies mentioned above, there is actually a simpler way to use wechat official TBS debugging. The easiest way is to install the latest version of QQ browser, and then use the built-in wechat debugging tool, you can save a lot of trouble. Specific steps are omitted.

Don’t like to use QQ browser, you can use the official TBS plug-in plus local inspect method, can refer to this article: wechat, hand Q, Qzone x5 kernel inspect debugging solution but this method I personally did not try, because the feel configuration process is too troublesome.

After entering, some functions cannot be used normally

Sometimes you will find that even if the page works properly, some functions will not trigger, such as uploading images, but the browser will not report an error. This case is generally due to the use of wechat JSSDK built-in methods (wx.xx and the like). Because the built-in method of wechat is not pure WebView can be completed, many functions need the cooperation of wechat client, so it is very normal to fail to achieve the expected effect. You can look at the official wechat JSSDK demo, you will find that basically none of them can be used on PC.

Anything else, think of adding.