📜 ⬆️ ⬇️

We return the auto-login to the Wi-Fi network of the Moscow metro in Android

For some time, I began to notice that when I connected to the Moscow metro terminal on Android, the notification that I had to log in was no longer available. Which was very convenient, since the built-in android HTTP-client never showed me an advertisement, and closed immediately after authorization, without loading the start page of wi-fi.ru, which is also richly dazzling with advertising.

Apparently, the citizens of Maxim Telecom considered that too many users swim past their ads in this way and, considering themselves maliciously, only allowed access to the URL google.com/generate_204 , which requests the Dalvik HTTP client to check availability the internet. From the name of the handle it is obvious that code 204 is expected.

Thus, this check began to give false positive, forcing the user to log in through the browser, viewing ads. A quick search on this issue revealed the captive_portal_server variable in the Android settings storage, which is not installed by default, but if you write the host's FQDN to it, / generate_204 will be requested from it already. The obvious solution to the problem immediately asked for itself.

On my server, I added the following lines to the nginx configuration:
')
server { listen 0.0.0.0:80; location /generate_204 { return 204; } } 


On the Android device, I executed the following command (yes, the disadvantage of this method is root):

 root@shamu:/ # settings put global captive_portal_server our-nginx.domain.tld 


After that, the authorization earned, as before :) I hope this small life hack will be useful to someone who, like me, is not eager to watch video ads every time you log on to the network.

PS I did not mention here the possibility of using various authorizing programs running in the background, as I myself used this software before, and it turned out that the creators of the captive portal actively oppose such measures, and sooner or later the authorization stops working

Source: https://habr.com/ru/post/268793/


All Articles