-
-
Save toidang92/b75e2dd0371b4206003ecaf99c371f5c to your computer and use it in GitHub Desktop.
ODI SFP XPON stick MAC_KEY generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
#ODI DFP-34X-2C2 MAC_KEY key generator by rajkosto | |
import sys | |
import string | |
import hashlib | |
args = sys.argv | |
if len(args) != 2: | |
sys.exit("Usage: odi_keygen.py YOURMACADDR") | |
macAddr = args[1].strip().replace(':','') | |
if len(macAddr) != 12: | |
sys.exit("Mac address must be 12 hex digits (6 bytes)") | |
if not all(c in string.hexdigits for c in macAddr): | |
sys.exit("Mac address can only contain 0-9, A-F characters (hex digits)") | |
cmacPrefix = 'hsgq1.9a' | |
hashText = cmacPrefix+macAddr.upper() | |
encodedText = hashText.encode('ascii') | |
md5Hash = hashlib.md5(encodedText).digest().hex() | |
print('ELAN_MAC_ADDR='+macAddr.lower()) | |
print('MAC_KEY='+md5Hash.lower()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment