how to send one udp packet multiple time in scapy ?

11,941

Solution 1

Here you go:

sendp(p, iface=eth0, inter=1 , count=x )

Where p is your packet or a list of packets and count is the number of times to repeat the send operation.

Also check the corresponding documentation scapy.sendrecv Namespace Reference.

Solution 2

create ip packet

i=IP()
i.dst="destination ip "

create udp packet

u=UDP()
u.dport="destination port"

now send

while(1)
{
send(i/u)
}

Solution 3

With this line, your packet will be send continuously, on a loop :

send(packet, loop=1)

Share:
11,941
ms.flo
Author by

ms.flo

Updated on June 04, 2022

Comments

  • ms.flo
    ms.flo about 2 years

    How to send one udp packet multiple time in scapy ? I need to send,an valid udp packet more than one times. Is there any specific method or function in scapy ?

  • Symmetric
    Symmetric over 10 years
    This is very slow; use sendp() (as suggested above) to get a reasonable rate.
  • lowitty
    lowitty over 9 years
    @Symmetric How can I send packet one by one and in a fast speed using scapy? I need to modify every packet and send it out, problem is that send(packet) takes a long time. Do you know that there is a solution?
  • John Smith
    John Smith about 2 years
    I noticed that when loop=2 is specified it works as well. What is the difference between loop=1 and loop=2?
  • Utopia
    Utopia about 2 years
    loop=2 means you sent two packets at the same time, in a loop.