Permalink
Browse files

python/hex2ip.py: initial import

  • Loading branch information...
1 parent 60ab438 commit ad9bdc1d9d321a7bea31b55b65c95bc6fbed703a VMiklos committed Nov 21, 2006
Showing with 10 additions and 0 deletions.
  1. +10 −0 python/hex2ip.py
View
@@ -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]

0 comments on commit ad9bdc1

Please sign in to comment.