Explorar el Código

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

Stefan Schmidt hace 6 años
padre
commit
a7c1534a3d
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  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: