dotfiles/bin/unhexch
2020-09-27 15:57:01 -04:00

18 lines
390 B
Python
Executable file

#!/usr/bin/env python3
import argparse
def _hexip(s: str):
ip = []
for i in range(0, len(args.hex), 2):
octet = int(args.hex[i:i+2], 16)
ip.append(str(octet))
return ".".join(ip)
if __name__ == "__main__":
parser = argparse.ArgumentParser("webchat IP dehexlify")
parser.add_argument("hex")
args = parser.parse_args()
print(_hexip(args.hex))