def num2ip(arg, int_ip):
"""
IP address and number conversion
"""
if arg == 'ip':
ip = socket.inet_ntoa(struct.pack('I', socket.htonl(int_ip)))
else:
ip = str(socket.ntohl(struct.unpack('I', socket.inet_aton(int_ip))[0]))
return ip
评论列表
文章目录