O'Reilly logo

Mastering Python for Networking and Security by Jose Manuel Ortega

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending packets with scapy

To send a package in scapy, we have two methods:

  • send(): Sends layer-3 packets

  • sendp(): Sends layer-2 packets

We will use send() if we do it from layer 3 or IP and trust the routes of the operating system itself to send it. We will use sendp() if we need control at layer 2 (for example, Ethernet).

The main arguments for the send commands are:

  • iface: The interface to send packets.

  • Inter: The time, in seconds, that we want to pass between package and package sent.

  • loop: To keep sending packets endlessly, set this to 1. If it is different from 0, send the packet, or list of packages, in an infinite loop until we stop it by pressing Ctrl + C.

  • packet: Packet or a list of packets.

  • verbose: It allows us ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required