Return timestamps of each representation
@@ -73,10 +73,13 @@ class OneLayerModel:
# Read the capture into a feature array
X = []
+ timestamps = []
binned_sessions = sessionizer(filepath, duration=self.duration)
for session_dict in binned_sessions:
feature_list = extract_features(session_dict)
X.append(feature_list)
+ last_packet = list(session_dict.items())[-1]
+ timestamps.append(last_packet[1][0][0])
full_features = np.stack(X)
# Mean normalize the features
@@ -88,7 +91,7 @@ class OneLayerModel:
timestamp = last_packet[1][0][0]
source_ip = last_packet[0][0].split(':')[0]
- return features, source_ip, timestamp
+ return features, source_ip, timestamps
def train(self, data_dir):
@@ -198,6 +201,7 @@ class OneLayerModel:
)
if mean:
representation = np.mean(representation, axis=0)
+ timestamp = timestamp[-1]
return representation, source_ip, timestamp
