Lantern Bash Configuration Script on OSX

I’ve been working for awhile on a piece of software called Lantern. It’s a new censorship circumvention and monitoring-prevention tool built atop the LittleShoot P2P networking layer and also atop LittleProxy, another little project I’ve completely neglected to mention! You’ll be finding out a lot more about Lantern soon, but sign up for the mailing list at if you want to be notified when you can start playing with it. It’ll be fun, and ultimately should help people all over the world who don’t enjoy the relatively unfettered internet most of us take for granted.

I was actually inspired to write this post, because I just added a little bash code snippet for auto-configuring proxies on OSX using networksetup, a pac file, and some nifty for looping to read lines (trickier than you might think!). I thought others might find it useful. Enjoy!

#!/usr/bin/env bash

mkdir ~/Library/Logs/Lantern

function log() {
echo "`date`: $@" >> ~/Library/Logs/Lantern/installer.log

log "Configuring network services"
while read s;
log "Configuring network: $s"
networksetup -setautoproxyurl "$s" file://localhost$HOME/.lantern/proxy.pac || log "Could not set auto proxy URL for $s"
networksetup -setautoproxystate "$s" "on" || log "Could not turn auto proxy on for $s"
log "Configured network: $s"
done < <(networksetup -listallnetworkservices | tail +2)
log "Done configuring network services!!"


One Response to Lantern Bash Configuration Script on OSX

  1. u770buff0cu53c8u53d1u91cdu4e86u5427u3002u8017u65f6u5341u4e94u5206u949fuff0cu6700u540eu8fd8u80fdu518du52a0u4e00u6bb5u8bddu3002 Click

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: