4

I've seen a few other questions where they show you how to connect to a network using bash, but I haven't seen anything where you connect to a captive portal network from the command line using Linux.

Is there a way to do login in a captive portal without being in graphics mode/having a Window manager?

  • 3
    Bash is a (common) Linux shell; can you clarify the distinction you’re after? – Jeff Schaller Aug 25 '18 at 21:30
  • @JeffSchaller There are bash script floating around for automatic login in FON in Portugal (Nós operator), UK (BT) and Belgium. Some of them are obsolete. – Rui F Ribeiro Aug 26 '18 at 12:26
  • 1
    @telcoM For automating it using WISpr, you are right, but you can alway use lynx. Many captive portal implementations fall back to HTML only. Our FON network and the portal of our major ISP here does that, for instance. Interestingly enough, they have paid the guys that wrote the WISpr protocol big bucks. They are using their libraries behind their implementation. Which quite does not surprise me about our main operator, they have got plenty of money. – Rui F Ribeiro Aug 26 '18 at 12:41
  • 1
    @RuiFRibeiro Yeah I did sorry about that, just needed to refresh the browser that's all – leeand00 Aug 26 '18 at 16:29
  • 2
    Interestingly enough, questions about captive portals got a LOT of visits, both here in U&L and in StackOverlflow, as it is not a well understood functionality, especially on the server side. Many (re)implementations also only implement the captive/redirection part and do not implement WISpr. Being WISpr-aware portals automagically dealt with by Apple, Windows, Android and iOS only adds to the confusion of many people not knowing how to deal with captive portals when in less complex systems. – Rui F Ribeiro Aug 26 '18 at 16:57
5

As the underlying layers /Os is not talking WISpr/not running a program to deal with captive portals, for connecting to a captive portal in the command line, you only need a browser or a script.

One of the possible solutions is using lynx, a text mode browser.

It will work in most captive portals, and will allow you to enter your login and password to authenticate in the captive portal. I am not sure it is WISpr aware (i.e. a few rare portals where WISpr is mandatory)

In the past there were also bash scripts floating around for FON, they are not working nowadays. as in https://gist.github.com/cusspvz/3ab1ea9110f4ef87f0d2e1cd134aca67 or this one https://gist.github.com/itay-grudev/d3d4eb0dc4e239d96c84

A good clue how to write such a script can be seen here in python. However, you will have to adapt it to your specific needs.

https://github.com/Palakis/fortilogin

However for the majority of portals out there, lynx is fine.

See the related question Captive portal using Apache

For having an idea what is the WISpr tags I am talking about, see Getting WISPr tags from a FON authentication portal

For others reading this question, to be able to test a browser like Chrome , Firefox or lynx in a Mac authenticating in a portal, you need to disable CNA. See related Disabling CNA in MacOS

P.S. With the notable exception of major telecoms, and some wireless vendors like Ruckus (and a couple of ready-made captive portals like PfSense and CoovaChili), many (re)implementations of captive portals only implement the captive/redirection part and do not implement WISpr.

Being captive portals automagically dealt with by Apple, Windows, Android and iOS only adds to the confusion of many people not knowing how to deal with captive portals when in less complex systems because they have that nice layer of abstraction in more complex systems.

To deal with captive portals in systems not detecting them, you need to open a browser and hit reload/try to open a web page, to get presented with a page for accepting the provider clauses/ToS, and/or to get authenticated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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