ソースを参照

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]