Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the variable \"THRESH\" used for? Explain in detail. def findAttack(pcap

ID: 3741831 • Letter: W

Question

What is the variable "THRESH" used for? Explain in detail.

def findAttack(pcap): pktCount- for (ts, buf) in pcap: try: eth dpkt.ethernet.Ethernet (buf) p eth.data src = socket . inet_ntoa(ip. src) dst socket.inet ntoa(ip.dst) tcp- p.data dport tcp.dport f dport 88 stream-src:'dst if pktCount.has_key (stream): else: pktCount[stream]-1 except: pass for strean in pktCount: pktssent - pktcount(stream if pktsSent > THRESH: sre-stream.split)te] dst stream. split(1] print+ src+ attacked +dst+ with str(pktsSent) pkts.

Explanation / Answer

THRESH here is a constant which holds the threshold limit for the number of packets send.

according to the program logic if the pktsSent exceeds the Threshold limit it Splits the stream to determine the source and destination.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote