Skip to content

Instantly share code, notes, and snippets.

@Liandriz
Forked from rsdy/01mac.sh
Created August 16, 2017 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Liandriz/688b99ef671d1213231c6c2b976468c8 to your computer and use it in GitHub Desktop.
Save Liandriz/688b99ef671d1213231c6c2b976468c8 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