Working with multiple interfaces in scapy

I am trying to make a script to test the behavior of network switches and routers. The idea is to run a scapy-based script on a host with multiple network adapters connected to different router ports. The script will send probe packets to one port and see how the probe packets propagate to other ports.

In the past, I have used the python multiprocessing package for parallel operations with scapy. Behind the scenes, multiprocessing uses a forked process and provides handy inter-process communication primitives. I suppose I could do the same this time: create a bunch of sub-processes, each of which sniffs its own interface and pushes print packets into the queue of the parent process. As a bonus, this approach will also let you run sniffers on remote hosts.

But since the last time I played around with multiprocessing and scapy, I discovered the Automaton scapy module and would rather use it if possible. This module has a decor_condition decorator method, but I cannot figure out how

  • Specify which interfaces the Automaton module sniffs
  • Determine which interface package was received in

It would also be nice to know if a packet is coming in or out, but I suspect this might not be possible.

Any suggestions?

+3


source to share





All Articles