Skip to content

Instantly share code, notes, and snippets.

@rajkosto
Created November 18, 2022 12:56
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save rajkosto/29c513b96ea6262d2fb1f965a52ce16f to your computer and use it in GitHub Desktop.
Save rajkosto/29c513b96ea6262d2fb1f965a52ce16f to your computer and use it in GitHub Desktop.
ODI SFP XPON stick MAC_KEY generator
#!/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())
@wilfrido99
Copy link

Thank you my friend @akeyx, I needed it for my Xpon stick.

@wilfrido99
Copy link

Could you tell me what software you used to run the script?

@akeyx
Copy link

akeyx commented Mar 7, 2024

The bash shell.

@ddsofiane
Copy link

Could anyone help me create a Mackey for my MacAddress: Mac:B8:DD:71:D6:D7:6E
thanks

@0x3333
Copy link

0x3333 commented Apr 29, 2024

I created a CyberChef recipe So you don't need to know python or bash.

Just put your mac address. It will sanitize, but will not validate.

@0x3333
Copy link

0x3333 commented Apr 29, 2024

Could anyone help me create a Mackey for my MacAddress: Mac:B8:DD:71:D6:D7:6E thanks

Using CyberChef above:

image

c8df39a8946cb9ff9728642ee087d20d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment