From b222aa6ee5a7d2cf1e0742ceb5241c3aaf6f7c98 Mon Sep 17 00:00:00 2001 From: Mayank Raj <60442308+mayank922@users.noreply.github.com> Date: Thu, 6 May 2021 18:24:47 +0530 Subject: [PATCH] update The problem is when we open a file and start reading from it, the position of file dose not get reset until I close it. So we have to open can close the file multiple time or we have to move to beginning of the file as we are passing the file to multiple functions --- chapter04/find_ddos.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chapter04/find_ddos.py b/chapter04/find_ddos.py index ef864dc..1f38ad2 100644 --- a/chapter04/find_ddos.py +++ b/chapter04/find_ddos.py @@ -92,5 +92,10 @@ def find_attack(pcap): with open(pcap_file, 'rb') as file: _pcap = dpkt.pcap.Reader(file) find_download(_pcap) + with open(pcap_file, 'rb') as file: + _pcap = dpkt.pcap.Reader(file) find_hivemind(_pcap) + + with open(pcap_file, 'rb') as file: + _pcap = dpkt.pcap.Reader(file) find_attack(_pcap)