Skip to content

Instantly share code, notes, and snippets.

@rsdy
Created December 15, 2011 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rsdy/1479190 to your computer and use it in GitHub Desktop.
Save rsdy/1479190 to your computer and use it in GitHub Desktop.
wicd random mac preconnect hook
#!/bin/sh
LOG=/tmp/mac
WIRELESS=wlan0
WIRED=eth0
mac_map() {
case "x$1" in
xfixed) mac='11:22:33:44:55:66'
;;
*)
;;
esac
}
mac_change() {
ifconfig $1 down
[ -z "$mac" ] && macchanger -a $1 || macchanger -m $mac $1
ifconfig $1 up
}
exec >>$LOG 2>&1
if [ "x$1" = "xwireless" ]; then
mac_map $2
mac_change $WIRELESS $mac
else
mac_change $WIRED
fi
echo " -- $(date) -- $1 -- $2 -- ${mac:-random}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment