How to automatically login to captive portals on OS X

Networkwifi

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.

As of Yosemite the URL is now: http://captive.apple.com/hotspot-detect.html

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>

Best Answer

Update: note that question was asked and answered in 2012, a lot has changed in the OS since that time, including SIP, which prevents the renaming proposed here. The answer below by @cwd is now the recommended way as it doesn't need disabling of SIP...

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...