Last active
March 13, 2024 16:04
-
-
Save SweBarre/0f3b984fd655601d4f13e6af065fde77 to your computer and use it in GitHub Desktop.
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 | |
# Domain Search Option Format generator for Unifi Security Gateway | |
# Usage: python3 dhcp_option_119.py example.com example.net | |
import sys | |
hexes = [] | |
for domain in sys.argv[1:]: | |
for label in domain.split('.'): | |
hexes.append('%02x' % len(label)) | |
hexes.extend(['%02x' % ord(char) for char in str.lower(label)]) | |
hexes.append('00') | |
print(":".join(hexes)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment