瀏覽代碼

Fix: off-by-one errors in the portscan-attack resulted in only 891 scanned ports

Stefan Schmidt 6 年之前
父節點
當前提交
7623da5c33
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      code/Attack/PortscanAttack.py

+ 2 - 2
code/Attack/PortscanAttack.py

@@ -98,8 +98,8 @@ class PortscanAttack(BaseAttack.BaseAttack):
         if (ports_num == 1000):  # used for port.dst
             temp_array = [[0 for i in range(10)] for i in range(100)]
             port_dst_shuffled = []
-            for count in range(0, 9):
-                temp_array[count] = ports_dst[count * 100:count * 100 + 99]
+            for count in range(0, 10):
+                temp_array[count] = ports_dst[count * 100:(count + 1) * 100]
                 shuffle(temp_array[count])
                 port_dst_shuffled += temp_array[count]
         else:  # used for port.open