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

Question:

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 ?

Asked By: Tarek

||

Answers:

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

Answered By: 0x27752357
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.