Due to the requirements of the lab project, you need to dynamically control route configuration information. We know that after purchasing a route, you need to access the: http: // 192.168.1.1 page for Route configuration. However, in order to achieve dynamic configuration, manual operations are not required, or even scheduled task configuration, You need to further study the operations related to route configuration.
The goal is to provide WiFi services with Web Authentication provided by some merchants, such as CMCC access at the airport. After you connect to a Wi-Fi hotspot, you cannot access the Internet, he will automatically jump to the Web authentication page to implement authentication. After passing the authentication, he can access the Internet. However, we want to automatically add a Web Authentication account through the server host. For example, a merchant can issue a free online e-voucher with the corresponding account on it. If the number is large, it is difficult to manually add configurations one by one. If it can be processed in batches by computer, it is extremely convenient.
The following describes the process of capturing httplook based on the actual solution process and some problems encountered. I hope this will be helpful in the future. There were two solutions:
1. Use wiwiz to build Web AuthenticationAnd use its wiwiz auth API to control access. The references are as follows:
Low-cost hotel wireless wi-fi network coverage + Web Authentication solution;
Wiwiz auth api reference manual and interface specifications;
However, later I found that wiwiz seems to provide very few services in the free version! Payment can meet the requirements of the project, so this solution is used as an alternative!
2. Wireless routing with Web AuthenticationAfter the survey, we found that the wireless route with Web Authentication was available. I chose the chinacscience nr235w wireless Internet access management router. By the way, at the end of July, we bought $219.00 for an eastern region. In the past few days, we will see $129.00 (price reduction notice )... Fortunately, it's not about spending your money, or it's about to lose. (Ignore)
Now let's take a look at the key part. How can I use some interfaces on the host to automatically complete the route configuration? The following is a good way to find it:
You can use the command line to easily switch to the broadband routing (on). You can use the command line to easily switch to the broadband routing (in) and cannot find the (bottom) part... After learning how to get it done, I finally found "How to teach you how to use the command line to easily switch to broadband routing" after turning through many web pages. Can you name it in a unified way? In addition, it is lucky to find the last article on the same website because it is not a continuous article.
I. Curl Tool: Curl is a tool that uses URL syntax to transmit files. It supports HTTP, https, FTP, ftps, dict, telnet, LDAP, file, Gopher, and other protocols, it also provides high security. That is to say, we can use the curl command to interact with HTTP-based pages. So as long as the browser can do the operation, we only need to use curl simulation to do it. Similarly, some web pages that require ticket snatching can also be controlled using the curl command. However, after you click it, the ticketing system will always pop up and manually enter the Random verification code, which is also a way to prevent such cheating. After the download, we recommend that you add the current path of the curl tool to the path of the system. You do not need to enter the corresponding path of curl to execute the command line with confidence, the system will automatically go to the path of the Environment Variable path to receive and execute the command line commands you entered.
Ii. Monitoring tools:To simulate browser operations, we need to know the address of browser access and corresponding parameter settings. As a result, the other two monitoring tools crawl the page information parameters. The problem is as follows:
1. When I use httplook for crawling, as long as the crawling is started, my IE will crash, but the sogou browser can only catch common pages, but cannot grasp the routing configuration page information.
2. Try sniffer to capture and capture the file. However, the file cannot be copied or its ASCII code can only be copied and transcoded. So I took the parameter directly. However, when you use the captured information for command line configuration, the computer Often crashes. Facts have proved that the visualization of many computer coding forms is not what we see, except for some characters with similar shapes, as well as small details such as halfwidth and fullwidth. Therefore, it is best to copy and paste the information directly, or you will not know what is going on when the system goes down. At first, I thought it was a computer hardware or system problem. I didn't give up and kept trying, and then I stopped restarting the computer. Almost reinstalled the system.
Finally, with a try-on mentality, I uninstalled IE and reinstalled it. Then I tried again with httplook, and I caught it. It really seems like a dark smell. For a lot of browser operations, using IE is certainly correct, because many Browsers Do not use the IE kernel, and many are only compatible. So there will be one or more inexplicable errors. In addition, when you follow the operations described by others, different results may often appear. There must be a reason, and problems may occur in every small step. If possible, analyze the steps from start to end, and try the try-and-error solution that can be done in each step. The final solution is of course a good solution. If you try all the information you can think of, you can only say that it is fate... But in this process, you can't stop trying as long as you want to finish it !!! Once you stop, you lose. Of course, it may be easy to solve the problem, but you cannot give up!
Now, we will start to capture the information and introduce the process on the wireless route that comes with Web Authentication.
(1) Start httplook: Click the Green Arrow to start crawling, for example:
(2) browser operations:Use IE to open the routing configuration page and perform the configuration operation you want. Here I will add a Web Authentication account, for example:
After successful addition, we can see the newly added account on the Web authentication page:
(3) httplook obtaining configuration parameters: Click the next red button on the right of the Green Arrow to stop capturing. We can see the information captured by httplook:
You can see that when the browser configures the route, it accesses the "192.167.1.1 // router/l7_web_auth_user_set" of the route by accessing the POST method. CGI configuration file, post the following parameter to "Action = 0 & enable = 1 & User = 0 & pass = 0 & name = & policy_group_id = & charge_mode = 0 & adv_type = 0 & auth_user_bind_mac_mode = 0 "& auth_user_bind_mac = & COUNT = 1 & idle_cut = 1 & auth_user_static_ip = & id = & deal = add ", we noticed that "user = 0 & pass = 0" is the account name and password we just set to add an account.
(4) curl command line execution:After capturing, you need to use the curl tool to call the command line. By querying the usage of curl, we know that the format for accessing the page with the user name and password is as follows (that is, the user name and password entered when we access the routing configuration page:Curl-u access page Username: Password-d "parameter" HTTP page address. You can modify the user name and password of many routing pages by default as "admin" or "guest. The user name and password of the local machine are both "guest ". Use:
curl -u guest:guest -d "action=0&enable=1&user=123&pass=123&name=&policy_group_id=&charge_mode=0&adv_type=0&auth_user_bind_mac_mode=0&auth_user_bind_mac=&count=1&idle_cut=1&auth_user_static_ip=&id=&deal=add" http://192.168.1.1/router/l7_web_auth_user_set.cgi
By running the preceding command in the command line window, you can see the following information, indicating that the configuration is successful:
Now, go to the Web account list on the routing configuration page. The account with the username and password "123" is added. Similarly, if you want to perform relevant actions on other pages, you can also use the same method as above. So far, we have completed the routing configuration operation using the curl command. If you want to control Wireless WiFi hotspots, you can also write the command into the ". Bat" file, and then set the scheduled task function in the system to enable and disable hotspots at regular intervals. If you need to add Web Authentication accounts in batches like above, you can also use other languages to call this command, as long as you change the corresponding user and pass parameters.
As long as the browser can do this, the above method can be done. The key is to "capture ". When we encounter problems in our knowledge base (including our own knowledge, the surrounding cattle and human resources, and the massive amount of data on the Internet, when the expected results do not appear, try to test the error in all the steps, whether you know the reason or not. You do not even know the cause after you finally solve the problem, but you cannot stop trying. However, when many people are able to make a smooth solution without encountering one or more problems like you, do not complain about the injustice of fate. There must be a reason for the appearance of one thing. You may not know the reason, but cannot stop trying.
If you stop, you lose! As for the results, it depends on your own capabilities, and "affinity "!
You may not know the reason, but cannot stop trying. Httplook capture route configuration interface information