# You may NOT alter the import list!!!!
import pyshark
import hashlib
class MITMException(Exception):
“””A class to throw if you come across incorrect syntax or other issues”””
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class MITMProject(object):
def __init__(self):
self.cap = pyshark.FileCapture(‘TCP.reflection_fall2023.pcap’)
self.class_id = “CS60353257”
# TODO: Change this to YOUR Georgia Tech ID!!!
# This is your 9-digit Georgia Tech ID
self.student_id = ‘900000000’
def get_student_hash(self, value):
return hashlib.sha256(self.student_id.encode(‘UTF-8’) + self.class_id + value).hexdigest()
# Task 1: Return n being:
# n = Number of packets with only SYN+ACK flags
def syn_ack(self):
# TODO: Implement me
# Task 2: Return n being:
# n = Number of packets with only RST flag
def rst(self):
# TODO: Implement me
# Task 3: Return d,p, being:
# d = IP Address of the victim
# p = Port being attacked
def victim_ip_port(self):
# TODO: Implement me
return d,p
if __name__ == ‘__main__’:
pcap_analysis = MITMProject()
ip,port = pcap_analysis.victim_ip_port()
synack = pcap_analysis.syn_ack()
rst = pcap_analysis.rst()
print(“IP and Port: “,ip,port)
print(“Number of SYN+ACK Packets : “, synack)
print(“Number of RST Packets : “, rst)