How use a captive portal when in text mode?

5,462

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.

Share:
5,462

Related videos on Youtube

leeand00
Author by

leeand00

Projects jobdb - Creator of Open Source Job Search Document Creator/Tracker http://i9.photobucket.com/albums/a58/Maskkkk/c64nMe.jpg Received my first computer (see above) at the age of 3, wrote my first program at the age of 7. Been hooked on programming ever since.

Updated on September 18, 2022

Comments

  • leeand00
    leeand00 almost 2 years

    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?

    • Jeff Schaller
      Jeff Schaller almost 6 years
      Bash is a (common) Linux shell; can you clarify the distinction you’re after?
    • Rui F Ribeiro
      Rui F Ribeiro almost 6 years
      @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.
    • telcoM
      telcoM almost 6 years
      Unfortunately there seems to be no standard implementation for captive portals: to implement a command-line-based connection method, you'd have to examine the source code of the portal page, and then design a solution for that specific portal, possibly using a tool like curl to submit the authentication information.
    • Rui F Ribeiro
      Rui F Ribeiro almost 6 years
      @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.
    • leeand00
      leeand00 almost 6 years
      I guess what I don't understand is, how does your machine know what the URL for the captive portal is? Is it a transparent proxy? Is it a firewall rule that changes after you click I agree? Can it be a number of things?
    • leeand00
      leeand00 almost 6 years
      It always happens automatically on Windows, Android, and iOS, but with Linux it's always a gamble; so how does it work? Does DHCP send the URL as one of those special codes?
    • leeand00
      leeand00 almost 6 years
      Really I just want to use my computer at the library without a memory hungry Window Manager.
    • leeand00
      leeand00 almost 6 years
      @RuiFRibeiro Yeah I did sorry about that, just needed to refresh the browser that's all
    • Rui F Ribeiro
      Rui F Ribeiro almost 6 years
      Maybe to follow the captive portal redirect. Interesting