Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

macsanity-1.0.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

macsanity-1.0.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file macsanity-1.0.1.tar.gz.

File metadata

  • Download URL: macsanity-1.0.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for macsanity-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4c764f4c0c059880a827bdc34cb0347a2678e7c413f22514f942e52bbd3c8610
MD5 21ee6643e7c25e509b2b556cbaf8d7b4
BLAKE2b-256 9ca48373caa686094613c2a9b65c4a8637454f5a506b89b8baa1b16912b0c590

See more details on using hashes here.

File details

Details for the file macsanity-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: macsanity-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for macsanity-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5daf0662c899694d4ddbaa6debfcc829c393562ae6d1cf1951907f945e4e316f
MD5 0efd2590ee9f7800428bbd6c32a435f1
BLAKE2b-256 877088a1601a9e9b0a969923977ebb3501aa42c3068eaccbd19c0991cf467a51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page