Manage tl-wr886n wireless router backstage with Python

Source: Internet
Author: User

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/8C/FF/wKioL1iBoBfhyhC9AAAnHHj-Upc801.png "title=" Selection_039.png "alt=" Wkiol1ibobfhyhc9aaanhhj-upc801.png "/>


It took two days to roughly write, most of the features are, and here's what I'm thinking about.

    1. Login implementation

      Simply put, the login process is divided into the following steps

      1) User input password Click the login button or trigger JS

      2) JS send user password encryption redact sent to router

{"Method": "Do", "login": {"password": "Xhvq3wibptefbwk"}}

3) The router determines whether the password is correct or not, and returns if it is correct:

{"Error_code": 0, "Stok": "%28SQ14XBVXEKPG%2EF4%3EY%3C%2AGIF%7EHRDBGR%21R"}

Otherwise:

{"Error_code": -40401, "data": {"code": -40401, "time": +, "group": 0}}
command execution by the above know the password is really front-end encryption through the capture packet can be seen, the browser sends commands to the router is a JSON-like format of data, such as obtaining AP information: {"guest_network": {' name ': "guest_2g"}, "method": "Get "} Router Return is also json{" Guest_network ": {" guest_2g ": {" SSID ":" Tpguest_94d3 "," Encrypt ":" 0 "," Key ":" 12345667 "," Enable ":" 0 "," Accright ":" 1 "," Upload ":" 0 "," Download ":" 0 "," time_limit ":" 1 "," Limit_type ":" Schedule "," duration ":" 0 "," Seccheck ":" 0 "}}," Error_code ": 0} Browser Grab bag

It can be seen that when the authentication is passed, the URL of each message sent by the browser is Http://GW/stok=xxxxxxx/ds,stok, which is the one returned by the router after authentication.


Python implementations:

Main module: Requests

Requests.post (Url,json)


Effect:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/8D/02/wKiom1iBpnGSYq2EAAHZLVTN-Hk255.png "title=" Selection_041.png "alt=" Wkiom1ibpngsyq2eaahzlvtn-hk255.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/8C/FF/wKioL1iBpzqQIn7kAAJJZArwZAk457.png "title=" Selection_042.png "alt=" Wkiol1ibpzqqin7kaajjzarwzak457.png "/>



Put the code in github:https://github.com/rjlwtf/python_study-script/blob/master/wriless_route_mange.py.

This article from "Lonely No Sorrow" blog, reproduced please contact the author!

Manage tl-wr886n wireless router backstage with Python

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.