Modify the script to: 1. Print the FTP username and password. Hint: pkt load will provide protocol payload data. 2. Print the number of packets with port 21 in the entire packet capture. 。 Should match Wireshark 'Displayed count' when filtering is set to 'ftp'. TASK 01: 1. Print the number of bytes transferred (hint: count the application layer bytes passed over the ftp-- data port) 2. Print the port(s) used for the ftp--data transfer (this should work for any passive mode FTP transfer). In other words, the port output by your script should support the Wireshark filter 'tcp.port port you identify'. 3. Print any FTP modes used during the connection 4. Print the number of non--FTP packets TASK 02: Use the Scapy module to conduct a traceroute on a list of domain names that are provide in a text file or on the command line. The traceroute should then be graphed. 123456 # Name: your name here 3 import sys from scapy.all import * 6 try: 7 path = sys.argv[1] 8961 10 8 except: print "ERROR: need path to pcap file" sys.exit(0) if (pkt.dport == 21 or pkt.sport == 21) and pkt.haslayer(Raw): print pkt.show() 11 12 packets = rdpcap(path) 13 =26762222222 14 15 for pkt in packets: try: 16 17 18 19 20 21 23 24 # add code here to do assignment # at this point you should ONLY have FTP packets except Exception, e: # no packet found with port 21 # comment out this line and replace with 'pass' if too much data print "BAD: ", e 25 # at the end print how many ftp packets were found

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I am struggling to create the code required for this assignment. I am providing the template that has been given as most of my drafts are promising but not quite there. I'm still learning Python so I'd really like to learn how one would take on this assignment as it'll be much better insight than scrambling everywhere.. Especially with the scrapy part. Ultimately, I am then launching this script in a Kali terminal with the command 'python3 <filename> <filetoanalyze>'

Modify the script to:
1. Print the FTP username and password.
Hint: pkt load will provide protocol payload data.
2. Print the number of packets with port 21 in the entire packet capture.
。 Should match Wireshark 'Displayed count' when filtering is
set to 'ftp'.
TASK 01:
1. Print the number of bytes transferred
(hint: count the application layer bytes passed over the ftp--
data port)
2. Print the port(s) used for the ftp--data transfer (this should work for any
passive mode FTP transfer). In other words, the port output by your
script should support the Wireshark filter 'tcp.port
port you identify'.
3. Print any FTP modes used during the connection
4. Print the number of non--FTP packets
TASK 02:
Use the Scapy module to conduct a traceroute on a list of domain names that
are provide in a text file or on the command line. The traceroute should then
be graphed.
Transcribed Image Text:Modify the script to: 1. Print the FTP username and password. Hint: pkt load will provide protocol payload data. 2. Print the number of packets with port 21 in the entire packet capture. 。 Should match Wireshark 'Displayed count' when filtering is set to 'ftp'. TASK 01: 1. Print the number of bytes transferred (hint: count the application layer bytes passed over the ftp-- data port) 2. Print the port(s) used for the ftp--data transfer (this should work for any passive mode FTP transfer). In other words, the port output by your script should support the Wireshark filter 'tcp.port port you identify'. 3. Print any FTP modes used during the connection 4. Print the number of non--FTP packets TASK 02: Use the Scapy module to conduct a traceroute on a list of domain names that are provide in a text file or on the command line. The traceroute should then be graphed.
123456
# Name: your name here
3 import sys
from scapy.all import *
6 try:
7
path =
sys.argv[1]
8961
10
8 except:
print "ERROR: need path to pcap file"
sys.exit(0)
if (pkt.dport
==
21 or pkt.sport ==
21) and pkt.haslayer(Raw):
print pkt.show()
11
12 packets
=
rdpcap(path)
13
=26762222222
14
15
for pkt in packets:
try:
16
17
18
19
20
21
23
24
# add code here to do assignment
# at this point you should ONLY have FTP packets
except Exception, e:
# no packet found with port 21
# comment out this line and replace with 'pass' if too much data
print "BAD: ", e
25 # at the end print how many ftp packets were found
Transcribed Image Text:123456 # Name: your name here 3 import sys from scapy.all import * 6 try: 7 path = sys.argv[1] 8961 10 8 except: print "ERROR: need path to pcap file" sys.exit(0) if (pkt.dport == 21 or pkt.sport == 21) and pkt.haslayer(Raw): print pkt.show() 11 12 packets = rdpcap(path) 13 =26762222222 14 15 for pkt in packets: try: 16 17 18 19 20 21 23 24 # add code here to do assignment # at this point you should ONLY have FTP packets except Exception, e: # no packet found with port 21 # comment out this line and replace with 'pass' if too much data print "BAD: ", e 25 # at the end print how many ftp packets were found
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education