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.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.