Skip to content

Instantly share code, notes, and snippets.

View zhang-ray's full-sized avatar
😁
Focusing

Ruihuai(Ray) Zhang zhang-ray

😁
Focusing
View GitHub Profile
@zhang-ray
zhang-ray / randomize-mac-addresses.sh
Last active February 19, 2019 02:11 — forked from fawkesley/randomize-mac-addresses.sh
In Ubuntu 16.04, randomize WiFi MAC addresses with a daily rotation - /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses.sh
#!/bin/sh
#LOG_FILE=/var/log/randomize-mac-addresses
#echo "$(date): $*" > ${LOG_FILE}
UUID_DAILY_HASH=$(echo "$(date +%F)" | md5sum)
RANDOM_MAC="b2:$(echo -n ${UUID_DAILY_HASH} | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5/')"
ip link set dev wlp1s0 down