Commit 45e5d3ac authored by Phil Booth's avatar Phil Booth

feat(script): implement a simple mac address changer for osx

parents
.node_modules
npm-debug.log
# Change log
## 1.0.0
* feat: implement a simple mac address changer for osx
Copyright © 2017 Phil Booth
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# wifi-disguise
*In which our hero triumphs over his dastardly nemesis.*
[![Package status](https://img.shields.io/npm/v/wifi-disguise.svg?style=flat-square)](https://www.npmjs.com/package/wifi-disguise)
[![License](https://img.shields.io/github/license/philbooth/wifi-disguise.svg?style=flat-square)](https://opensource.org/licenses/MIT)
* [What is it?](#what-is-it)
* [But why?](#but-why)
* [What doesn't it do?](#what-doesnt-it-do)
* [How do I install it?](#how-do-i-install-it)
* [How do I use it?](#how-do-i-use-it)
* [What license is it released under?](#what-license-is-it-released-under)
## What is it?
A script
that automates
changing the MAC address
of your wireless network adaptor
on OS X.
## But why?
To confound those
infuriating little twerps
who seek to prevent me
from getting work done
while using their bus network.
*I paid for that sodding ticket!*
## How do I install it?
```
npm i -g wifi-disguise
```
## How do I use it?
Just run the command `disguise`,
with no arguments:
```
disguise
```
The script will tell you
what it's doing as it runs.
You will need to
enter your password
to authorize
updating your MAC address.
If you change your mind,
you can cancel the script
with `^C`.
Example output:
```
Old MAC address for en0 is: 16:df:22:67:d9:b4.
New MAC address for en0 is: 70:3e:53:4c:90:73. Enter your password to confirm.
Password:
Updated MAC address for en0 is: 70:3e:53:4c:90:73.
Turning off wi-fi on en0
1...2...3...
Turning on wi-fi on en0
```
## What license is it released under?
[MIT](LICENSE).
#!/bin/sh
WIFI=`networksetup -listallhardwareports | awk '$3=="Wi-Fi" {getline; print $2}'`
MAC=`ifconfig $WIFI | grep ether | cut -d ' ' -f 2`
echo "Old MAC address for $WIFI is: $MAC."
NEW_MAC=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
echo "New MAC address for $WIFI is: $NEW_MAC. Enter your password to confirm."
sudo -k ifconfig en0 ether $NEW_MAC
if [ $? -ne 0 ]; then
exit 1
fi
MAC=`ifconfig $WIFI | grep ether | cut -d ' ' -f 2`
echo "Updated MAC address for $WIFI is: $MAC."
echo "Turning off wi-fi on $WIFI"
networksetup -setairportpower $WIFI off
for i in {1..3}; do
printf "$i..."
sleep 1
done
echo ""
echo "Turning on wi-fi on $WIFI"
networksetup -setairportpower $WIFI on
{
"name": "wifi-disguise",
"version": "1.0.0",
"os": [
"darwin"
],
"preferGlobal": true,
"description": "In which our hero triumphs over his dastardly nemesis.",
"author": "Phil Booth <[email protected]> (https://philbooth.me/)",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/philbooth/wifi-disguise.git"
},
"homepage": "https://github.com/philbooth/wifi-disguise#readme",
"bugs": {
"url": "https://github.com/philbooth/wifi-disguise/issues"
},
"bin": {
"disguise": "./disguise.sh"
},
"keywords": [
"wifi",
"mac",
"address",
"changer",
"switcher",
"osx",
"macos",
"darwin"
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment