Telenet Autologin on OSX

People who want to autologin on a Telenet Hotspot with their MacBook, here’s a recipe you can use for that.

By far the most reliable way to do this is using crankd that, in a very similar way to launchd, allows you to run scripts in response to events such as network changes, filesystem activity, and application launching. The process to get started is not terribly complicated, but it requires some editing of system files.

  • First lets make a script that will handle the login. Open up an editor and put the following in:
    CURL=`which curl`
    SSID=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'`
    if [ "$SSID" = "TELENETHOTSPOT" ]; then
       $CURL -v -L -d checkterms=1 -d terms=on -d c=std -d lang=nl -d userid=$tn_user -d password=$tn_pass "";
  • Save that file somewhere, let’s say i saved it in: /Users/cjpa/scripts/
  • Download and install PyMacAdmin, this includes crankd.
  • Once installed, open a terminal and run /usr/local/sbin/ If for some reason it crashes with an error about an undefined NSNotificationHandler, don’t worry. You can safely disregard that. If it didn’t crash type Ctrl+C to exit the program. The important point is that it would have created an example configuration file in:
  • Open the configuration file in a text editor and modify it so that it looks like the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
    <plist version="1.0">
  • Now we can try it. Run /usr/local/sbin/ in a terminal and disconnect your wireless. Reconnect again and check in the console if you get output like this: INFO: SystemConfiguration: State:/Network/Global/IPv4: executing /Users/cjpa/scripts/
  • If you do, everything is in working order and we are ready to set crankd to start automatically on reboot.
  • Let’s make a file ~/Library/LaunchAgents/org.crankd.plist and put the following in it:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
    <plist version="1.0">
  • We have created a launchd item which will start everytime your laptop boots. You can start it manually with the following command: launchctl load ~/Library/LaunchAgents/org.crankd.plist
  • That’s It! Now go look for a hotspot..

Based on the following blogpost:

3 thoughts on “Telenet Autologin on OSX

  1. Nice article!

    But why not use ‘/usr/bin/airport’ instead of your rather long command line.
    And you could do with Perl too (makes it for me easier to understand):

    $ /usr/bin/airport -I|perl -nle ‘print $1 if /\s+SSID: (.*)$/’

    Just a thought…

Leave a Reply

Your email address will not be published. Required fields are marked *