📜 ⬆️ ⬇️

network manager + wifi http login automation

The post will be short, but very useful.

abstract: There are lots of wifi hot spots that ask you to do something stupid when connected. Enter the password in the http-form, put the checkbox "I agree with the sale of a kidney in exchange for the Internet", etc.

This is a problem, especially if it periodically throws out wifi. The post offers a simple solution for automating login with the help of Network Manager hooks.
')

Training


We need to understand where to send someone how to make it work. We put firebug or any other similar plugin. Turn on, go to the 'net' tab, turn on persistent (this is important), log in.

We get this:



We find POST (if there are several of them - by the method of sorting and combining), select copy as curl, save somewhere for the future.

Next we find the uuid of our connection - in the / etc / NetworkManager / system-connections / our_wifi file.

We write a script (lower and lower - from root) in the /etc/NetworkManager/dispatcher.d/ directory, for example, /etc/NetworkManager/dispatcher.d/02- our_wifi -auto

#! / bin / bash
if [$ 2 == 'up' -a $ CONNECTION_UUID = ' d2b76508-139e-4073-a921-61a0a7fec9df '];
then
echo `date` 'logging to our_wifi ' >> / var / log / our_wifi
curl 'https://hautdebitmobile.orange.fr:8443/home/logon' -H 'Cookie: JSESSIONID = E559B5201AA5B75B.aws5; JSESSIONID = E559B5201AA5B75B; owalang = en '-H' DNT: 1 '-H' Host: hautdebitmobile.orange.fr:8443 '-H' Content-Type: application / x-www-form- urlencoded '--data' username = {FKZDOBR & password = ZLEHFR & isCgu = on & hidden_isCgu = & tab = 3 & code = 0 & auth = 1 & restrictedCode = & restrictedProfile = 0 & restrictedRealm = ' 2> & 1 >> / var / log / our_wifi
fi

Replace bold with current data.

Making chmod + x /etc/NetworkManager/dispatcher.d/02- our_wifi -auto.

Voila, wifi starts to behave like normal - right after connecting, there are Internet.

PS I would be very grateful for something similar for androids.

Pps as suggested in the mail, for the Moscow metro there is such a script: gitorious.org/vmetro-auth/vmetro-auth

For yota: github.com/esin/Esin-s-scripts/blob/master/sh/yota/yota_open

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


All Articles