Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code in Linux, Scapy, and byobu. I am not sure how to use them together. Please help! . Task 2 - Building a Packet

Please code in Linux, Scapy, and byobu. I am not sure how to use them together. Please help!

image text in transcribed

image text in transcribed

. Task 2 - Building a Packet Scapy provides some awesome tools for packet creation. Let's look at a few of them: 150 list available layers OR info on a given layer name - example: 1s(IP) Isco list available scapy commands IPO create an IP packet layer TCPO create TCP packet layers UDPO) create UDP packet layers show summary So let's make a packet! For this example we will be creating a simple DNS query. There are a good number of steps so follow along and feel free to play around (we aren't sending these packets anywhere yet, we're just playing). 1. First let's create an IP packet with just IPO. In scapy: ofp = IPO ofp.showO NOTE: ofp is just a variable name we chose Provide screenshot of output 2. Let's make this IP more useful for our test DNS case and give it a destination of a google nameserver such as 8.8.8.8 ofp = IP(dst="8.8.8.8") ofp.show Provide screenshot of output Now we are getting somewhere. But there isn't much in an IP packet itself besides source and destination addresses. We can check what needs to go in the IP section with ls(IP). Provide screenshot of what needs to be in the IP section of a packet. 3. Now let's get to some of the good stuff. In order to get our DNS request to the server we need to add a UDP layer. Why do we need to add a UDP layer? Adding a UDP layer in scapy is done using the following: ofudp = ofp/UDPO OR ofudp=IP(dst="8.8.8.8")/UDPO Here we have created a new packet from the IP layer contained in ofp and the UDPO) scapy command. Let's look at our two packets now: ofp.showo ofudp.showo Provide screenshot of output 4. Looking good so far, but we're missing all of the DNS data in the UDP datagram. Luckily scapy has a library for this too: ofdnsp=ofudp/DNSO ofdnsp.showo Provide screenshot of output We're almost there, but notice the DNSO packet we just created is an empty shell of the DNS UDP datagram. To fill that out we need to enter the necessary information into the scapy DNSO field ofdnsp=ofudp/DNS(Id=1,qd=DNSQR(qname="www.google.com")) Before sending we should look at our packet to make sure that it has all of the correct data (or at least to make sure there is something new since the last time) ofdnsp.show Provide screenshot of output . Task 2 - Building a Packet Scapy provides some awesome tools for packet creation. Let's look at a few of them: 150 list available layers OR info on a given layer name - example: 1s(IP) Isco list available scapy commands IPO create an IP packet layer TCPO create TCP packet layers UDPO) create UDP packet layers show summary So let's make a packet! For this example we will be creating a simple DNS query. There are a good number of steps so follow along and feel free to play around (we aren't sending these packets anywhere yet, we're just playing). 1. First let's create an IP packet with just IPO. In scapy: ofp = IPO ofp.showO NOTE: ofp is just a variable name we chose Provide screenshot of output 2. Let's make this IP more useful for our test DNS case and give it a destination of a google nameserver such as 8.8.8.8 ofp = IP(dst="8.8.8.8") ofp.show Provide screenshot of output Now we are getting somewhere. But there isn't much in an IP packet itself besides source and destination addresses. We can check what needs to go in the IP section with ls(IP). Provide screenshot of what needs to be in the IP section of a packet. 3. Now let's get to some of the good stuff. In order to get our DNS request to the server we need to add a UDP layer. Why do we need to add a UDP layer? Adding a UDP layer in scapy is done using the following: ofudp = ofp/UDPO OR ofudp=IP(dst="8.8.8.8")/UDPO Here we have created a new packet from the IP layer contained in ofp and the UDPO) scapy command. Let's look at our two packets now: ofp.showo ofudp.showo Provide screenshot of output 4. Looking good so far, but we're missing all of the DNS data in the UDP datagram. Luckily scapy has a library for this too: ofdnsp=ofudp/DNSO ofdnsp.showo Provide screenshot of output We're almost there, but notice the DNSO packet we just created is an empty shell of the DNS UDP datagram. To fill that out we need to enter the necessary information into the scapy DNSO field ofdnsp=ofudp/DNS(Id=1,qd=DNSQR(qname="www.google.com")) Before sending we should look at our packet to make sure that it has all of the correct data (or at least to make sure there is something new since the last time) ofdnsp.show Provide screenshot of output

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

Is all Internet training the same? Explain.

Answered: 1 week ago

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago