alobbs / macchanger

GNU MAC Changer
http://www.gnu.org/software/macchanger
GNU General Public License v3.0
588 stars 112 forks source link

Random MAC with specified oui? #26

Open DiagonalArg opened 8 years ago

DiagonalArg commented 8 years ago

I am using a network that cuts off connections of non-mobile devices after half an hour. I'd like to be able to set the MAC on my laptop to make it look like an iphone or HTC phone, for instance. I can generate a random mac looking like an iphone 5S this way:

echo "f4:37:b7$(openssl rand 3 | hexdump -e '/1 ":%02x"')"

So I think this should work for me:

macchanger -m "f4:37:b7$(openssl rand 3 | hexdump -e '/1 ":%02x"')" <interface>

It would be nice if there were an easier way to do this, perhaps a -oui=<OUI> option that sets the mac to some random value with the given <OUI>.

Thanks for considering it. And thanks for your work!

thoger commented 8 years ago

A work-around that you may or may not find less ugly than your code above would be to first use macchanger to set vendor/OUI part and next use it to randomize the non-OUI part. Something like:

macchanger -m "f4:37:b7:00:00:00" eth0
macchanger -e eth0
DiagonalArg commented 8 years ago

Thanks. Either of those will work for now.

Perhaps you'll keep the --oui=<OUI> suggestion in mind for the future.

In any case, all efforts appreciated.

alrs commented 8 years ago

I wrote "plausible" to generate a random MAC address using an OUI from the Wireshark manuf database. https://github.com/alrs/plausible