Which function sends and receives packets using Layer 2 components you specify?

Study for the SANS560 GIAC Penetration Tester (GPEN) Test. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Multiple Choice

Which function sends and receives packets using Layer 2 components you specify?

Explanation:
Focusing on how Scapy handles packet sending at different OSI layers clarifies this. To work directly with link-layer frames (Layer 2), you craft Ethernet headers and send/receive those frames as a unit. The function designed for exactly that is srp, which sends and receives packets at Layer 2, letting you specify the Ether() header (or other L2 constructs) and operate on raw Ethernet frames. It returns the responses observed at the link layer, which is ideal for tasks like ARP-like exchanges or custom Ethernet payloads. The other options don’t fit this Layer 2 focus. sr and sr1 operate mainly at Layer 3 (IP layer) by default and handle IP/TCP/UDP-style interactions, though you can still include Ether() but they’re not dedicated to Layer 2. The option that looks like a typical function name but isn’t a Scapy function here isn’t applicable.

Focusing on how Scapy handles packet sending at different OSI layers clarifies this. To work directly with link-layer frames (Layer 2), you craft Ethernet headers and send/receive those frames as a unit. The function designed for exactly that is srp, which sends and receives packets at Layer 2, letting you specify the Ether() header (or other L2 constructs) and operate on raw Ethernet frames. It returns the responses observed at the link layer, which is ideal for tasks like ARP-like exchanges or custom Ethernet payloads.

The other options don’t fit this Layer 2 focus. sr and sr1 operate mainly at Layer 3 (IP layer) by default and handle IP/TCP/UDP-style interactions, though you can still include Ether() but they’re not dedicated to Layer 2. The option that looks like a typical function name but isn’t a Scapy function here isn’t applicable.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy