In line 161:
packet_direction = []
feature_result = extract(label_pcap)
for key in feature_result.keys():
value = feature_result[key]
packet_direction = [x // abs(x) for x in value.ip_lengths]
if len(packet_direction) == len(packets):
.....
It seems packet_direction is supposed to be a list that stores the direction sequence for every session in the input pcap.
However, inside the for loop over sessions the anonymous function packet_direction = [x // abs(x) for x in value.ip_lengths] overwrites packet_direction each time, so only the last session’s direction sequence is kept.
This makes the data processing impossible to work correctly if len(packet_direction) == len(packets) — can this code really reproduce the results correctly?
In line 161:
It seems
packet_directionis supposed to be a list that stores the direction sequence for every session in the input pcap.However, inside the for loop over sessions the anonymous function
packet_direction = [x // abs(x) for x in value.ip_lengths]overwrites packet_direction each time, so only the last session’s direction sequence is kept.This makes the data processing impossible to work correctly
if len(packet_direction) == len(packets)— can this code really reproduce the results correctly?