|
1 | 1 | # Zeek Summarizer |
2 | 2 |
|
3 | | -**Zeek Summarizer** is a command-line tool to analyze and summarize Zeek log files. It supports connection logs, DNS, HTTP, and SSL/TLS logs and provides global statistics as well as detailed per-IP or per-port summaries. |
| 3 | +`zeek-summarizer` digests a full Zeek log directory (plain TSV or JSON, compressed or not) and produces: |
4 | 4 |
|
5 | | -## 🔧 Installation |
| 5 | +- Global statistics for connections, DNS, HTTP, TLS/SSL, SMB, and SMTP activity. |
| 6 | +- Rich per-host drill downs (protocol mix, ports, DNS/HTTP targets, TLS issuers, SMB shares, SMTP senders/recipients, etc.). |
| 7 | +- Optional per-port view to see which services are most active or targeted. |
| 8 | +- Export to JSON or a self-contained HTML dashboard with interactive charts, search, and filters. |
| 9 | + |
| 10 | +The screenshot above shows the dashboard cards that highlight the busiest DNS queries and HTTP hosts in a capture. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## 1. Requirements |
| 15 | + |
| 16 | +- Python 3.10+ (tested with 3.11/3.12/3.13) |
| 17 | +- Zeek logs on disk (e.g. `conn.log`, `dns.log`, `http.log`, `ssl.log`, `smtp.log`) |
| 18 | +- Packages listed in `requirements.txt` |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## 2. Installation |
6 | 23 |
|
7 | 24 | ```bash |
8 | | -git clone https://github.com/stratosphereips/zeek-summarizing.git |
| 25 | +# Clone the repository |
| 26 | +git clone https://github.com/stratosphereips/zeek-summarizer.git |
9 | 27 | cd zeek-summarizer |
| 28 | + |
| 29 | +# Create and activate a virtual environment |
10 | 30 | python3 -m venv venv |
11 | 31 | source venv/bin/activate |
| 32 | + |
| 33 | +# Install dependencies |
| 34 | +pip install --upgrade pip |
12 | 35 | pip install -r requirements.txt |
13 | 36 | ``` |
14 | 37 |
|
15 | | -## 📦 Requirements |
| 38 | +To leave the environment later, run `deactivate`. |
16 | 39 |
|
17 | | -See `requirements.txt`. |
| 40 | +--- |
18 | 41 |
|
19 | | -## 🚀 Usage |
| 42 | +## 3. Quick Start (text summary) |
20 | 43 |
|
21 | 44 | ```bash |
22 | | -python zeek-summarizer.py -d <zeek_log_directory> [options] |
| 45 | +./zeek-summarizer.sh -d /path/to/zeek/logs |
| 46 | +# or python venv/bin/python zeek-summarizer.py -d /path/to/zeek/logs |
23 | 47 | ``` |
24 | 48 |
|
25 | | -### Options: |
| 49 | +Useful CLI flags: |
26 | 50 |
|
27 | | -- `-d, --directory` (**required**): Path to the directory containing Zeek logs. |
28 | | -- `-r, --require-activity`: Show only IPs that appear in non-conn logs. |
29 | | -- `-o, --only-conn`: Show only IPs that appear only in conn logs. |
30 | | -- `-p, --per-port`: Show summary per port instead of per IP. |
31 | | -- `--debug`: Show debug information for internal operations. |
| 51 | +| Flag | Description | |
| 52 | +| --- | --- | |
| 53 | +| `-d DIR` | Directory containing Zeek logs (supports rotated `*.log*` and `*.log.gz`). | |
| 54 | +| `-r`, `--require-activity` | Only list hosts that appear in non-`conn` logs. | |
| 55 | +| `-o`, `--only-conn` | Only list hosts that have `conn` activity and nothing else. | |
| 56 | +| `-p`, `--per-port` | Switch to per-port aggregated view. | |
| 57 | +| `--local-only` | Keep statistics for private/local IPs only (v4/v6). | |
| 58 | +| `--output-format {text,json,html}` | Choose output renderer (default `text`). | |
| 59 | +| `--output-file PATH` | Write JSON/HTML to file instead of STDOUT (ignored for `text`). | |
32 | 60 |
|
33 | | -## Screenshots |
| 61 | +The helper script `zeek-summarizer.sh` simply activates the bundled `venv/` and forwards every argument to the Python entry point (`"$@"`). |
34 | 62 |
|
35 | | - |
| 63 | +--- |
36 | 64 |
|
37 | | - |
| 65 | +## 4. Generate the interactive dashboard |
38 | 66 |
|
| 67 | +```bash |
| 68 | +./zeek-summarizer.sh -d /path/to/zeek/logs \ |
| 69 | + --output-format html \ |
| 70 | + --output-file zeek-dashboard.html |
39 | 71 |
|
40 | | -## 📊 Examples |
| 72 | +# Open the report locally (macOS example) |
| 73 | +open zeek-dashboard.html |
| 74 | +``` |
41 | 75 |
|
42 | | -### Basic usage |
| 76 | +The HTML uses embedded data: no web server or backend required. Charts cover protocol mix, top DNS/HTTP targets, port targeting, SMTP TLS usage, and SMTP error codes. The search bar and filters let you jump straight to local hosts, specific /24 or /64 networks, or hosts that triggered non-connection logs. |
43 | 77 |
|
44 | | -```bash |
45 | | -python zeek-summarizer.py -d ./logs |
46 | | -``` |
| 78 | +--- |
47 | 79 |
|
48 | | -### Only show IPs that have non-connection activity: |
| 80 | +## 5. Export machine-readable JSON |
49 | 81 |
|
50 | 82 | ```bash |
51 | | -python zeek-summarizer.py -d ./logs -r |
| 83 | +./zeek-summarizer.sh -d /path/to/zeek/logs \ |
| 84 | + --output-format json \ |
| 85 | + --output-file zeek-summary.json |
52 | 86 | ``` |
53 | 87 |
|
54 | | -### Show per-port summary: |
| 88 | +Each host entry includes counters for protocols, flows, DNS queries, HTTP hosts, TLS issuers/subjects, SMB shares, SMTP metadata, and port usage. The `global` section mirrors the top cards in the dashboard. |
55 | 89 |
|
56 | | -```bash |
57 | | -python zeek-summarizer.py -d ./logs -p |
58 | | -``` |
| 90 | +--- |
59 | 91 |
|
60 | | -### Show only connection logs and debug info: |
| 92 | +## 6. Example workflows |
61 | 93 |
|
62 | 94 | ```bash |
63 | | -python zeek-summarizer.py -d ./logs -o --debug |
| 95 | +# Baseline summary (text) |
| 96 | +./zeek-summarizer.sh -d ./sample-logs |
| 97 | + |
| 98 | +# Focus on local assets that touched non-connection logs |
| 99 | +./zeek-summarizer.sh -d ./sample-logs -r --local-only |
| 100 | + |
| 101 | +# Investigate service exposure (per-port view) |
| 102 | +./zeek-summarizer.sh -d ./sample-logs -p |
| 103 | + |
| 104 | +# Produce HTML and JSON in one go |
| 105 | +./zeek-summarizer.sh -d ./sample-logs --output-format html --output-file report.html |
| 106 | +./zeek-summarizer.sh -d ./sample-logs --output-format json --output-file report.json |
64 | 107 | ``` |
65 | 108 |
|
66 | | -## 📁 Supported Logs |
| 109 | +--- |
| 110 | + |
| 111 | +## 7. Supported log families |
67 | 112 |
|
68 | 113 | - `conn.log` |
69 | 114 | - `dns.log` |
70 | 115 | - `http.log` |
71 | 116 | - `ssl.log` |
| 117 | +- `smb_mapping.log` |
| 118 | +- `smtp.log` |
72 | 119 |
|
73 | | -Logs may be compressed with `.gz` and can use rotated filenames like `conn.01:00:00-02:00:00.log.gz`. |
| 120 | +The parser accepts TSV (default Zeek format) and JSON, with optional `.gz` compression and rotated filenames such as `dns.2024-10-05-00-00-00.log.gz`. |
74 | 121 |
|
75 | 122 | --- |
76 | 123 |
|
77 | | -Created with ❤️ for Zeek network traffic analysis. |
| 124 | +Made with ❤️ for network defenders who want fast situational awareness from Zeek captures. |
0 commit comments