How to automatically login to captive portals on OS X?

Solution 1:

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

Solution 2:

Just found this Disable Captive Network Support in OS X

Which mentions "To disable it, set this preference:"

sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -boolean false

In case, you would ever want to remove this setting, you can do:

sudo defaults delete /Library/Preferences/SystemConfiguration/com.apple.captive.control Active

Then, as @Leon mentions, use the regular web browser to login. Or if you are on a network where that somehow does not work then you can still try and open the app manually ( located at /System/Library/CoreServices/Captive Network Assistant.app )

Solution 3:

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'
    }
}

Solution 4:

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.

Solution 5:

I seeing captive portal requests on my home network every 5 min. But I've changed in file /Library/Preferences/SystemConfiguration/CaptiveNetworkSupport/Settings.plist

string: http://www.apple.com/library/test/success.html to http://captive.apple.com/hotspot-detect.html (I meant ProbeURL section). apple changed probe URL for new OS, I do not know why, but new URL response is 200 (OK) and should works (I've faced with same problem on my mbp 2011 Mavericks).