As a senior Analyst, help Mr. Tamer El-Gayar in identifying the hidden message left by the attackers before the operation happens.

Overview

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.


Phase 1 — Explore the Data & Look for Inconsistencies

What to do (explanation only)

Key Insight: Normal enterprise traffic follows statistical relationships (e.g., more packets → more bytes, higher request rate → lower latency). The anomalies break these patterns.

Code snippet — load & engineer features

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)

Phase 2 — Detect Anomalies with Machine Learning

What to do (explanation only)

This step surfaces ~60 most suspicious records out of 5,000. The attacker’s activity is hidden among them.

Code snippet — anomaly detection