Преглед на файлове

Fix: consistent use of deque

dustin.born преди 7 години
родител
ревизия
60f891c8f7
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3 3
      code/Attack/MembersMgmtCommAttack.py

+ 3 - 3
code/Attack/MembersMgmtCommAttack.py

@@ -105,12 +105,12 @@ class MembersMgmtCommAttack(BaseAttack.BaseAttack):
                 self.attack_start_utime = packets[0].time
             elif total_pkts % BUFFER_SIZE == 0: # every 1000 packets write them to the pcap file (append)
                 last_packet = packets[-1]
-                #packets = sorted(packets, key=lambda pkt: pkt.time)	# not necessary yet
+                packets = list(packets)
                 path_attack_pcap = self.write_attack_pcap(packets, True, path_attack_pcap)
-                packets = []
+                packets = deque(maxlen=BUFFER_SIZE)
 
         if len(packets) > 0:
-            #packets = sorted(packets, key=lambda pkt: pkt.time)	# not necessary yet
+            packets = list(packets)
             path_attack_pcap = self.write_attack_pcap(packets, True, path_attack_pcap)
             last_packet = packets[-1]