Skip to content

Commit 3ea3e83

Browse files
committed
added encoding="utf8" to open() when reading VID file to fix this:
#1
1 parent 2f00916 commit 3ea3e83

File tree

4 files changed

+114
-0
lines changed

4 files changed

+114
-0
lines changed

python_generate_mac.egg-info/PKG-INFO

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
Metadata-Version: 2.1
2+
Name: python-generate-mac
3+
Version: 1.3.0
4+
Summary: Library for generating Ethernet MAC addresses
5+
Home-page: https://github.com/GIJack/python-generate_mac
6+
Author: GI_Jack
7+
Author-email: [email protected]
8+
License: UNKNOWN
9+
Description: Python-generate_mac
10+
===================
11+
12+
Python library for Generating Ethernet MAC addresses. Can use the wireshark manuf
13+
for specific vendors, and or a random, but assigned address. Will work with
14+
any file formated the same as said file.
15+
16+
Supported functions:
17+
18+
**total_random()** - Procedurely generated MAC address, using random function.
19+
20+
**vid_file_random(_file_)** - uses random line from wireshark's manuf file
21+
22+
**vid_file_vendor(_file, vendor name, desc=optional_)** - specify a vendor name,
23+
uses wireshark's manuf file instead of being completely random. May optionally
24+
specify desc, which searches description within the vendor field
25+
26+
**vid_provided(_vid bytes_)** - specify the VID bytes when calling the function.
27+
Random device bytes will be generated.
28+
29+
**list_vendors(_file_)** - return a python list [] with valid vendors
30+
31+
**is_mac_address(_mac_)** - Takes a string, and checks if it is a valid Ethernet
32+
MAC address. returns True or False(bool type)
33+
34+
Usage
35+
-----
36+
37+
Import and set up an object.
38+
39+
```
40+
from generate_mac import generate_mac
41+
```
42+
43+
Procedurely generated Vendor and Host bytes. Checks for broadcast bit
44+
45+
```
46+
generate_mac.total_random()
47+
'7E:CD:60:1E:AC:6E'
48+
```
49+
50+
Read Vendor bytes from random line in a file. This has to be formated the same
51+
as wireshark's manuf file.
52+
```
53+
generate_mac.vid_file_random('/usr/share/wireshark/manuf')
54+
'70:B3:D5:C5:40:49'
55+
```
56+
57+
Read from a manuf file like above, but find Vendor bytes belonging to a specific
58+
vendor, by name.
59+
```
60+
generate_mac.vid_file_vendor('/usr/share/wireshark/manuf',"Motorola")
61+
'40:88:05:4F:CE:82'
62+
```
63+
*OPTIONAL:* this can also now search the description field
64+
65+
```
66+
generate_mac.vid_file_vendor('/usr/share/wireshark/manuf',"Motorola","BSG")
67+
'00:24:37:5C:3A:8B'
68+
```
69+
70+
Provide the vendor bytes in a string. Generate Host bytes only
71+
```
72+
generate_mac.vid_provided('00:06:8C')
73+
'00:06:8C:35:5E:C4'
74+
```
75+
76+
List valid vendor options as a list.
77+
```
78+
generate_mac.list_vendors('/usr/share/wireshark/manuf')
79+
['Vendor1','Vendor2','etc']
80+
```
81+
82+
Check if a MAC address is valid. returns a Bool(True,False)
83+
```
84+
generate_mac.is_mac_address('00:06:8C:35:5E:C4')
85+
True
86+
```
87+
88+
Get the VID bytes from a MAC address
89+
```
90+
generate_mac.get_vid_bytes('00:06:8C:35:5E:C4')
91+
'00:06:8C'
92+
```
93+
94+
Generate another MAC from the same VID bytes as current MAC
95+
```
96+
generate_mac.another_same_vid('00:06:8C:35:5E:C4')
97+
'00:06:8C:3D:C2:F2'
98+
```
99+
100+
Platform: UNKNOWN
101+
Classifier: Programming Language :: Python :: 3
102+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
103+
Classifier: Operating System :: OS Independent
104+
Requires-Python: >=3.0
105+
Description-Content-Type: text/markdown
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
README.md
2+
setup.py
3+
generate_mac/__init__.py
4+
python_generate_mac.egg-info/PKG-INFO
5+
python_generate_mac.egg-info/SOURCES.txt
6+
python_generate_mac.egg-info/dependency_links.txt
7+
python_generate_mac.egg-info/top_level.txt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
generate_mac

0 commit comments

Comments
 (0)