Skip to content

Instantly share code, notes, and snippets.

@fqrouter
Created January 18, 2013 15:04
Show Gist options
  • Select an option

  • Save fqrouter/4565142 to your computer and use it in GitHub Desktop.

Select an option

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
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