All Projects → andrewgho → Genmac

andrewgho / Genmac

Generate valid looking random MAC address

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Genmac

Opmsg
opmsg message encryption
Stars: ✭ 704 (+7722.22%)
Mutual labels:  privacy
Lf
Fully Decentralized Fully Replicated Key/Value Store
Stars: ✭ 809 (+8888.89%)
Mutual labels:  privacy
Ios
DuckDuckGo iOS Application
Stars: ✭ 916 (+10077.78%)
Mutual labels:  privacy
Webclient
The mega.nz web client
Stars: ✭ 723 (+7933.33%)
Mutual labels:  privacy
Stealing Ur Feelings
Winner of Mozilla's $50,000 prize for art and advocacy exploring AI
Stars: ✭ 784 (+8611.11%)
Mutual labels:  privacy
Mailtrackerblocker
Email tracker, read receipt and spy pixel blocker plugin for macOS Apple Mail
Stars: ✭ 821 (+9022.22%)
Mutual labels:  privacy
Duckduckgo Privacy Extension
DuckDuckGo Privacy Essentials browser extension for Firefox, Chrome.
Stars: ✭ 692 (+7588.89%)
Mutual labels:  privacy
Android Privacy Issues
an article describing the privacy issues in Android OS
Stars: ✭ 26 (+188.89%)
Mutual labels:  privacy
Sdk Js
Tanker client-side encryption SDK for JavaScript
Stars: ✭ 786 (+8633.33%)
Mutual labels:  privacy
Lyra
A lightweight encryption tool designed for ease of use.
Stars: ✭ 22 (+144.44%)
Mutual labels:  privacy
Hblock
Improve your security and privacy by blocking ads, tracking and malware domains.
Stars: ✭ 724 (+7944.44%)
Mutual labels:  privacy
Zsocket
Zero-copy sockets for Linux in Golang
Stars: ✭ 776 (+8522.22%)
Mutual labels:  ethernet
Tf Encrypted
A Framework for Encrypted Machine Learning in TensorFlow
Stars: ✭ 832 (+9144.44%)
Mutual labels:  privacy
Debotnet
🔥🚀 Debotnet is a tiny portable tool for controlling Windows 10's many privacy-related settings and keep your personal data private.
Stars: ✭ 707 (+7755.56%)
Mutual labels:  privacy
Ping Blocker
Stop sites from tracking the links you visit through hyperlink auditing
Stars: ✭ 23 (+155.56%)
Mutual labels:  privacy
Awesome Security Gists
A collection of various GitHub gists for hackers, pentesters and security researchers
Stars: ✭ 701 (+7688.89%)
Mutual labels:  privacy
Analytics
Lightweight analytics abstraction layer for tracking page views, custom events, & identifying visitors
Stars: ✭ 814 (+8944.44%)
Mutual labels:  privacy
Fathom
Fathom Lite. Simple, privacy-focused website analytics. Built with Golang & Preact.
Stars: ✭ 6,989 (+77555.56%)
Mutual labels:  privacy
Ethercard
EtherCard is an IPv4 driver for the ENC28J60 chip, compatible with Arduino IDE
Stars: ✭ 924 (+10166.67%)
Mutual labels:  ethernet
Peergos
A p2p, secure file storage, social network and application protocol
Stars: ✭ 895 (+9844.44%)
Mutual labels:  privacy

genmac - generate valid looking random MAC address

This program generates a random MAC address, suitable for testing, or to change your local MAC address for whatever purpose. It differs from other, similar, programs in that it optionally looks up an actual manufacturer prefix (Organizational Unique Identifier) to make the MAC address look more like ones that would occur in the real world.

Getting Started

Download the source from GitHub:

Install the program by just copying it anywhere in your $PATH.

For usage:

$ genmac -h

To generate a single, random MAC address:

$ genmac

Description

MAC addresses are generally 48-bit unique identifiers assigned to network interfaces on a local, physical network, most commonly, an Ethernet network, or a wireless (Wi-Fi) network that acts like one. MAC addresses are usually represented as six octets (bytes), each one printed as a two-digit hexadecimal number, separated by colons, or sometimes hyphens, for example:

d4:01:29:9d:10:e2

MAC addresses are typically set in hardware, for example, in read-only memory on a network interface card. However, most operating systems allow the MAC address to be overridden at the OS network layer.

This program assists in generating a MAC address that can be used to simulate real-world MAC addresses in testing, or to use to override a hardware-set MAC address, whether for testing, or as part of a layered effort to mask your identity.

It is pretty straightforward to generate a random MAC address from the command line, or with a scripting language:

$ openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
$ ruby -e 'puts (1..6).collect { "%02x" % [rand 255] }.join(":")'

However, there are two non-random aspects to real-world MAC addresses. First, there is a special meaning to the least significant two bits in the first octet; and second, every organization (usually manufacturer) in the world that creates network interfaces is assigned an IEEE registered "Organizational Unique Identifier" (OUI), which forms the first three octets of the MAC address.

genmac can take both of these non-random aspects into account when creating an otherwise random MAC address. To generate a mostly-random MAC address, run genmac by itself:

$ genmac

In the MAC address printed to stdout, all values are random, except that the first octet has the second-least significant bit, which determines whether a MAC address is universally or locally administered, set to the former (universally administered), just as it would be for an actual manufacturer MAC address.

To mark your MAC address as locally administered, which is conventional for addresses that are purposely fake or random, pass the -l or --local flag:

$ genmac -l

To generate a large number of MAC addresses, pass -n with a numeric argument, to print that many addresses:

$ genmac -n 10

To generate a more realistic MAC address, the first three octets should be taken from a real-world OUI. To do this, you need to download a copy of the IEEE maintained list of Organizational Unique Identifiers, which is updated daily:

$ wget http://standards.ieee.org/develop/regauth/oui/oui.txt

A snapshot of the file is included with genmac, however, you should check for and download a fresh copy for yourself, as the table is updated daily by IEEE.

Save the file to the same directory genmac lives in (or, pass the -f command line argument to point at where the file lives). Then, run genmac with a string that matches an organization name. For example, to generate a single MAC address that could plausibly have been assigned to a Broadcom device:

$ genmac broadcom

The organization argument is interpreted as a case-insensitive Ruby regular expression, anchored at the left, with a word boundary on the right. The following example of creates MAC addresses from multiple possible organizations:

$ genmac -n 20 'apple|motorola|nokia|samsung'

To see what organization names match, pass the -v (--verbose) flag:

$ genmac -v google

This program simply prints out the random MAC address. If you wish to change your local network interface MAC address, you will need to look for instructions specific to your OS and version.

See Also

General MAC Address/OUI Documentation

MAC Address Spoofing

Prior Art

  • GNU MAC Changer is a more fully featured program that can show and directly set MAC addresses, and ships with its own OUI database. genmac differs in that it parses a raw IEEE OUI file, which you can update for yourself at any time; and is a single-file Ruby script that can be run without compilation.
  • SpoofMAC is a Python script and library to show and set MAC addresses. genmac differs in that it considers real world OUIs instead of using a single hardcoded one, and is a standalone program that can be run without being installed as a library.

Author

Andrew Ho ([email protected])

License

This project is released under a standard 3-clause BSD license:

Copyright (c) 2014, Andrew Ho
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

3. Neither the name of Andrew Ho nor the names of its contributors may
   be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

All organizational names mentioned in the documentation may be trademarks of their respective owners, and organizations mentioned are not affiliated with this project in any way other than as example names.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].