Skip to content

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.

31 points14 comments
Open on Reddit
About this post
Posted
Archived
Score
31 · 100% up
Kind
Text
ID
4fpidf

Author

6
posts
6
comments
0
media
View profile

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.

18 points

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.

11 points

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:

  1. Configure wpa_supplicant
  2. Visit the login page and extract the following fields, using a terminal-based web browser:
  • username
  • password
  • login command and value
  • form post URL
  1. Run wpa_supplicant
  2. Run dhcpcd
  3. Execute curl, sending the POST data containing username and password information.

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:

# wpa_supplicant -B -D wext,nl80211 -i wlp2s0 -c /etc/wpa_supplicant/my_university.conf
# dhcpcd wlp2s0
# curl --trace-ascii debugdump --trace-time --data "login_cmd=AuthenticateMe&username=${myusername}&password=${mypassword}&login_value=LogMeIn" --dump-header headers https://wifi.myuniversity.com/cgi-bin/login -o curloutput

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.

6 points

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.

2 points

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.

1 points

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

5 points

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.

2 points

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

1 points

Would lynx work? If you can make that work, then you might even get it working with wget.

1 points

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.

1 points

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.

1 points
unknown author3 hidden

Deleted before we saved it.

0 points

You don't need those tools... that's the sample config. Just remove those references and put in exec yourbrowserhere

Could use something lightweight.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.