All pastes #168326 Raw Edit

Mine

public text v1 · immutable
·published 2006-09-12 22:01 UTC
rendered paste body
import ctypes
from ctypes import c_char_p, create_string_buffer
import socket

libc = ctypes.CDLL('libc.so.6')

addr = "127.0.0.1"
c_addr = c_char_p(addr)
dst = create_string_buffer(100)
ok = libc.inet_pton(socket.AF_INET, c_addr, dst)
if 0 <= ok:
    print [ ord(x) for x in dst[:4] ]