Skip to content

Commit

Permalink
python/hex2ip.py: initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
VMiklos committed Nov 21, 2006
1 parent 60ab438 commit ad9bdc1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 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]

0 comments on commit ad9bdc1

Please sign in to comment.