How to send captive portal confirmation with curl?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
jackmarison93
Posts: 1
Joined: Thu Nov 15, 2018 3:12 am

How to send captive portal confirmation with curl?

Post by jackmarison93 » Thu Nov 15, 2018 3:20 am

Hi.

May employer has a Bring-Your_Own-Device WiFi network, that requires you to confirm the terms of use on a captive portal, before you can connect to the web.
For this, you have to check a box, and press a button.

I want to connect an ESP32 module to this network, and send the confirmation automatically.

By using the network monitor of firefox, I was able to sniff the post request, that the browser sends to the portal when pressing the button, and in fact I can use curl on linux to successfully send this.


Code:
curl 'http://1.1.2.1/reg.php' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' --compressed -H 'Referer: http://1.1.2.1/reg.php?ah_goal=eula.htm ... BB15C0C60E' -H 'Content-Type: application/x-www-form-urlencoded' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' --data 'url=E2B8F3578D88E9E36CD7BB15C0C60E&checkbox=checkbox&eula=on&Submit=Accept'

But how would I send this using micropython's curl?
I tried several varieties, but always get an error.
I guess that most of the response isn't even needed, like the user agent, and it's capabilities.

Does anybody know how to do it?

Thanks in advance

Post Reply