Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

python/hex2ip.py: initial import

  • Loading branch information...
commit ad9bdc1d9d321a7bea31b55b65c95bc6fbed703a 1 parent 60ab438
VMiklos authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 python/hex2ip.py
View
10 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]
Please sign in to comment.
Something went wrong with that request. Please try again.