|
@@ -353,6 +353,15 @@ class BaseAttack(metaclass=ABCMeta):
|
|
|
# e.g. inject.at-timestamp=123456 -> is changed to: 123456.[random digits]
|
|
|
if param_name == Parameter.INJECT_AT_TIMESTAMP and is_valid and ((value - int(value)) == 0):
|
|
|
value = value + random.uniform(0, 0.999999)
|
|
|
+ # first packet of a pcap displays a timestamp of zero, but internally (usually) has a much larger one
|
|
|
+ # inject.at-timestamp has to be shifted by the value of the first packet of the input pcap
|
|
|
+ # otherwise new packets are always injected at the beginning and there is a large distance
|
|
|
+ # to the packets of the input pcap
|
|
|
+ if param_name == Parameter.INJECT_AT_TIMESTAMP and is_valid:
|
|
|
+ ts_first_pkt = pr.pcap_processor(self.statistics.pcap_filepath, "False").get_timestamp_mu_sec(1)
|
|
|
+ if ts_first_pkt >= 0:
|
|
|
+ is_valid = True
|
|
|
+ value = value + (ts_first_pkt / 1000000) # convert microseconds from getTimestampMuSec into seconds
|
|
|
elif param_type == ParameterTypes.TYPE_TIMESTAMP:
|
|
|
is_valid = self._is_timestamp(value)
|
|
|
elif param_type == ParameterTypes.TYPE_BOOLEAN:
|