瀏覽代碼

BaseAttack.add_param_value: Throw exception when statistics object is missing and TYPE_PACKET_POSITION is used

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

+ 2 - 2
code/Attack/BaseAttack.py

@@ -414,8 +414,8 @@ class BaseAttack(metaclass=abc.ABCMeta):
         elif param_type == atkParam.ParameterTypes.TYPE_PACKET_POSITION:
             # This function call is valid only if there is a statistics object available.
             if self.statistics is None:
-                print('Error: Statistics-dependent attack parameter added without setting a statistics object first.')
-                exit(1)
+                raise RuntimeError(
+                    'Error: Statistics-dependent attack parameter added without setting a statistics object first.')
 
             ts = pr.pcap_processor(self.statistics.pcap_filepath, "False", Util.RESOURCE_DIR).get_timestamp_mu_sec(int(value))
             if 0 <= int(value) <= self.statistics.get_packet_count() and ts >= 0: