As a senior Analyst, help Mr. Tamer El-Gayar in identifying the hidden message left by the attackers before the operation happens.
You’re given a network activity dataset (logs.csv) from El-Gayar Inc. The company suspects a stealthy APT attacker has embedded hidden communications in the traffic. Your job is to detect the anomalies, extract the embedded signal, and reconstruct the attacker’s hidden message — the flag.
logs.csv) and parse timestamps.bytes_up, bytes_down, req_rate, latency_ms, error_rate, packets, etc.bytes_ratio = bytes_up / bytes_downbytes_per_packet = (bytes_up + bytes_down) / packetslatency_per_req = latency_ms / req_rateKey Insight: Normal enterprise traffic follows statistical relationships (e.g., more packets → more bytes, higher request rate → lower latency). The anomalies break these patterns.
import pandas as pd
# Load and sort by time
df = pd.read_csv("logs.csv", parse_dates=["ts"])
df = df.sort_values("ts").reset_index(drop=True)
# Derived metrics
total_bytes = df["bytes_up"] + df["bytes_down"]
bytes_ratio = df["bytes_up"] / (df["bytes_down"] + 1e-9)
bytes_per_packet = total_bytes / (df["packets"] + 1e-9)
latency_per_req = df["latency_ms"] / (df["req_rate"] + 1e-9)
This step surfaces ~60 most suspicious records out of 5,000. The attacker’s activity is hidden among them.