Internet access through login page without desktop environment?
Hi guys,
If you were trying to access a wifi system (university wifi) which, under normal conditions, would forcibly redirect your web browser to their login in order to have you login before you could fully access the internet, is there any way to accomplish this without a DE, i.e. from command line?
I've heard it can be done through a WM but that is sort of a letter-of-the-law kind of solution as far as I'm concerned.
About this post
- Posted
- Archived
- Score
- 31 · 100% up
- Kind
- Text
- ID
- 4fpidf
16 comments
Not sure if it's the same but I've logged into WiFi at Starbucks and McD with the Lynx browser. It's a lot faster.
Here's what I've always done. 9/10 times the only way it determines who you are is via your NICs MAC address. This work's for me on xfinity hotspots.
Change the Mac address of another device, such as a phone, to something you'll remember. Example: FF:DE:AD:BE:EF:FF
Successfully authenticate through the captive portal (the login page), then disconnect once you are unrestricted.
Now on the device you intend to use that couldn't log in, change the MAC address to the same thing. Presto, access.
You could also use a wifi sniffer, and record all the MAC addresses you see with a lot of activity connected to the AP (ones that likely have passed the captive portal) and then change your to one of those when they disappear. Just don't do anything you wouldn't do with your own MAC as you might be using another persons credentials, which would probably be illegal in some places.
Another options you could pursure is using one of the text-mode briowser such as w3m, links, elinks, lynx, etc
pacman -S w3m
$ w3m 'http://google.com' get portal page, and log in.
Edit 2: I used the information described below to automate a login, without having to open a terminal based browser every time.
Since authentication occurs on the webpage, I assume you are able to connect to the access point?
I have used a combination of elinks, wpa_supplicant, and curl to accomplish a terminal-only login. It requires some set up. The steps go like this:
Create a wpa_supplicant configuration file with the parameters for your access point.
A session may go like below, given the field names and variables you discovered are:
As root, or sudo, then do:
The "difficult" part of this is discovering the HTML fields and parameters, and the the login URL - all the data that is sent and required by the log in page during a GUI browser session.
Edit: spelling, formatting.
I do it in a similar manner. But I suggest to additionally extend your login script to logout as well. Usually this can be accomplished by changing the parameter from logmein to logmeout. As already pointed out others can "steal" your mac address and abuse your session to take malicious actions.
Indeed, the example I provided is a minimal one.
I find it strange that a university would authenticate a user with a web login page. Usually they authenticate via a RADIUS server.
You can look at your gateway IP using ip route and then browse to it using links if the auth server is listening on the gateway (usually is) if that doesn't work get the auth server domain/IP from a phone or something and do the same thing
Surely if you visited a page in your web browser it would redirect you to the page? I don't think a command line utility could do this since wifi hotspots use many different ways to authenticate the user.
Use links, the CLI webbrowser
Have a look at this. I think first, you have to figure out what kind of captive portal your school uses and then see about netctl profiles / scripts to get in without a WM. Good luck
Would lynx work? If you can make that work, then you might even get it working with wget.
Another possibility if your willing to program somthing small would be to use PhantomJS. You might want to drive it with something like Selenium.
Wouldn't be more than a few lines of Python. I know Python has fairly good and easy to use bindings. I tried Go but it seemed like you needed to run the Selenium server yourself and might only support Firefox, whereas the Python ones just launch selinium itself and seem to support the range of browsers including PhantomJS.
Otherwise PhantomJS itself claims to be JavaScript scriptable, but I've never tried to drive it directly.
There are multiple different ways that logging in through wifi can work. For example over here you can login and the switch adds you to an allow list, another type is you login and the controller revokes and pulls your DHCP-assigned IP in, then assigns you a new one (that is allow to transmit data), etc. You'd ideally have to know how yours works. Alternatively if your connection supports certificate based authentication that would be much easier and more reliable to use.
Deleted before we saved it.
You don't need those tools... that's the sample config. Just remove those references and put in
exec yourbrowserhereCould use something lightweight.
Deleted before we saved it.