Created
January 18, 2013 15:04
-
-
Save fqrouter/4565142 to your computer and use it in GitHub Desktop.
we send the packet through GFW without reaching facebook, it still can trigger GFW returning FAKE ACK and FAKE RESET
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import dpkt | |
| import socket | |
| import binascii | |
| hex_ip_packets = [ | |
| 'binascii.hexlify output of SYN' # replace with your own captured output | |
| 'binascii.hexlify output of HTTP GET' # replace with your own captured output | |
| ] | |
| raw_socket = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW) | |
| raw_socket.setsockopt(socket.SOL_IP, socket.IP_HDRINCL, 1) | |
| for hex_ip_packet in hex_ip_packets: | |
| ip_packet = dpkt.ip.IP(binascii.unhexlify(hex_ip_packet)) | |
| ip_packet.ttl = 12 | |
| ip_packet.sum = 0 | |
| ip_packet.tcp.sum = 0 | |
| raw_socket.sendto(str(ip_packet), (socket.inet_ntoa(ip_packet.dst), 0)) | |
| print('done') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment