Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The goal of this assignment is to generate a . pcap file containing 1 2 packets based on the given . pcap in given picture

The goal of this assignment is to generate a .pcap file containing 12 packets based on the given .pcap in given picture You must use Scapy in Python to
construct and append each packet, then write the full set of packets to a .pcap file that can be analyzed using TShark or Wireshark. The .pcap file that you
generate must contain the same number of packets in the same order with identical fields, identical values for each field (including payloads where necessary) and
identical timestamps for each packet as seen in the .pcap file that you were given in the picture And one of the
9
packets will be DNS
which is either TCP
/
UDP To be clear, you should NOT simply duplicate or copy packets from the existing pcap file. Your code must programmatically construct new packets, starting from the Ethernet layer and building up through TCP/UDP/DNS... similar to the sample example shown in the provided document. This approach is required to demonstrate your understanding of how to build valid network packets. The following is a sample example of how to use Scapy to generate a .pcap file with a single packet.
# Import Scapy
from scapy.all import Ether, IPv6, UDP, rdpcap, wrpcap
# Create a new packet stacked with Ether, IPv6, UDP, and a payload
packet = Ether(src='...', dst='...')
/IPv6(src='...', dst='...')
/UDP(sport=53, dport=80)
# Write the .pcap file
wrpcap('.pcap', packet)
Use ls() to list all the available layers and ls(IP) to list all the available fields for the IP layer. For instance:
# List available Scapy layers
ls()
# Sample output
Layer2 :: Ether, Dot3, LLC, SNAP
Layer3 :: IP, IPerror, IPy, GRE
Transport :: TCP, UDP
Packet :: Packet, bind_layers code in python
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

What is a virtual private network? Why is it called virtual?

Answered: 1 week ago