Question

I want to use Python to sniff network traffic, inspect the packets and manipulate some specific ones. Something like a MITM attack which manipulates network traffic.

I already had a look at scapy but I don´t think it fits my needs because i can only generate packets but I can´t manipulate existing ones.

Was it helpful?

Solution

You can use Twisted to set up a TUN or TAP device on Linux. If you configure your network properly, you can cause all network traffic to pass through your Python program and you can manipulate it however you want as it passes through.

See http://twisted.readthedocs.org/en/latest/projects/pair/howto/tunnels.html for details. Also note that while this functionality has been in Twisted for a long time, unless you can find the Eunuchs package for your platform you won't be able to use it unless you use Twisted trunk@HEAD (where the Eunuchs dependency has been dropped).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top