Преглед изворни кода

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]