This is for a CTF challenge. We have a client and a server that communicate with each other on the same subnet as we do. We have to poison them, modify the packages and then forward them
i know how to modify the packages with scapy, and i have already implemented the arp poisoning part of it
The problem I am currently facing is how to connect the received packet received from the socket library and send it to a function that modifies it. Then I can send it I tried socket library
should I have something like this in my Python code? :
s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
s.bind ((host, port))
conn, addr = s.accept ()
If so, I should start the code. How can I change it using scapy now ?!
can scapy even change the package that was received from the socket?
AND I can not use tools and libraries that need access to the iptables command because access is locked in the operating system (for example, Netfilterqueue).
To edit: I think the other option is just to use sniff (), then change part of it and pass it on. If this is the best option, you can tell me how I can see and change the content of the payload. For example, when I say something like Print (package)[TCP].payload) shows a kind of byte stream, which comes with b & # 39; x44 … & # 39; starts
I tried to decode it with package[TCP].payload.decode (& # 39; utf-8 & # 39;) and ascii, however, did not work and returned the following error: A
I also tried to string it into a string like str (package[TCP].payload) and still did not work.