Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from scapy.all import *
- import netfilterqueue
- import re
- def set_load(pkt, load):
- pkt[Raw].load = load
- try:
- del pkt[IP].len
- del pkt[IP].chksum
- del pkt[UDP].len
- del pkt[UDP].chksum
- except:
- pass
- return pkt
- def process(packet):
- pkt = IP(packet.get_payload())
- if pkt.haslayer(Raw):
- if pkt[TCP].dport == 80:
- print('[+]Request')
- load = pkt[Raw].load
- mod_load = re.sub("Accept-Encoding:.*?\\r\\n",'',str(load))
- new_packet = set_load(pkt, mod_load)
- packet.set_payload(bytes(new_packet))
- elif pkt[TCP].sport == 80:
- print("[+]Response")
- print(pkt.show())
- packet.accept()
- queue = netfilterqueue.NetfilterQueue()
- queue.bind(0,process)
- queue.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement