Skip to content
Advertisement

What is the difference between these sending methods in python scapy?

from scapy.all import *

1 – LAYER 3 :

layer3 = IP(src='127.0.0.1', dst='127.0.0.1')

The result when i use sr() or sr1() the same as below:

Received 1 packets, got 1 answers, remaining 0 packets

The result when i use send():

Sent 1 packets.

2 – LAYER 2:

layer2 = Ether(src='11:22:33:44:55:66', dst='11:22:33:44:55:66')

The result when i use srp() or srp1() the same as below:

Received 1 packets, got 1 answers, remaining 0 packets

The result when i use sendp():

Sent 1 packets.

I know sr() and sr1() and send() are for layer 3 and srp() and srp1() and sendp() are for layer 2

my question is what is the difference between the functions that are in layer 3 and what is the difference between the functions that are in layer 2 ?

Advertisement

Answer

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. read documents please for more informations

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement