Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

How can I automatically login to captive portals on OS X?

A captive portal is used by (often not password-protected) wireless networks that present a web page as soon as you connect to them, requiring you to login.

I have to login to different wireless networks like this very frequently, and none of the captive portals seem to remember my login/password information. Is there a way to automate the login process somehow, or at least store the login/password pairs in the Keychain?

Update: There’s an iOS app called AutoWifi that basically handles this. If it’s possible to do this on iOS with all its restrictions, surely it must be possible to do something like it on OS X, right?


Related fun fact: This is how Apple tests for captive portals on OS X and iOS:

OS X and iOS make a request to http://www.apple.com/library/test/success.html every time you connect to a WiFi network.

This URL returns the following HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
    <TITLE>Success</TITLE>
</HEAD>
<BODY>
Success
</BODY>
</HTML>
share|improve this question
1  
Take a look at /Library/Preferences/SystemConfiguration/CaptiveNetworkSupport/Settings.plist. Manipulating the preferences here can easily compound serious security risks on top of the many Apple has decidedly implemented on their own. I'm not sure which browser you use to connect via these captive portals, but you can also try setting up network locations for them, or creating a simple macro depending on what you want to auto-fill. –  l'L'l Apr 5 '12 at 17:46
1  
That’s the thing — whenever OS X detects a captive portal, it opens a WebView popup window (not a real browser UI) with the login page. –  Mathias Bynens Apr 6 '12 at 5:53
    
If you have a chance post the source code of the popup. –  l'L'l Apr 6 '12 at 6:30
    
@ioi The HTML source of the page depends on the network. Once you get the popup, it’s possible to browse to the same page by just opening any browser and trying to load a URL. –  Mathias Bynens Apr 6 '12 at 6:52
1  
None of the answers answers the question! –  Tyilo Jun 22 '13 at 11:28

4 Answers 4

up vote 6 down vote accepted

You can rename

/System/Library/CoreServices/Captive Network Assistant.app

into

/System/Library/CoreServices/No More Captive Network Assistant.app

and you're all set. Password entering now goes via your browser of choice and can be stored using 1password or other plugins. Note that if you were already logged in while doing the renaming, it may take some time for your session to expire...

share|improve this answer
1  
Looking forward to testing this out :) No downsides? –  Mathias Bynens Dec 11 '12 at 21:51
    
Great post, it helped me a lot. Very creative naming :) no more captive network assistant. –  Buscar웃 May 12 at 16:51

Doesn't deleting (or renaming) /Library/Preferences/SystemConfiguration/CaptiveNetworkSupport/Settings.plist stop the auto-probing?

It could at least stop the opening of the WebView popup.

Otherwise replace all URLs in that Settings.plist with a local hosted copy of the success.html file and host the success.html file on your localhost webserver.

share|improve this answer

A captive portal is not like a password. It's more like a sign in sheet. Every time the network you're connected to hands out an IP address through DHCP, it gives you the captive portal to sign into/agree to and then it allows you to connect. From what I understand, this is a cross platform restriction that cannot be altered. It may be something that the network administrators can change, but even that may depend on the type of equipment being used.

share|improve this answer
    
You’re absolutely right that it’s more like a sign-in sheet than a password, but I’m surprised there doesn’t seem to be an easy way to autofill this sheet :) On iOS, there are apps that can take care of this. Isn’t there anything similar for OS X? –  Mathias Bynens Mar 23 '12 at 12:33
    
What apps for iOS can do this? Wouldn't you then have to use that app for web browsing, etc.? –  Matt Love Mar 23 '12 at 12:36
1  
The AutoWiFi app handles this automatically; all you have to do is click “Connect” once and you’re logged in. –  Mathias Bynens Mar 23 '12 at 12:40

Tyilo's NetworkAutoLogin project on github is an os.x daemon that "Automagically logs into to Captive Portal Networks" with user-supplied credentials.

It uses PhantomJS & CasperJS to post the necessary info to the fields on the captive portal login page. Could be the secret login "password", a username-password pair, or just activating a EULA checkbox and the "connect" button.

I can't remember exactly how it is triggered, but it registers a .plist with launchctl.

You put configuration options in a json file, specifying the name of the fieldset (optional) on the captive portal page and the necessary fieldname + content pairs (required). Here's an example of the config file stored in ~/.networkautologin.js

{ // Example with all possible options
    match: {
        SSID: ['Example WiFi 1', 'Example WiFi 2'],
        BSSID: '01:23:45:67:89:AB',
        URL: 'http://logon.example.org/?url=http://www.apple.com/library/test/success.html'
    },
    form_selector: 'form#login_form',
    fields: {
        'username': 'test',
        'password': '123123'
    }
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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