4

I need to connect to a public wifi hotspot with a Raspberry Pi. The wifi is open but I have to authenticate through a webpage (e.g. on mac a window open with Join "Wifi_network" or on Android "sign in to wi-fi network").

However, I am running the pi headless, so I can't do this manually via a browser. How can I automate this authentication process?

3
  • The hardware here is not relevant and it would be better for you to investigate this in terms of software: the OS, which is probably a fairly normal GNU/Linux distro, the web browser (which you have a choice of), and what software is available to do something like this with that combination. Try Super User or U&L.
    – goldilocks
    Jul 31, 2015 at 10:53
  • The question is specific to Rapsberry Pi. If I'm on my mac or android, I can use the GUI when prompted ;-) On the rapsberry pi without screen, it's more difficult...
    – hotips
    Jul 31, 2015 at 14:20
  • You did not say in the question that you were running headless, you just said you wanted to automate the process so that you could log in "without human intervention". However, it's still a software problem and is now even less pi specific, since you are going to have to write some code to do this and it requires an HTTP client and parsing HTML. That's the realm of Stack Overflow, but I promise this isn't something that's going to be solved with a single question. I'll reopen this and perhaps someone here will have some (more) suggestions about where to start.
    – goldilocks
    Jul 31, 2015 at 14:36

3 Answers 3

3

There are two steps to this. First you have to request the login page from the server, then you have to send it the reply it expects, as if from a web browser.

That may be easy or difficult, but it almost certainly requires some coding since the nature of such login pages varies widely and so the solution must be tailored to it. The first step would be to watch what happens when you do this normally. An invaluable tool for this would be something like firebug which should give you all the information you need, presuming you understand the protocols and technology involved (HTTP, HTML, and likely javascript). Wireshark might also be used.

Once you understand how the login is done, you need to write an HTTP client (most likely, one using SSL/TLS, i.e., an HTTPS client) that will request the page and automate the appropriate exchange. This may be complexified if, e.g., the server uses cookies, and you may have to be very exact in order to "fool" it, since the system may be intended to discourage bots (which is what this client program is). I am certain they cannot make it impossible, however.

Any general purpose programming language will be sufficient for this task although python, perl, ruby, or PHP will probably be the most painless, partially because these languages have a lot of libraries and support for doing things such as parsing HTML.

-1

Maybe you should write a web crawler/scrapper, there many crawling/scrapping framework that could help, specially for python, you can take a look to scrapy or grab.

Remarque: The scrapper that you write will only help for Wi-Fi routers where you know how the page look (routers) or maybe you should learn artificial intelligence and neural network to make a scrapper who will interacte with any authentication webpage.

Hope my answer helps you :)

1
  • 1
    Welcome to Raspberry Pi! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Aug 31, 2015 at 18:42
-1

I am using puppeteer for this purpose. It is based on nodesjs and provides a javascript interface to control Chromium. It also supports a headless operation.

If you install puppeteer it will automatically install chromium. Unfortunately it will install an x86 version which will not run on raspberry.

So you have to do some additional steps which can be retrieved from

https://code-flow-hjbello.blogspot.com/2018/11/make-puppeteer-work-with-raspbian-vers.html

3
  • 2
    If I exclude the link from your answer, it reads "you can do this but won't work". May 20, 2019 at 13:00
  • I just click on the link and my browser open the page flawlessly. I have no idea what is wrong at your side.
    – Martin K
    May 21, 2019 at 13:07
  • Nothing is wrong on my side. It will eventually go wrong on everyone's side when the link dies. That's why you're expected to post the essential information in the answer. May 21, 2019 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.