Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send UDP packet to specific UDP dst port in scapy?

Tags:

scapy

I would like to send my packet to a UDP dst port number and send it through eth0 interface (if scapy handles my layer2 directly, then eth0 does not need to be given as an argument)

like image 811
drdot Avatar asked Feb 19 '15 03:02

drdot


People also ask

How do I send packets with scapy?

To send a package in scapy, we have two methods: send(): Sends layer-3 packets. sendp(): Sends layer-2 packets.

Which command is used to send data in UDP protocol?

The udp command is used to send and receive UDP datagram messages over an IP network.

What is the difference between send and Sendp in scapy?

The send() function will send packets at layer 3. That is to say, it will handle routing and layer 2 for you. The sendp() function will work at layer 2. It's up to you to choose the right interface and the right link layer protocol.

How send UDP packet Linux?

Use nc command for sending and receiving UDP packets through network. Send some human readable sentences through nc command. Capture the UDP packet sent by nc command. Check network packet in Wireshark.


1 Answers

Using the scapy documentation, we see that sending an UDP packet is as simple as:

send(IP(dst="127.0.0.1")/UDP(dport=123)/Raw(load="abc"))
like image 54
Ortomala Lokni Avatar answered Sep 21 '22 11:09

Ortomala Lokni