Hacker Newsnew | past | comments | ask | show | jobs | submit | Leask's commentslogin

Using this python script to make the int-ip-address:

#!/usr/bin/env python

import socket

import struct

def ip2long(ip):

    packedIP = socket.inet_aton(ip)

    return struct.unpack("!L", packedIP)[0]
print ip2long('192.241.224.102') # your website ip address

# or download it on github: https://gist.github.com/Leask/7075483


Or more straightforward in Python 3.3+:

    import ipaddress

    print(int(ipaddress.ip_address('192.241.224.102')))


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: