A simple tool for formatting MAC addresses
Project description
macsanity
A dangerously friendly tool to convert MAC addresses into whatever weird format the world throws at you.
🧵 Our Story
macsanity started as an idea for compostable popsicles.
The working title was..
TurdVendor - Where ethics meets excrement.
Goal:
save the planet — one regrettable dessert at a time.
That didn't really work out.
So we pivoted.
Now it’s a tool for formatting MAC addresses.
Because apparently, no two vendors can agree on what a colon is.
Still trying to save the world.
Just with slightly less shit.
How to use in terminal (cli)
positional arguments:
mac_address: The MAC address to format
options:
-h, --help: show this help message and exit
-f, --format: {'colon','dot','dash','ddash','space','blank','binary','compact','eui64','bpf','reverse','upsidedown'}, The format to use. If not specified, all formats will be printed.
Available formats:
colon : Colon-separated format, e.g., ab:12:cd:34:ef:56.
dot : Dot notation, e.g., abcd.ef12.3456.
dash : Hyphen-separated format, e.g., ab-12-cd-34-ef-56.
ddash : Double-dash-separated format, e.g., ab12-cd34-ef56.
space : Space-separated format, e.g., ab 12 cd 34 ef 56.
blank : Continuous string with no delimiters, e.g., ab12cd34ef56.
binary : Binary format, e.g., 10101011 00010010 11001101 00110100 11101111 01010110.
compact : Base64 encoded format, e.g., qXLNTq9W.
eui64 : Cisco EUI-64 format, e.g., ab12.cd34.fffe.ef56.
bpf : BPF format with each byte prefixed by '\x', e.g., \xab\x12\xcd\x34\xef\x56.
reverse : Reverse byte order, e.g., 56ef34cd12ab.
upsidedown : Because why not? Flip your MAC and the world with it. 🌀
-u, --uppercase: Prints the MAC address in uppercase.
-l, --lowercase: Prints the MAC address in lowercase.
Example usage:
macsanity abcdef123456 -f dot
output:
abcd.ef12.3456
There is also a shorter alias:
mcs abcd.ef12.3456 -f colon -u
output:
AB:CD:EF:12:34:56
How to use in your code
from macsanity import MacSanity
mac_address = 'ab:cd:ef:12:34:56'
mac = MacSanity(mac_address)
print(mac.dot)
print(mac.dash)
print(mac.ddash)
print(mac.space)
print(mac.colon)
print(mac.blank)
print(mac.binary)
print(mac.compact)
print(mac.eui64)
print(mac.bpf)
print(mac.reverse)
print(mac.upsidedown)
output:
abcd.ef12.3456
ab-cd-ef-12-34-56
abcd-ef12-3456
ab cd ef 12 34 56
ab:cd:ef:12:34:56
abcdef123456
10101011 11001101 11101111 00010010 00110100 01010110
q83vEjRW
ab12.cd34.fffe.ef56
\xab\xcd\xef\x12\x34\x56
654321fedcba
ɓɐ ɟǝ pɔ ʞɾ ᴉu
macsanity is proudly built by anython.
Because someone had to.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file macsanity-1.0.0.tar.gz.
File metadata
- Download URL: macsanity-1.0.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dbedfa06157053529212d70a03fbbed6198e483942c699ff7170e55d4df1a36
|
|
| MD5 |
9af44d6ff54c2ca4b8d6a7a1d79de637
|
|
| BLAKE2b-256 |
684adcf8274f6e70ff2eb610746aba4886e460b9f0f1bbee2b661d4bc57eca51
|
File details
Details for the file macsanity-1.0.0-py3-none-any.whl.
File metadata
- Download URL: macsanity-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c3fd66f0594cfb36e91596cdb3256cde7bac2f753c0aa424c1ab9f6a414932c
|
|
| MD5 |
954d8c74d5f0f289f0bad8b8d5136974
|
|
| BLAKE2b-256 |
8bc1627cac2e1a8fe8ebe6a5b5ed4dcd575f99ebae7a83047a16ec8b4f37ca98
|