Python-generate_mac
Python library for working with Ethernet MAC addresses. Functions for generating transforming and testing MAC addresses.
Uses Wireshark's manuf, or s similarly formated file as input for specific Vendor ID(VID) bytes, for creating more
Supported functions:
Generate
total_random() - Procedurely generated MAC address, using random function.
vid_file_random(file) - uses random line from wireshark's manuf file
vid_file_vendor(file, vendor name, desc=optional) - specify a vendor name, uses wireshark's manuf file instead of being completely random. May optionally specify desc, which searches description within the vendor field
vid_provided(vid bytes) - specify the VID bytes when calling the function. Random device bytes will be generated.
Test
list_vendors(file) - return a python set{} of uniqe valid vendors, from a wireshark manuf file
is_mac_address(mac) - Takes a string, and checks if it is a valid Ethernet MAC address. returns True or False(bool type)
Transform
get_vid_bytes(mac) - Returns the vendor bytes(first three) from a MAC address.
another_same_vid(mac) - Generates another MAC with diffrent device bytes with same vendor bytes as input
Usage
Import and set up an object.
from generate_mac import generate_mac
Procedurely generated Vendor and Host bytes. Checks for broadcast bit
generate_mac.total_random()
'7E:CD:60:1E:AC:6E'
Read Vendor bytes from random line in a file. This has to be formated the same as wireshark's manuf file.
generate_mac.vid_file_random('/usr/share/wireshark/manuf')
'70:B3:D5:C5:40:49'
Read from a manuf file like above, but find Vendor bytes belonging to a specific vendor, by name.
generate_mac.vid_file_vendor('/usr/share/wireshark/manuf',"Motorola")
'40:88:05:4F:CE:82'
OPTIONAL: this can also now search the description field
generate_mac.vid_file_vendor('/usr/share/wireshark/manuf',"Motorola","BSG")
'00:24:37:5C:3A:8B'
Provide the vendor bytes in a string. Generate Host bytes only
generate_mac.vid_provided('00:06:8C')
'00:06:8C:35:5E:C4'
List valid vendor options as a list.
generate_mac.list_vendors('/usr/share/wireshark/manuf')
['Vendor1','Vendor2','etc']
Check if a MAC address is valid. returns a Bool(True,False)
generate_mac.is_mac_address('00:06:8C:35:5E:C4')
True
Get the VID bytes from a MAC address
generate_mac.get_vid_bytes('00:06:8C:35:5E:C4')
'00:06:8C'
Generate another MAC from the same VID bytes as current MAC
generate_mac.another_same_vid('00:06:8C:35:5E:C4')
'00:06:8C:3D:C2:F2'
Metadata
Release files for python-generate-mac 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-generate_mac-1.3.1.tar.gz | 5.2 kB | Without provenance | Details for python-generate_mac-1.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_generate_mac-1.3.1-py3-none-any.whl | Python 3 | none | any | Details for python_generate_mac-1.3.1-py3-none-any.whl |
Total release size: 22.7 kB
Release files / python-generate_mac-1.3.1.tar.gz
| Download URL | python-generate_mac-1.3.1.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4573f5a46d0e3855ef0b43a01ed064d86a2b3aa02c6b878f1bb15644ec61ad0b
|
|
BLAKE2b-256 checksum How to use checksums |
90f43ee6f686259f01eb910b5aba15b0612ee4dcfd87f88266cf420e6f7cc465
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.0 importlib_metadata/3.7.2 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / python_generate_mac-1.3.1-py3-none-any.whl
| Download URL | python_generate_mac-1.3.1-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42df6c9b159ce59489b09232488ed03b5eb01825cfeb41210ce5a8d1e5290953
|
|
BLAKE2b-256 checksum How to use checksums |
9f52d8ac7cb3f23ab9bb94421f3c2d2ab20bcadeb992a26e588bf4917a01391e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.0 importlib_metadata/3.7.2 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Security for python-generate-mac 1.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.