network manager + automation of http-login in wifi

    The post will be short but very useful.

    abstract: There are a lot of wifi hot spots that ask to do some stupid thing when connecting. Enter the password in the http-form, put the checkbox “I agree with the sale of the kidney in exchange for the Internet”, etc.

    This is a bit of a nuisance, especially if it is periodically thrown out of wifi. This post offers a simple solution for automating login using Network Manager hooks.

    Training


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

    We get this:



    Find POST (if there are several of them - by brute force and combination), select copy as curl, save somewhere for the future.

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

    We write a script (everything below is from the 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 it with bold with current data.

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

    Voila

    PS I would be very grateful for something like that for androids.

    Pps as prompted 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

    Also popular now: