Skip to content

Instantly share code, notes, and snippets.

@Winston-Lin-9527
Created January 23, 2023 00:17
Show Gist options
  • Save Winston-Lin-9527/85186e2870bb9d4754a9dff6b686584b to your computer and use it in GitHub Desktop.
Save Winston-Lin-9527/85186e2870bb9d4754a9dff6b686584b to your computer and use it in GitHub Desktop.
Extend Wifi usage indefinitely on your macbook
#
# Rock on free cafe or library wifi that impose horrendous limit on your usage.
# It spoofs your device's MAC address, run it once to turn on, twice to turn off. You get a random MAC addr everytime.
# So to extend on an existing spoofing session, turn off, then turn on again.
# Winston Lin @ 2023
#
#!/bin/bash
# disconnect the wifi
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
CUR_MAC=$(ifconfig en0 | grep ether | cut -c 8-)
echo $CUR_MAC
echo $REAL_MAC_ADDR
if [ $CUR_MAC = $REAL_MAC_ADDR ]
then
MAC_TO_SET=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
else
MAC_TO_SET=$REAL_MAC_ADDR
fi
sudo ifconfig en0 lladdr $MAC_TO_SET
sudo ifconfig en0 ether $MAC_TO_SET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment