From ad9bdc1d9d321a7bea31b55b65c95bc6fbed703a Mon Sep 17 00:00:00 2001 From: VMiklos Date: Tue, 21 Nov 2006 20:59:32 +0000 Subject: [PATCH] python/hex2ip.py: initial import --- python/hex2ip.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 python/hex2ip.py diff --git a/python/hex2ip.py b/python/hex2ip.py new file mode 100644 index 00000000..17463dab --- /dev/null +++ b/python/hex2ip.py @@ -0,0 +1,10 @@ +import socket, sys + +def hex2ip(s): + return ".".join(["%d"%int(n, 16) for n in (s[0:2],s[2:4],s[4:6],s[6:8])]) +try: + host = socket.gethostbyaddr(hex2ip(sys.argv[1])) +except socket.error, str: + print str[1] + sys.exit(-1) +print host[0]