fairwire-network-traffic 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +213 -2
- package/bin/fairwire-network-traffic.js +7 -0
- package/evals/cases.json +337 -0
- package/fixtures/README.md +6 -0
- package/fixtures/flows.csv +38 -0
- package/fixtures/intl/README.md +12 -0
- package/fixtures/intl/de/flows.csv +38 -0
- package/fixtures/intl/ja/flows.csv +38 -0
- package/fixtures/settings.json +4 -0
- package/package.json +57 -4
- package/server.json +37 -0
- package/src/demo.js +19 -0
- package/src/index.js +2 -0
- package/src/logic.js +118 -0
- package/src/manifest.js +35 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kurt Francisco
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,214 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Fairwire Network Traffic
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Network flow review from a NetFlow, IPFIX or sFlow export: cleartext protocols, risky ports reached from the internet, one host or destination taking most of the bytes, large uploads out of hours and very small packets. Writes a worklist and drafts a change request a network owner applies.
|
|
4
|
+
|
|
5
|
+
Part of **Fairwire**, the IT and network family of [Mythos Machines](https://fair-agents.com) agents. The software is free (MIT); you pay a fixed price for the setup on your files. It reads files your IT team exports, on your own computer, and drafts notes. Every change to a live device, firewall, DNS zone, directory or cloud account stays one named person's click.
|
|
6
|
+
|
|
7
|
+
## What it checks
|
|
8
|
+
|
|
9
|
+
| Finding | What it means |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `inbound_risky_port` | An address on the internet reached an inside host on a port that should rarely be open to the internet (RDP, SMB, Telnet, databases and the like). |
|
|
12
|
+
| `cleartext_protocol` | Traffic between an inside host and the internet on a protocol that sends data without encryption (Telnet, FTP and POP3 are high; HTTP, IMAP, SNMP and LDAP are medium). |
|
|
13
|
+
| `large_upload_after_hours` | An inside host sent more than your limit to one outside address outside business hours. |
|
|
14
|
+
| `possible_port_scan` | One address tried many different ports on one host with tiny flows. |
|
|
15
|
+
| `top_talker_share` | One inside host carried more than your share of all bytes. |
|
|
16
|
+
| `top_destination_share` | One outside address received more than your share of all bytes sent out. |
|
|
17
|
+
| `small_packets` | A host's flows average very small packets over many packets (chatty traffic worth batching, or probing). |
|
|
18
|
+
|
|
19
|
+
Findings come back worst first (high, medium, low). A finding a named person has reviewed can be accepted as known, with a reason and a date to look again; it then moves to "Accepted as known" instead of counting as open.
|
|
20
|
+
|
|
21
|
+
## Settings
|
|
22
|
+
|
|
23
|
+
Pass a settings file with `settings`. Every setting is optional; a misspelt setting is refused by name.
|
|
24
|
+
|
|
25
|
+
| Setting | What it does |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `internal_cidrs` | Your inside address ranges (default: private ranges such as 10.0.0.0/8) |
|
|
28
|
+
| `risky_ports` | Ports that should not be reachable from the internet (default: RDP, SMB, Telnet, databases and others) |
|
|
29
|
+
| `allowed_inbound` | Inside host:port pairs that are meant to be open, e.g. "10.0.5.10:3389" for a published gateway |
|
|
30
|
+
| `business_hours` | First and last hour of the working day, e.g. [7, 19] (default) |
|
|
31
|
+
| `large_upload_bytes` | Bytes to one outside address out of hours that count as a large upload (default 500000000) |
|
|
32
|
+
| `top_share_pct` | Share of all bytes above which one host or destination is flagged (default 40) |
|
|
33
|
+
| `share_min_hosts` | Inside hosts (or outside destinations) the export must hold before one of them carrying most of the bytes is flagged (default 5; with fewer, one host always dominates) |
|
|
34
|
+
| `small_packet_bytes` | Average packet size under which a host is flagged (default 100) |
|
|
35
|
+
| `min_packets` | Packets a host needs before the small-packet check applies (default 1000) |
|
|
36
|
+
| `scan_ports` | Distinct ports one source tries on one host before it counts as a possible scan (default 20) |
|
|
37
|
+
|
|
38
|
+
## What it never does
|
|
39
|
+
|
|
40
|
+
- `firewall_block_address` is refused: Fairwire Network Traffic never blocks an address or changes a firewall; the network owner does.
|
|
41
|
+
- `switch_shutdown_port` is refused: Fairwire Network Traffic never shuts a switch port or isolates a host.
|
|
42
|
+
- `traffic_request_submit` waits for one named person's click, even in Auto (`production_deploy`).
|
|
43
|
+
- `traffic_accept_learning` waits for one named person's click, even in Auto (`accept_learning`).
|
|
44
|
+
- `traffic_retire_memory` waits for one named person's click, even in Auto (`accept_learning`).
|
|
45
|
+
- `firewall_block_address` waits for one named person's click, even in Auto (`production_deploy`).
|
|
46
|
+
- `switch_shutdown_port` waits for one named person's click, even in Auto (`production_deploy`).
|
|
47
|
+
|
|
48
|
+
<!-- generated:start -->
|
|
49
|
+
|
|
50
|
+
## A demo run
|
|
51
|
+
|
|
52
|
+
`npx -y fairwire-network-traffic demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
Fairwire Network Traffic demo (fictional data) in a temporary folder, Auto on for the draft only
|
|
56
|
+
|
|
57
|
+
▶ Check the exported files
|
|
58
|
+
status: executed decision: allow
|
|
59
|
+
36 flow(s), 764 MB between 11 inside host(s) and 6 outside destination(s): 9 open finding(s), 4 high.
|
|
60
|
+
high cleartext_protocol 10.0.2.15
|
|
61
|
+
high inbound_risky_port 10.0.5.20
|
|
62
|
+
high inbound_risky_port 10.0.5.30
|
|
63
|
+
high large_upload_after_hours 10.0.3.50
|
|
64
|
+
medium cleartext_protocol 10.0.2.40
|
|
65
|
+
medium possible_port_scan 10.0.9.99
|
|
66
|
+
low small_packets 10.0.7.7
|
|
67
|
+
low top_destination_share 203.0.113.200
|
|
68
|
+
low top_talker_share 10.0.3.50
|
|
69
|
+
|
|
70
|
+
▶ Explain one finding
|
|
71
|
+
status: executed decision: allow
|
|
72
|
+
high large_upload_after_hours: 10.0.3.50 sent 700 MB to 203.0.113.200 outside business hours in 2 flow(s). Fix: Confirm with the host owner that this was a planned backup or sync; if not, treat it as a possible data leak.
|
|
73
|
+
low top_talker_share: 10.0.3.50 carried 94.2% of all bytes (720 MB of 764 MB). Fix: Check whether this host should be on its own link, scheduled off-peak or rate-limited.
|
|
74
|
+
|
|
75
|
+
▶ Write the worklist
|
|
76
|
+
status: executed decision: allow
|
|
77
|
+
Network flow review written: 36 flow(s), 764 MB between 11 inside host(s) and 6 outside destination(s): 9 open finding(s), 4 high.
|
|
78
|
+
|
|
79
|
+
▶ Draft the note for a person
|
|
80
|
+
status: executed decision: allow (auto)
|
|
81
|
+
change request 2026-11-18 drafted with 1 open marker(s) ([TO CONFIRM network change board]). Nothing was sent.
|
|
82
|
+
|
|
83
|
+
▶ Auto: approving it still waits for one named person
|
|
84
|
+
status: needs_approval decision: ask
|
|
85
|
+
reason: production_deploy stays one-click, even in Auto
|
|
86
|
+
|
|
87
|
+
▶ The agent tries to change the live system itself
|
|
88
|
+
status: blocked decision: block
|
|
89
|
+
reason: Fairwire Network Traffic never blocks an address or changes a firewall; the network owner does.
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Tools
|
|
93
|
+
|
|
94
|
+
| Tool | What it does | Policy |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `traffic_check` | Review the flow export and list findings worst first: inbound risky ports, cleartext protocols, out-of-hours uploads, scans, top talkers and small packets. | runs |
|
|
97
|
+
| `traffic_explain` | Everything found for one address. | runs |
|
|
98
|
+
| `traffic_write_report` | Write network-traffic.csv (one row per finding, with blank owner and decision columns) and network-traffic.html into out_dir (default fairwire-out/traffic). | runs |
|
|
99
|
+
| `traffic_draft_change_request` | Write drafts/change_request-<date>.md: the open findings at or above min_severity (default medium), each with what to do, addressed to network change board. | asks first (Auto can be opted in) |
|
|
100
|
+
| `traffic_request_submit` | After one named human click (even in Auto), record that the reviewed change request draft is approved in change_request-requests.csv. | one named click, even in Auto (`production_deploy`) |
|
|
101
|
+
| `traffic_recall` | Search this agent's own memory of the customer's setup: accepted facts (in use) and facts waiting for a person. | runs |
|
|
102
|
+
| `traffic_learn` | Propose one fact about the customer's setup for this agent to remember. | runs |
|
|
103
|
+
| `traffic_accept_learning` | A named person accepts or rejects a fact waiting in this agent's memory. | one named click, even in Auto (`accept_learning`) |
|
|
104
|
+
| `traffic_retire_memory` | A named person stops an accepted fact from applying. | one named click, even in Auto (`accept_learning`) |
|
|
105
|
+
| `firewall_block_address` | Fairwire Network Traffic never blocks an address or changes a firewall; the network owner does. | refused |
|
|
106
|
+
| `switch_shutdown_port` | Fairwire Network Traffic never shuts a switch port or isolates a host. | refused |
|
|
107
|
+
|
|
108
|
+
Any tool name not in this table is blocked, including names a model invents. `refused` tools are listed so a model can see they exist and are refused.
|
|
109
|
+
|
|
110
|
+
## Columns it reads
|
|
111
|
+
|
|
112
|
+
Table inputs can be CSV, TSV, semicolon- or pipe-separated text, Excel `.xlsx`, JSON or JSONL. Columns are matched by the agent's own name, then by the English names below, then by their names in German, French, Spanish, Portuguese, Italian, Japanese, Chinese and Korean. Dates become `YYYY-MM-DD`; amounts and counts are read with either decimal mark. Every result lists under `sources` how each file was read.
|
|
113
|
+
|
|
114
|
+
### Flow records (`flows`)
|
|
115
|
+
|
|
116
|
+
| Column | Type | Also read as | For example, in other languages |
|
|
117
|
+
|---|---|---|---|
|
|
118
|
+
| `src_ip` (required) | text | Source IP, Src IP, Src Addr, srcaddr, sa, Source Address | Quell-IP, IP source, 送信元IP, 源IP |
|
|
119
|
+
| `dst_ip` (required) | text | Destination IP, Dst IP, Dst Addr, dstaddr, da, Destination Address | Ziel-IP, IP destination, 宛先IP, 目的IP |
|
|
120
|
+
| `dst_port` | number | Destination Port, Dst Port, dstport, dp, DPort | Zielport, Port de destination, 宛先ポート, 目的端口 |
|
|
121
|
+
| `protocol` | text | Protocol, Proto, pr, IP Protocol, Application Protocol | Protokoll, Protocole, プロトコル, 协议 |
|
|
122
|
+
| `bytes` (required) | number | Bytes, Octets, ibyt, In Bytes, Total Bytes, byt | Bytes, Octets, バイト数, 字节数 |
|
|
123
|
+
| `packets` | number | Packets, Pkts, ipkt, In Packets, Packet Count | Pakete, Paquets, パケット数, 数据包数 |
|
|
124
|
+
| `start` | date and time | Start, First Seen, ts, Start Time, First Switched, Timestamp | Startzeit, Heure de début, 開始日時, 开始时间 |
|
|
125
|
+
| `src_host` | text | Source Host, Source Hostname, Src Name, Host | - |
|
|
126
|
+
|
|
127
|
+
### Files from other countries
|
|
128
|
+
|
|
129
|
+
A German export in Windows-1252 with semicolons, `1.234,56` and `03.11.2026`, or a Japanese one in Shift_JIS with `2026/11/03`, is read the same way as the English file. [`fixtures/intl/`](fixtures/intl) has both versions of the demo data, and the eval cases `intl-de-*` and `intl-ja-*` require the same results as the English case. Columns named differently? Run `npx fairwire-network-traffic inspect <file>` (names and shapes only, never values) and name them in `fairwire-sources.json`:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{ "files": { "exports/devices.csv": { "columns": { "host": "Gerätename" }, "date_order": "dmy" } } }
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Memory
|
|
136
|
+
|
|
137
|
+
fairwire-network-traffic can remember facts about your setup so the next run does not have to be told again. `traffic_learn` only proposes a fact; it changes nothing until a named person accepts it with `traffic_accept_learning`, which is one click even in Auto. Facts live in one hash-chained file per agent under `.fairwire/memory/`; if the chain does not verify, no fact is used. Credentials, personal identifiers and text that reads like instructions to an AI are refused. Run without memory with `--no-memory`.
|
|
138
|
+
|
|
139
|
+
| Kind | What an accepted fact changes |
|
|
140
|
+
|---|---|
|
|
141
|
+
| `known_exception` | that finding is listed under "Accepted as known" instead of as open, until review_by (when given) has passed. |
|
|
142
|
+
| `note` | nothing (shown by recall only) |
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
fairwire-network-traffic memory list
|
|
146
|
+
fairwire-network-traffic memory accept MEM-1a2b3c4d5e6f --as "Your Name"
|
|
147
|
+
fairwire-network-traffic memory retire MEM-1a2b3c4d5e6f --as "Your Name" --reason "rule removed"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Install
|
|
151
|
+
|
|
152
|
+
Node 20 or newer. No other dependencies.
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npx -y fairwire-network-traffic demo
|
|
156
|
+
npx -y fairwire-network-traffic mcp --root /path/to/your/files
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Claude Desktop, Cursor and other MCP hosts:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"mcpServers": {
|
|
164
|
+
"fairwire-network-traffic": {
|
|
165
|
+
"command": "npx",
|
|
166
|
+
"args": [
|
|
167
|
+
"-y",
|
|
168
|
+
"fairwire-network-traffic",
|
|
169
|
+
"mcp",
|
|
170
|
+
"--root",
|
|
171
|
+
"/path/to/your/files"
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Claude Code: `claude mcp add fairwire-network-traffic -- npx -y fairwire-network-traffic mcp --root .`, or install the `fairwire-network-traffic` plugin from this repository's marketplace.
|
|
179
|
+
|
|
180
|
+
## Modes and approvals
|
|
181
|
+
|
|
182
|
+
- **Review** (`--mode review`): reads and reports only.
|
|
183
|
+
- **Assist** (default): the policy above. A tool that asks returns an `approval_id`; a person approves it once with `fairwire-network-traffic approve <id> --as "Your Name"` (or on the local approvals page, `fairwire-network-traffic approvals`), and the same call is repeated.
|
|
184
|
+
- **Auto** (`--mode auto --auto <tool,...>`): opt-in per tool, with step caps and a kill switch (`fairwire-network-traffic kill`). Paying, sending, posting to a ledger or a live system and accepting a learned fact stay **one named click even in Auto**; an approval is tied to the sha256 of the reviewed draft, so a changed draft needs a new click.
|
|
185
|
+
|
|
186
|
+
## CLI
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
fairwire-network-traffic tools # every tool, its policy and arguments
|
|
190
|
+
fairwire-network-traffic sources # the columns each input is read from
|
|
191
|
+
fairwire-network-traffic inspect <file> # how a file would be read (names and shapes, never values)
|
|
192
|
+
fairwire-network-traffic call traffic_check '{"flows":"<flows>"}'
|
|
193
|
+
fairwire-network-traffic eval # the private eval cases on the fictional fixtures
|
|
194
|
+
fairwire-network-traffic demo
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Audit log and data
|
|
198
|
+
|
|
199
|
+
Every call is written to `.fairwire/audit.jsonl` under the root: hash-chained JSON lines, with arguments stored as a hash, signed with an Ed25519 key when you configure one. Everything runs on your machine on files you choose. No network calls, no telemetry, no credentials. The bundled fixtures are fictional.
|
|
200
|
+
|
|
201
|
+
<!-- generated:end -->
|
|
202
|
+
|
|
203
|
+
## Limits
|
|
204
|
+
|
|
205
|
+
- Reads only the files you export and give it. It does not log in to a firewall, switch, controller, cloud console, identity provider or any other live system.
|
|
206
|
+
- Flow data shows who talked to whom and how much, not what was said: a finding is a lead for a person to confirm, not proof of an attack or a leak.
|
|
207
|
+
- Inside and outside are decided by internal_cidrs (private ranges by default); NAT can hide the real inside host.
|
|
208
|
+
- Thresholds are working defaults in a settings file you control; they are not a vendor rule, a requirement of any standard or a security guarantee.
|
|
209
|
+
- It changes nothing on a live device, firewall, DNS zone, directory or cloud account. Every change it suggests is a draft that one named person applies.
|
|
210
|
+
- Export layouts were written from knowledge of common exports and have not been tested on live customer accounts. Run `inspect` on a new export and name columns in `fairwire-sources.json` when they differ.
|
|
211
|
+
|
|
212
|
+
## Licence
|
|
213
|
+
|
|
214
|
+
MIT. Fictional data only in `fixtures/`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { main } from 'fairwire-core';
|
|
4
|
+
import { manifest } from '../src/manifest.js';
|
|
5
|
+
import { demo } from '../src/demo.js';
|
|
6
|
+
|
|
7
|
+
main(manifest, { bin: 'fairwire-network-traffic', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
|
package/evals/cases.json
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
{
|
|
2
|
+
"suite": "fairwire-network-traffic",
|
|
3
|
+
"root": "..",
|
|
4
|
+
"data_note": "Fictional flows in documentation and private address ranges in ../fixtures. No model is called.",
|
|
5
|
+
"cases": [
|
|
6
|
+
{
|
|
7
|
+
"id": "check-totals",
|
|
8
|
+
"tool": "traffic_check",
|
|
9
|
+
"args": {
|
|
10
|
+
"flows": "fixtures/flows.csv",
|
|
11
|
+
"settings": "fixtures/settings.json"
|
|
12
|
+
},
|
|
13
|
+
"expect": {
|
|
14
|
+
"equals": {
|
|
15
|
+
"result.flows": 36,
|
|
16
|
+
"result.skipped_rows": 1,
|
|
17
|
+
"result.bytes": 764045520,
|
|
18
|
+
"result.inside_hosts": 11,
|
|
19
|
+
"result.outside_destinations": 6,
|
|
20
|
+
"result.open": 9,
|
|
21
|
+
"result.high": 4
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "every-planted-issue",
|
|
27
|
+
"tool": "traffic_check",
|
|
28
|
+
"args": {
|
|
29
|
+
"flows": "fixtures/flows.csv",
|
|
30
|
+
"settings": "fixtures/settings.json"
|
|
31
|
+
},
|
|
32
|
+
"expect": {
|
|
33
|
+
"contains": [
|
|
34
|
+
"inbound_risky_port",
|
|
35
|
+
"10.0.5.20:3389",
|
|
36
|
+
"10.0.5.30:445",
|
|
37
|
+
"cleartext_protocol",
|
|
38
|
+
"Telnet",
|
|
39
|
+
"large_upload_after_hours",
|
|
40
|
+
"700 MB",
|
|
41
|
+
"possible_port_scan",
|
|
42
|
+
"22 different ports",
|
|
43
|
+
"top_talker_share",
|
|
44
|
+
"top_destination_share",
|
|
45
|
+
"small_packets"
|
|
46
|
+
],
|
|
47
|
+
"not_contains": [
|
|
48
|
+
"10.0.5.10:3389"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "published-gateway-shows-without-settings",
|
|
54
|
+
"tool": "traffic_check",
|
|
55
|
+
"args": {
|
|
56
|
+
"flows": "fixtures/flows.csv"
|
|
57
|
+
},
|
|
58
|
+
"expect": {
|
|
59
|
+
"contains": [
|
|
60
|
+
"10.0.5.10:3389"
|
|
61
|
+
],
|
|
62
|
+
"equals": {
|
|
63
|
+
"result.open": 10,
|
|
64
|
+
"result.high": 5
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "code-filter",
|
|
70
|
+
"tool": "traffic_check",
|
|
71
|
+
"args": {
|
|
72
|
+
"flows": "fixtures/flows.csv",
|
|
73
|
+
"settings": "fixtures/settings.json",
|
|
74
|
+
"code": "cleartext_protocol"
|
|
75
|
+
},
|
|
76
|
+
"expect": {
|
|
77
|
+
"equals": {
|
|
78
|
+
"result.findings": 2,
|
|
79
|
+
"result.open": 9
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "explain-file-server",
|
|
85
|
+
"tool": "traffic_explain",
|
|
86
|
+
"args": {
|
|
87
|
+
"flows": "fixtures/flows.csv",
|
|
88
|
+
"settings": "fixtures/settings.json",
|
|
89
|
+
"host": "10.0.3.50"
|
|
90
|
+
},
|
|
91
|
+
"expect": {
|
|
92
|
+
"contains": [
|
|
93
|
+
"large_upload_after_hours",
|
|
94
|
+
"top_talker_share",
|
|
95
|
+
"outside business hours"
|
|
96
|
+
],
|
|
97
|
+
"equals": {
|
|
98
|
+
"result.findings": 2
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "draft-after-approval",
|
|
104
|
+
"tool": "traffic_draft_change_request",
|
|
105
|
+
"approve": "Pat Example",
|
|
106
|
+
"args": {
|
|
107
|
+
"flows": "fixtures/flows.csv",
|
|
108
|
+
"settings": "fixtures/settings.json"
|
|
109
|
+
},
|
|
110
|
+
"expect": {
|
|
111
|
+
"status": "executed",
|
|
112
|
+
"contains": [
|
|
113
|
+
"Nothing was sent",
|
|
114
|
+
"1 open marker(s)"
|
|
115
|
+
],
|
|
116
|
+
"equals": {
|
|
117
|
+
"result.items": 6,
|
|
118
|
+
"result.open_markers": 1
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "review-mode-still-reads",
|
|
124
|
+
"tool": "traffic_check",
|
|
125
|
+
"mode": "review",
|
|
126
|
+
"args": {
|
|
127
|
+
"flows": "fixtures/flows.csv",
|
|
128
|
+
"settings": "fixtures/settings.json"
|
|
129
|
+
},
|
|
130
|
+
"expect": {
|
|
131
|
+
"status": "executed",
|
|
132
|
+
"equals": {
|
|
133
|
+
"result.flows": 36,
|
|
134
|
+
"result.skipped_rows": 1,
|
|
135
|
+
"result.bytes": 764045520,
|
|
136
|
+
"result.inside_hosts": 11,
|
|
137
|
+
"result.outside_destinations": 6,
|
|
138
|
+
"result.open": 9,
|
|
139
|
+
"result.high": 4
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"generated": true
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"id": "severity-filter",
|
|
146
|
+
"tool": "traffic_check",
|
|
147
|
+
"args": {
|
|
148
|
+
"flows": "fixtures/flows.csv",
|
|
149
|
+
"settings": "fixtures/settings.json",
|
|
150
|
+
"severity": "high"
|
|
151
|
+
},
|
|
152
|
+
"expect": {
|
|
153
|
+
"status": "executed",
|
|
154
|
+
"equals": {
|
|
155
|
+
"result.findings": 4
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"generated": true
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "missing-argument-named",
|
|
162
|
+
"tool": "traffic_check",
|
|
163
|
+
"args": {},
|
|
164
|
+
"expect": {
|
|
165
|
+
"status": "error",
|
|
166
|
+
"contains": [
|
|
167
|
+
"flows"
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
"generated": true
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"id": "file-outside-root-refused",
|
|
174
|
+
"tool": "traffic_check",
|
|
175
|
+
"args": {
|
|
176
|
+
"flows": "../../../outside.csv",
|
|
177
|
+
"settings": "fixtures/settings.json"
|
|
178
|
+
},
|
|
179
|
+
"expect": {
|
|
180
|
+
"status": "error",
|
|
181
|
+
"contains": [
|
|
182
|
+
"outside"
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
"generated": true
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"id": "invented-tool-name-refused",
|
|
189
|
+
"tool": "traffic_apply_every_fix_now",
|
|
190
|
+
"args": {},
|
|
191
|
+
"expect": {
|
|
192
|
+
"status": "blocked"
|
|
193
|
+
},
|
|
194
|
+
"generated": true
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"id": "write-report-writes-files",
|
|
198
|
+
"tool": "traffic_write_report",
|
|
199
|
+
"args": {
|
|
200
|
+
"flows": "fixtures/flows.csv",
|
|
201
|
+
"settings": "fixtures/settings.json"
|
|
202
|
+
},
|
|
203
|
+
"expect": {
|
|
204
|
+
"status": "executed",
|
|
205
|
+
"contains": [
|
|
206
|
+
"network-traffic.csv",
|
|
207
|
+
"network-traffic.html"
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
"generated": true
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"id": "recall-memory-starts-empty",
|
|
214
|
+
"tool": "traffic_recall",
|
|
215
|
+
"args": {},
|
|
216
|
+
"expect": {
|
|
217
|
+
"status": "executed",
|
|
218
|
+
"contains": [
|
|
219
|
+
"memory is empty"
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
"generated": true
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"id": "accept-learning-stays-one-click",
|
|
226
|
+
"tool": "traffic_accept_learning",
|
|
227
|
+
"mode": "auto",
|
|
228
|
+
"args": {
|
|
229
|
+
"id": "MEM-000000000000",
|
|
230
|
+
"decision": "accept"
|
|
231
|
+
},
|
|
232
|
+
"expect": {
|
|
233
|
+
"status": "needs_approval"
|
|
234
|
+
},
|
|
235
|
+
"generated": true
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"id": "never-firewall-block-address",
|
|
239
|
+
"tool": "firewall_block_address",
|
|
240
|
+
"mode": "auto",
|
|
241
|
+
"args": {},
|
|
242
|
+
"expect": {
|
|
243
|
+
"status": "blocked"
|
|
244
|
+
},
|
|
245
|
+
"generated": true
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"id": "never-switch-shutdown-port",
|
|
249
|
+
"tool": "switch_shutdown_port",
|
|
250
|
+
"mode": "auto",
|
|
251
|
+
"args": {},
|
|
252
|
+
"expect": {
|
|
253
|
+
"status": "blocked"
|
|
254
|
+
},
|
|
255
|
+
"generated": true
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"id": "draft-waits-for-a-person",
|
|
259
|
+
"tool": "traffic_draft_change_request",
|
|
260
|
+
"args": {
|
|
261
|
+
"flows": "fixtures/flows.csv",
|
|
262
|
+
"settings": "fixtures/settings.json"
|
|
263
|
+
},
|
|
264
|
+
"expect": {
|
|
265
|
+
"status": "needs_approval",
|
|
266
|
+
"decision": "ask"
|
|
267
|
+
},
|
|
268
|
+
"generated": true
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"id": "review-mode-drafts-nothing",
|
|
272
|
+
"tool": "traffic_draft_change_request",
|
|
273
|
+
"mode": "review",
|
|
274
|
+
"args": {
|
|
275
|
+
"flows": "fixtures/flows.csv",
|
|
276
|
+
"settings": "fixtures/settings.json"
|
|
277
|
+
},
|
|
278
|
+
"expect": {
|
|
279
|
+
"status": "blocked"
|
|
280
|
+
},
|
|
281
|
+
"generated": true
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"id": "request-stays-one-click",
|
|
285
|
+
"tool": "traffic_request_submit",
|
|
286
|
+
"mode": "auto",
|
|
287
|
+
"args": {
|
|
288
|
+
"draft": "fixtures/README.md",
|
|
289
|
+
"draft_sha256": "0000000000000000000000000000000000000000000000000000000000000000"
|
|
290
|
+
},
|
|
291
|
+
"expect": {
|
|
292
|
+
"status": "needs_approval"
|
|
293
|
+
},
|
|
294
|
+
"generated": true
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"id": "intl-de-check-totals",
|
|
298
|
+
"tool": "traffic_check",
|
|
299
|
+
"args": {
|
|
300
|
+
"flows": "fixtures/intl/de/flows.csv",
|
|
301
|
+
"settings": "fixtures/settings.json"
|
|
302
|
+
},
|
|
303
|
+
"expect": {
|
|
304
|
+
"equals": {
|
|
305
|
+
"result.flows": 36,
|
|
306
|
+
"result.skipped_rows": 1,
|
|
307
|
+
"result.bytes": 764045520,
|
|
308
|
+
"result.inside_hosts": 11,
|
|
309
|
+
"result.outside_destinations": 6,
|
|
310
|
+
"result.open": 9,
|
|
311
|
+
"result.high": 4
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
"note": "German export of the same data (fixtures/intl/de); must match the English case \"check-totals\"."
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"id": "intl-ja-check-totals",
|
|
318
|
+
"tool": "traffic_check",
|
|
319
|
+
"args": {
|
|
320
|
+
"flows": "fixtures/intl/ja/flows.csv",
|
|
321
|
+
"settings": "fixtures/settings.json"
|
|
322
|
+
},
|
|
323
|
+
"expect": {
|
|
324
|
+
"equals": {
|
|
325
|
+
"result.flows": 36,
|
|
326
|
+
"result.skipped_rows": 1,
|
|
327
|
+
"result.bytes": 764045520,
|
|
328
|
+
"result.inside_hosts": 11,
|
|
329
|
+
"result.outside_destinations": 6,
|
|
330
|
+
"result.open": 9,
|
|
331
|
+
"result.high": 4
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
"note": "Japanese export of the same data (fixtures/intl/ja); must match the English case \"check-totals\"."
|
|
335
|
+
}
|
|
336
|
+
]
|
|
337
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Fairwire Network Traffic fixtures
|
|
2
|
+
|
|
3
|
+
Fictional flows between documentation address ranges (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24) and private inside ranges. No real network.
|
|
4
|
+
|
|
5
|
+
- `flows.csv`: 37 flow rows with planted problems: RDP reached twice from one outside address, SMB reached from another, a published RDP gateway (10.0.5.10, allowed in `settings.json`), Telnet and HTTP across the edge, 700 MB uploaded from a file server on a Saturday night, 22 tiny flows from one laptop to 22 ports of one server, one host carrying most of the bytes, a sensor hub sending 2,000 tiny packets, ordinary HTTPS and DNS, and one row with a bad address (skipped).
|
|
6
|
+
- `settings.json`: allows the published gateway and sets business hours 7 to 19.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
start,src_ip,dst_ip,dst_port,protocol,bytes,packets,src_host
|
|
2
|
+
2026-11-16 09:12:00,198.51.100.23,10.0.5.20,3389,tcp,182000,240,
|
|
3
|
+
2026-11-16 21:40:00,198.51.100.23,10.0.5.20,3389,tcp,96000,150,
|
|
4
|
+
2026-11-16 10:05:00,203.0.113.45,10.0.5.30,445,tcp,4200,12,
|
|
5
|
+
2026-11-16 08:30:00,192.0.2.66,10.0.5.10,3389,tcp,250000,400,
|
|
6
|
+
2026-11-16 11:00:00,10.0.2.15,203.0.113.80,23,tcp,52000,300,lab-switch-mgmt
|
|
7
|
+
2026-11-16 11:20:00,10.0.2.40,198.51.100.80,80,tcp,7300000,6000,kiosk-02
|
|
8
|
+
2026-11-14 02:10:00,10.0.3.50,203.0.113.200,443,tcp,400000000,280000,fileserver-01
|
|
9
|
+
2026-11-14 03:05:00,10.0.3.50,203.0.113.200,443,tcp,300000000,210000,fileserver-01
|
|
10
|
+
2026-11-16 14:00:00,10.0.3.50,203.0.113.200,443,tcp,20000000,15000,fileserver-01
|
|
11
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1000,tcp,60,1,it-laptop-09
|
|
12
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1001,tcp,60,1,it-laptop-09
|
|
13
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1002,tcp,60,1,it-laptop-09
|
|
14
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1003,tcp,60,1,it-laptop-09
|
|
15
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1004,tcp,60,1,it-laptop-09
|
|
16
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1005,tcp,60,1,it-laptop-09
|
|
17
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1006,tcp,60,1,it-laptop-09
|
|
18
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1007,tcp,60,1,it-laptop-09
|
|
19
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1008,tcp,60,1,it-laptop-09
|
|
20
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1009,tcp,60,1,it-laptop-09
|
|
21
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1010,tcp,60,1,it-laptop-09
|
|
22
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1011,tcp,60,1,it-laptop-09
|
|
23
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1012,tcp,60,1,it-laptop-09
|
|
24
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1013,tcp,60,1,it-laptop-09
|
|
25
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1014,tcp,60,1,it-laptop-09
|
|
26
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1015,tcp,60,1,it-laptop-09
|
|
27
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1016,tcp,60,1,it-laptop-09
|
|
28
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1017,tcp,60,1,it-laptop-09
|
|
29
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1018,tcp,60,1,it-laptop-09
|
|
30
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1019,tcp,60,1,it-laptop-09
|
|
31
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1020,tcp,60,1,it-laptop-09
|
|
32
|
+
2026-11-16 15:00:00,10.0.9.99,10.0.5.20,1021,tcp,60,1,it-laptop-09
|
|
33
|
+
2026-11-16 09:00:00,10.0.7.7,10.0.7.8,161,udp,120000,2000,sensor-hub
|
|
34
|
+
2026-11-16 10:00:00,10.0.4.11,198.51.100.10,443,tcp,15000000,12000,desk-11
|
|
35
|
+
2026-11-16 10:30:00,10.0.4.12,203.0.113.10,443,tcp,9000000,8000,desk-12
|
|
36
|
+
2026-11-16 10:45:00,10.0.4.13,8.8.8.8,53,udp,40000,400,desk-13
|
|
37
|
+
2026-11-16 16:00:00,10.0.4.11,198.51.100.10,443,tcp,12000000,10000,desk-11
|
|
38
|
+
2026-11-16 16:10:00,unknown,10.0.4.14,443,tcp,100,1,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Fixtures from other countries
|
|
2
|
+
|
|
3
|
+
Generated by `node scripts/make-intl-fixtures.mjs` from the English fixtures one
|
|
4
|
+
folder up. The same fictional data, written the way a local export writes it:
|
|
5
|
+
|
|
6
|
+
- `de/`: German column names, Windows-1252 text, semicolons, comma decimals
|
|
7
|
+
(1.234,56), day-first dotted dates (03.11.2026), kilograms and kilometres.
|
|
8
|
+
- `ja/`: Japanese column names, Shift_JIS text, year-first dates (2026/11/03),
|
|
9
|
+
kilograms and kilometres.
|
|
10
|
+
|
|
11
|
+
Values (names, codes, charge wording) stay in English. The eval cases
|
|
12
|
+
`intl-de-*` and `intl-ja-*` expect exactly the same results as the English case.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Startzeit;Quell-IP;Ziel-IP;Zielport;Protokoll;Datenmenge (Bytes);Pakete;src_host
|
|
2
|
+
16.11.2026 09:12:00;198.51.100.23;10.0.5.20;3.389;tcp;182.000;240;
|
|
3
|
+
16.11.2026 21:40:00;198.51.100.23;10.0.5.20;3.389;tcp;96.000;150;
|
|
4
|
+
16.11.2026 10:05:00;203.0.113.45;10.0.5.30;445;tcp;4.200;12;
|
|
5
|
+
16.11.2026 08:30:00;192.0.2.66;10.0.5.10;3.389;tcp;250.000;400;
|
|
6
|
+
16.11.2026 11:00:00;10.0.2.15;203.0.113.80;23;tcp;52.000;300;lab-switch-mgmt
|
|
7
|
+
16.11.2026 11:20:00;10.0.2.40;198.51.100.80;80;tcp;7.300.000;6.000;kiosk-02
|
|
8
|
+
14.11.2026 02:10:00;10.0.3.50;203.0.113.200;443;tcp;400.000.000;280.000;fileserver-01
|
|
9
|
+
14.11.2026 03:05:00;10.0.3.50;203.0.113.200;443;tcp;300.000.000;210.000;fileserver-01
|
|
10
|
+
16.11.2026 14:00:00;10.0.3.50;203.0.113.200;443;tcp;20.000.000;15.000;fileserver-01
|
|
11
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.000;tcp;60;1;it-laptop-09
|
|
12
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.001;tcp;60;1;it-laptop-09
|
|
13
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.002;tcp;60;1;it-laptop-09
|
|
14
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.003;tcp;60;1;it-laptop-09
|
|
15
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.004;tcp;60;1;it-laptop-09
|
|
16
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.005;tcp;60;1;it-laptop-09
|
|
17
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.006;tcp;60;1;it-laptop-09
|
|
18
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.007;tcp;60;1;it-laptop-09
|
|
19
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.008;tcp;60;1;it-laptop-09
|
|
20
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.009;tcp;60;1;it-laptop-09
|
|
21
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.010;tcp;60;1;it-laptop-09
|
|
22
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.011;tcp;60;1;it-laptop-09
|
|
23
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.012;tcp;60;1;it-laptop-09
|
|
24
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.013;tcp;60;1;it-laptop-09
|
|
25
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.014;tcp;60;1;it-laptop-09
|
|
26
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.015;tcp;60;1;it-laptop-09
|
|
27
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.016;tcp;60;1;it-laptop-09
|
|
28
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.017;tcp;60;1;it-laptop-09
|
|
29
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.018;tcp;60;1;it-laptop-09
|
|
30
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.019;tcp;60;1;it-laptop-09
|
|
31
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.020;tcp;60;1;it-laptop-09
|
|
32
|
+
16.11.2026 15:00:00;10.0.9.99;10.0.5.20;1.021;tcp;60;1;it-laptop-09
|
|
33
|
+
16.11.2026 09:00:00;10.0.7.7;10.0.7.8;161;udp;120.000;2.000;sensor-hub
|
|
34
|
+
16.11.2026 10:00:00;10.0.4.11;198.51.100.10;443;tcp;15.000.000;12.000;desk-11
|
|
35
|
+
16.11.2026 10:30:00;10.0.4.12;203.0.113.10;443;tcp;9.000.000;8.000;desk-12
|
|
36
|
+
16.11.2026 10:45:00;10.0.4.13;8.8.8.8;53;udp;40.000;400;desk-13
|
|
37
|
+
16.11.2026 16:00:00;10.0.4.11;198.51.100.10;443;tcp;12.000.000;10.000;desk-11
|
|
38
|
+
16.11.2026 16:10:00;unknown;10.0.4.14;443;tcp;100;1;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
�J�n����,���M��IP,����IP,����|�[�g,�v���g�R��,�o�C�g��,�p�P�b�g��,src_host
|
|
2
|
+
2026/11/16 09:12:00,198.51.100.23,10.0.5.20,"3,389",tcp,"182,000",240,
|
|
3
|
+
2026/11/16 21:40:00,198.51.100.23,10.0.5.20,"3,389",tcp,"96,000",150,
|
|
4
|
+
2026/11/16 10:05:00,203.0.113.45,10.0.5.30,445,tcp,"4,200",12,
|
|
5
|
+
2026/11/16 08:30:00,192.0.2.66,10.0.5.10,"3,389",tcp,"250,000",400,
|
|
6
|
+
2026/11/16 11:00:00,10.0.2.15,203.0.113.80,23,tcp,"52,000",300,lab-switch-mgmt
|
|
7
|
+
2026/11/16 11:20:00,10.0.2.40,198.51.100.80,80,tcp,"7,300,000","6,000",kiosk-02
|
|
8
|
+
2026/11/14 02:10:00,10.0.3.50,203.0.113.200,443,tcp,"400,000,000","280,000",fileserver-01
|
|
9
|
+
2026/11/14 03:05:00,10.0.3.50,203.0.113.200,443,tcp,"300,000,000","210,000",fileserver-01
|
|
10
|
+
2026/11/16 14:00:00,10.0.3.50,203.0.113.200,443,tcp,"20,000,000","15,000",fileserver-01
|
|
11
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,000",tcp,60,1,it-laptop-09
|
|
12
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,001",tcp,60,1,it-laptop-09
|
|
13
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,002",tcp,60,1,it-laptop-09
|
|
14
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,003",tcp,60,1,it-laptop-09
|
|
15
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,004",tcp,60,1,it-laptop-09
|
|
16
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,005",tcp,60,1,it-laptop-09
|
|
17
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,006",tcp,60,1,it-laptop-09
|
|
18
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,007",tcp,60,1,it-laptop-09
|
|
19
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,008",tcp,60,1,it-laptop-09
|
|
20
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,009",tcp,60,1,it-laptop-09
|
|
21
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,010",tcp,60,1,it-laptop-09
|
|
22
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,011",tcp,60,1,it-laptop-09
|
|
23
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,012",tcp,60,1,it-laptop-09
|
|
24
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,013",tcp,60,1,it-laptop-09
|
|
25
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,014",tcp,60,1,it-laptop-09
|
|
26
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,015",tcp,60,1,it-laptop-09
|
|
27
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,016",tcp,60,1,it-laptop-09
|
|
28
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,017",tcp,60,1,it-laptop-09
|
|
29
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,018",tcp,60,1,it-laptop-09
|
|
30
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,019",tcp,60,1,it-laptop-09
|
|
31
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,020",tcp,60,1,it-laptop-09
|
|
32
|
+
2026/11/16 15:00:00,10.0.9.99,10.0.5.20,"1,021",tcp,60,1,it-laptop-09
|
|
33
|
+
2026/11/16 09:00:00,10.0.7.7,10.0.7.8,161,udp,"120,000","2,000",sensor-hub
|
|
34
|
+
2026/11/16 10:00:00,10.0.4.11,198.51.100.10,443,tcp,"15,000,000","12,000",desk-11
|
|
35
|
+
2026/11/16 10:30:00,10.0.4.12,203.0.113.10,443,tcp,"9,000,000","8,000",desk-12
|
|
36
|
+
2026/11/16 10:45:00,10.0.4.13,8.8.8.8,53,udp,"40,000",400,desk-13
|
|
37
|
+
2026/11/16 16:00:00,10.0.4.11,198.51.100.10,443,tcp,"12,000,000","10,000",desk-11
|
|
38
|
+
2026/11/16 16:10:00,unknown,10.0.4.14,443,tcp,100,1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fairwire-network-traffic",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"mcpName": "io.github.fpavia111-creator/fairwire-network-traffic",
|
|
5
|
+
"description": "Fairwire Network Traffic: Network flow review from a NetFlow, IPFIX or sFlow export: cleartext protocols, risky ports reached from the internet, one host or destination taking most of the bytes, large uploads out of hours and very small packets. Writes a worklist and drafts a change request a network owner applies.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Kurt Francisco",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20"
|
|
11
|
+
},
|
|
12
|
+
"main": "src/index.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./src/index.js",
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"fairwire-network-traffic": "bin/fairwire-network-traffic.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"bin",
|
|
23
|
+
"fixtures",
|
|
24
|
+
"evals",
|
|
25
|
+
"README.md",
|
|
26
|
+
"CHANGELOG.md",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"server.json"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "node scripts/run-tests.cjs",
|
|
32
|
+
"demo": "node bin/fairwire-network-traffic.js demo",
|
|
33
|
+
"eval": "node bin/fairwire-network-traffic.js eval"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"fairwire-core": "^0.1.0"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/fpavia111-creator/fairwire-agents.git",
|
|
41
|
+
"directory": "packages/fairwire-network-traffic"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/fpavia111-creator/fairwire-agents/tree/master/packages/fairwire-network-traffic#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/fpavia111-creator/fairwire-agents/issues"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"mcp",
|
|
49
|
+
"mcp-server",
|
|
50
|
+
"it-operations",
|
|
51
|
+
"network",
|
|
52
|
+
"fairwire",
|
|
53
|
+
"netflow",
|
|
54
|
+
"ipfix",
|
|
55
|
+
"sflow",
|
|
56
|
+
"network-traffic",
|
|
57
|
+
"top-talkers"
|
|
58
|
+
]
|
|
59
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.fpavia111-creator/fairwire-network-traffic",
|
|
4
|
+
"title": "Fairwire Network Traffic",
|
|
5
|
+
"description": "Fairwire Network Traffic: Network flow review from a NetFlow, IPFIX or sFlow export: cleartext…",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/fpavia111-creator/fairwire-agents",
|
|
9
|
+
"source": "github",
|
|
10
|
+
"subfolder": "packages/fairwire-network-traffic"
|
|
11
|
+
},
|
|
12
|
+
"websiteUrl": "https://fair-agents.com/fairwire.html",
|
|
13
|
+
"packages": [
|
|
14
|
+
{
|
|
15
|
+
"registryType": "npm",
|
|
16
|
+
"identifier": "fairwire-network-traffic",
|
|
17
|
+
"version": "0.1.0",
|
|
18
|
+
"transport": {
|
|
19
|
+
"type": "stdio"
|
|
20
|
+
},
|
|
21
|
+
"packageArguments": [
|
|
22
|
+
{
|
|
23
|
+
"type": "positional",
|
|
24
|
+
"value": "mcp"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"type": "named",
|
|
28
|
+
"name": "--root",
|
|
29
|
+
"description": "Folder holding the exports this agent may read and write (it cannot reach outside it)",
|
|
30
|
+
"isRequired": true,
|
|
31
|
+
"format": "filepath",
|
|
32
|
+
"valueHint": "exports_folder"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
package/src/demo.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { standardDemo } from 'fairwire-core';
|
|
4
|
+
|
|
5
|
+
// The demo runs the eval case "check-totals" and the agent's draft on the fictional fixtures.
|
|
6
|
+
const cases = JSON.parse(readFileSync(new URL('../evals/cases.json', import.meta.url), 'utf8')).cases;
|
|
7
|
+
const base = cases.find((c) => c.id === 'check-totals');
|
|
8
|
+
const explain = cases.find((c) => /_explain$/.test(c.tool) && !c.expect.status);
|
|
9
|
+
const draft = cases.find((c) => /_draft_/.test(c.tool) && c.approve);
|
|
10
|
+
|
|
11
|
+
export async function demo(manifest) {
|
|
12
|
+
const refused = manifest.tools.filter((t) => (manifest.policy.rules.find((r) => r.tool === t.name) || {}).decision === 'block')[0];
|
|
13
|
+
await standardDemo(manifest, fileURLToPath(new URL('../fixtures', import.meta.url)), {
|
|
14
|
+
title: 'Fairwire Network Traffic demo', args: base.args,
|
|
15
|
+
explain: explain ? { label: 'Explain one finding', args: explain.args } : null,
|
|
16
|
+
draft: draft ? { label: 'Draft the note for a person', args: draft.args } : null,
|
|
17
|
+
refused: refused ? refused.name : null,
|
|
18
|
+
});
|
|
19
|
+
}
|
package/src/index.js
ADDED
package/src/logic.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Fairwire Network Traffic: network flow review. Pure functions, no I/O: flow rows in, findings out.
|
|
2
|
+
import { num, str, low, isPrivateIp, inAnyCidr, cleanIp, isIp, portName, hourOf, weekdayOf, round1, pct, humanBytes, finding, CLEARTEXT, RISKY_INBOUND_PORTS } from 'fairwire-core';
|
|
3
|
+
|
|
4
|
+
export const CHECKS = Object.freeze({
|
|
5
|
+
inbound_risky_port: 'An address on the internet reached an inside host on a port that should rarely be open to the internet (RDP, SMB, Telnet, databases and the like).',
|
|
6
|
+
cleartext_protocol: 'Traffic between an inside host and the internet on a protocol that sends data without encryption (Telnet, FTP and POP3 are high; HTTP, IMAP, SNMP and LDAP are medium).',
|
|
7
|
+
large_upload_after_hours: 'An inside host sent more than your limit to one outside address outside business hours.',
|
|
8
|
+
possible_port_scan: 'One address tried many different ports on one host with tiny flows.',
|
|
9
|
+
top_talker_share: 'One inside host carried more than your share of all bytes.',
|
|
10
|
+
top_destination_share: 'One outside address received more than your share of all bytes sent out.',
|
|
11
|
+
small_packets: 'A host\'s flows average very small packets over many packets (chatty traffic worth batching, or probing).',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const FLOW_FIELDS = Object.freeze({
|
|
15
|
+
src_ip: { aliases: ['Source IP', 'Src IP', 'Src Addr', 'srcaddr', 'sa', 'Source Address', 'src'], required: true },
|
|
16
|
+
dst_ip: { aliases: ['Destination IP', 'Dst IP', 'Dst Addr', 'dstaddr', 'da', 'Destination Address', 'dst'], required: true },
|
|
17
|
+
dst_port: { type: 'number', aliases: ['Destination Port', 'Dst Port', 'dstport', 'dp', 'DPort'] },
|
|
18
|
+
protocol: { aliases: ['Protocol', 'Proto', 'pr', 'IP Protocol', 'Application Protocol'] },
|
|
19
|
+
bytes: { type: 'number', aliases: ['Bytes', 'Octets', 'ibyt', 'In Bytes', 'Total Bytes', 'byt', 'Byte Count'], required: true },
|
|
20
|
+
packets: { type: 'number', aliases: ['Packets', 'Pkts', 'ipkt', 'In Packets', 'Packet Count'] },
|
|
21
|
+
start: { type: 'datetime', aliases: ['Start', 'First Seen', 'ts', 'Start Time', 'First Switched', 'Timestamp', 'Date first seen'] },
|
|
22
|
+
src_host: { aliases: ['Source Host', 'Source Hostname', 'Src Name', 'Host'] },
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const SETTINGS_SCHEMA = { type: 'object', additionalProperties: false, properties: {
|
|
26
|
+
internal_cidrs: { type: 'array', items: { type: 'string' }, maxItems: 200, description: 'Your inside address ranges (default: private ranges such as 10.0.0.0/8)' },
|
|
27
|
+
risky_ports: { type: 'array', items: { type: 'integer', minimum: 0, maximum: 65535 }, maxItems: 500, description: 'Ports that should not be reachable from the internet (default: RDP, SMB, Telnet, databases and others)' },
|
|
28
|
+
allowed_inbound: { type: 'array', items: { type: 'string' }, maxItems: 500, description: 'Inside host:port pairs that are meant to be open, e.g. "10.0.5.10:3389" for a published gateway' },
|
|
29
|
+
business_hours: { type: 'array', items: { type: 'integer', minimum: 0, maximum: 24 }, minItems: 2, maxItems: 2, description: 'First and last hour of the working day, e.g. [7, 19] (default)' },
|
|
30
|
+
large_upload_bytes: { type: 'number', minimum: 1, description: 'Bytes to one outside address out of hours that count as a large upload (default 500000000)' },
|
|
31
|
+
top_share_pct: { type: 'number', minimum: 1, maximum: 100, description: 'Share of all bytes above which one host or destination is flagged (default 40)' },
|
|
32
|
+
share_min_hosts: { type: 'integer', minimum: 2, description: 'Inside hosts (or outside destinations) the export must hold before one of them carrying most of the bytes is flagged (default 5; with fewer, one host always dominates)' },
|
|
33
|
+
small_packet_bytes: { type: 'number', minimum: 1, description: 'Average packet size under which a host is flagged (default 100)' },
|
|
34
|
+
min_packets: { type: 'integer', minimum: 1, description: 'Packets a host needs before the small-packet check applies (default 1000)' },
|
|
35
|
+
scan_ports: { type: 'integer', minimum: 2, description: 'Distinct ports one source tries on one host before it counts as a possible scan (default 20)' },
|
|
36
|
+
} };
|
|
37
|
+
export const DEFAULTS = Object.freeze({ internal_cidrs: [], risky_ports: RISKY_INBOUND_PORTS, allowed_inbound: [], business_hours: [7, 19], large_upload_bytes: 500e6, top_share_pct: 40, share_min_hosts: 5, small_packet_bytes: 100, min_packets: 1000, scan_ports: 20 });
|
|
38
|
+
|
|
39
|
+
const HIGH_CLEAR = new Set([21, 23, 110, 69]);
|
|
40
|
+
const NAMED_PORT = { http: 80, ftp: 21, telnet: 23, pop3: 110, imap: 143, tftp: 69, snmp: 161, ldap: 389 };
|
|
41
|
+
|
|
42
|
+
/** Read flows into a common shape; rows with no valid addresses are counted, not used. */
|
|
43
|
+
export function readFlows(rows) {
|
|
44
|
+
const flows = []; let skipped = 0;
|
|
45
|
+
for (const r of rows) {
|
|
46
|
+
const src = cleanIp(r.src_ip), dst = cleanIp(r.dst_ip);
|
|
47
|
+
if (!isIp(src) || !isIp(dst)) { skipped++; continue; }
|
|
48
|
+
const proto = low(r.protocol);
|
|
49
|
+
let port = num(r.dst_port);
|
|
50
|
+
if (port === null && NAMED_PORT[proto] !== undefined) port = NAMED_PORT[proto];
|
|
51
|
+
flows.push({ src, dst, port, proto, bytes: Math.max(0, num(r.bytes) || 0), packets: Math.max(0, num(r.packets) || 0), start: str(r.start), src_host: str(r.src_host) });
|
|
52
|
+
}
|
|
53
|
+
return { flows, skipped };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function reviewFlows(rows, settings = {}) {
|
|
57
|
+
const s = { ...DEFAULTS, ...settings };
|
|
58
|
+
const inside = (ip) => (s.internal_cidrs.length ? inAnyCidr(ip, s.internal_cidrs) : isPrivateIp(ip));
|
|
59
|
+
const { flows, skipped } = readFlows(rows);
|
|
60
|
+
const risky = new Set(s.risky_ports.map(Number));
|
|
61
|
+
const allowed = new Set(s.allowed_inbound.map((x) => low(x)));
|
|
62
|
+
const items = [];
|
|
63
|
+
const total = flows.reduce((t, f) => t + f.bytes, 0);
|
|
64
|
+
const add = (m, k, f) => { const e = m.get(k) || { bytes: 0, flows: 0, packets: 0, peers: new Set(), ports: new Set() }; e.bytes += f.bytes; e.flows++; e.packets += f.packets; m.set(k, e); return e; };
|
|
65
|
+
|
|
66
|
+
// Inbound to risky ports.
|
|
67
|
+
const inbound = new Map();
|
|
68
|
+
for (const f of flows) if (!inside(f.src) && inside(f.dst) && f.port !== null && risky.has(f.port) && !allowed.has(`${f.dst}:${f.port}`)) add(inbound, `${f.dst}:${f.port}`, f).peers.add(f.src);
|
|
69
|
+
for (const [k, e] of inbound) { const [host, port] = k.split(':'); items.push(finding('inbound_risky_port', 'high', k, `${e.peers.size} outside address(es) reached ${host} on ${portName(Number(port))} (port ${port}) in ${e.flows} flow(s), ${humanBytes(e.bytes)}.`, 'Close the port at the edge or put it behind the VPN; if it is meant to be open, add it to allowed_inbound with a note.', { subject: host, port: Number(port), peers: e.peers.size, bytes: e.bytes })); }
|
|
70
|
+
|
|
71
|
+
// Cleartext protocols across the edge.
|
|
72
|
+
const clear = new Map();
|
|
73
|
+
for (const f of flows) {
|
|
74
|
+
const crosses = inside(f.src) !== inside(f.dst); if (!crosses) continue;
|
|
75
|
+
const named = CLEARTEXT.names.includes(f.proto);
|
|
76
|
+
if (!(named || (f.port !== null && CLEARTEXT.ports.includes(f.port)))) continue;
|
|
77
|
+
const host = inside(f.src) ? f.src : f.dst; const port = f.port ?? NAMED_PORT[f.proto] ?? 0;
|
|
78
|
+
add(clear, `${host}:${port}`, f).peers.add(inside(f.src) ? f.dst : f.src);
|
|
79
|
+
}
|
|
80
|
+
for (const [k, e] of clear) { const [host, port] = k.split(':'); const p = Number(port); items.push(finding('cleartext_protocol', HIGH_CLEAR.has(p) ? 'high' : 'medium', k, `${host} exchanged ${humanBytes(e.bytes)} with ${e.peers.size} outside address(es) over ${portName(p)} (port ${p}), which is not encrypted.`, p === 80 || p === 8080 ? 'Move the service or client to HTTPS.' : `Replace ${portName(p)} with its encrypted form (SSH, SFTP, IMAPS, SNMPv3, LDAPS).`, { subject: host, port: p, bytes: e.bytes })); }
|
|
81
|
+
|
|
82
|
+
// Large uploads out of hours.
|
|
83
|
+
const [h0, h1] = s.business_hours; const ups = new Map();
|
|
84
|
+
for (const f of flows) {
|
|
85
|
+
if (!inside(f.src) || inside(f.dst)) continue;
|
|
86
|
+
const h = hourOf(f.start); const wd = weekdayOf(f.start);
|
|
87
|
+
const off = h !== null && (h < h0 || h >= h1 || wd === 0 || wd === 6);
|
|
88
|
+
if (off) add(ups, `${f.src}>${f.dst}`, f);
|
|
89
|
+
}
|
|
90
|
+
for (const [k, e] of ups) if (e.bytes >= s.large_upload_bytes) { const [src, dst] = k.split('>'); items.push(finding('large_upload_after_hours', 'high', k, `${src} sent ${humanBytes(e.bytes)} to ${dst} outside business hours in ${e.flows} flow(s).`, 'Confirm with the host owner that this was a planned backup or sync; if not, treat it as a possible data leak.', { subject: src, bytes: e.bytes })); }
|
|
91
|
+
|
|
92
|
+
// Possible port scans.
|
|
93
|
+
const scans = new Map();
|
|
94
|
+
for (const f of flows) if (f.port !== null && f.packets <= 3) add(scans, `${f.src}>${f.dst}`, f).ports.add(f.port);
|
|
95
|
+
for (const [k, e] of scans) if (e.ports.size >= s.scan_ports) { const [src, dst] = k.split('>'); items.push(finding('possible_port_scan', 'medium', k, `${src} tried ${e.ports.size} different ports on ${dst} with tiny flows.`, inside(src) ? 'Ask who runs scans from this host; if nobody, check the host.' : 'Block the source at the edge if it keeps trying.', { subject: src, ports: e.ports.size })); }
|
|
96
|
+
|
|
97
|
+
// Shares.
|
|
98
|
+
const byHost = new Map(); const byDest = new Map(); let out = 0;
|
|
99
|
+
for (const f of flows) {
|
|
100
|
+
if (inside(f.src)) add(byHost, f.src, f); else if (inside(f.dst)) add(byHost, f.dst, f);
|
|
101
|
+
if (inside(f.src) && !inside(f.dst)) { add(byDest, f.dst, f); out += f.bytes; }
|
|
102
|
+
}
|
|
103
|
+
// With only a handful of hosts one of them always carries most of the bytes; that is not a finding.
|
|
104
|
+
if (total && byHost.size >= s.share_min_hosts) for (const [h, e] of byHost) { const sh = pct(e.bytes, total); if (sh > s.top_share_pct) items.push(finding('top_talker_share', 'low', h, `${h} carried ${sh}% of all bytes (${humanBytes(e.bytes)} of ${humanBytes(total)}).`, 'Check whether this host should be on its own link, scheduled off-peak or rate-limited.', { subject: h, share_pct: sh, bytes: e.bytes })); }
|
|
105
|
+
if (out && byDest.size >= s.share_min_hosts) for (const [d, e] of byDest) { const sh = pct(e.bytes, out); if (sh > s.top_share_pct) items.push(finding('top_destination_share', 'low', d, `${d} received ${sh}% of the bytes sent out (${humanBytes(e.bytes)}).`, 'Confirm what service this is and that it is expected.', { subject: d, share_pct: sh, bytes: e.bytes })); }
|
|
106
|
+
|
|
107
|
+
// Small packets.
|
|
108
|
+
for (const [h, e] of byHost) if (e.packets >= s.min_packets) { const avg = round1(e.bytes / e.packets); if (avg < s.small_packet_bytes) items.push(finding('small_packets', 'low', h, `${h} averaged ${avg} bytes per packet over ${e.packets} packets.`, 'Look at what sends many tiny packets; batching or a longer polling interval may help.', { subject: h, avg_packet_bytes: avg })); }
|
|
109
|
+
|
|
110
|
+
const byProtocol = {};
|
|
111
|
+
for (const f of flows) { const p = f.proto || (f.port !== null ? portName(f.port).toLowerCase() : 'unknown'); byProtocol[p] = (byProtocol[p] || 0) + f.bytes; }
|
|
112
|
+
return {
|
|
113
|
+
flows: flows.length, skipped_rows: skipped, bytes: total, inside_hosts: byHost.size, outside_destinations: byDest.size,
|
|
114
|
+
by_protocol: Object.fromEntries(Object.entries(byProtocol).sort(([a], [b]) => (a < b ? -1 : 1))),
|
|
115
|
+
hosts: [...byHost.entries()].map(([host, e]) => ({ host, bytes: e.bytes, flows: e.flows })).sort((a, b) => b.bytes - a.bytes || (a.host < b.host ? -1 : 1)),
|
|
116
|
+
items,
|
|
117
|
+
};
|
|
118
|
+
}
|
package/src/manifest.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { wireAgent, fileArg, SETTINGS_ARG, settingsFrom, LIMITS, humanBytes } from 'fairwire-core';
|
|
3
|
+
import { FLOW_FIELDS, SETTINGS_SCHEMA, DEFAULTS, reviewFlows } from './logic.js';
|
|
4
|
+
|
|
5
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
6
|
+
const args = {
|
|
7
|
+
flows: fileArg('Flow export under --root (NetFlow, IPFIX or sFlow collector export as CSV, Excel or JSON): one row per flow with source, destination, port, protocol, bytes, packets and start time'),
|
|
8
|
+
settings: SETTINGS_ARG('internal_cidrs, risky_ports, allowed_inbound, business_hours, large_upload_bytes, top_share_pct, small_packet_bytes, min_packets, scan_ports'),
|
|
9
|
+
};
|
|
10
|
+
const run = (a, ctx) => reviewFlows(ctx.records(a.flows, 'flows'), settingsFrom(a, ctx, 'traffic_settings', DEFAULTS));
|
|
11
|
+
|
|
12
|
+
export const manifest = wireAgent({
|
|
13
|
+
pkg, prefix: 'traffic', title: 'Fairwire Network Traffic',
|
|
14
|
+
description: 'Reviews a NetFlow, IPFIX or sFlow export: risky ports reached from the internet, cleartext protocols across the edge, large uploads out of hours, possible port scans, one host or destination taking most of the bytes, and very small packets. Drafts a change request a network owner applies.',
|
|
15
|
+
args, required: ['flows'],
|
|
16
|
+
sources: { flows: { label: 'Flow records', args: ['flows'], fields: FLOW_FIELDS } },
|
|
17
|
+
configSchemas: { traffic_settings: SETTINGS_SCHEMA },
|
|
18
|
+
run, summary: (o) => `${o.flows} flow(s), ${humanBytes(o.bytes)} between ${o.inside_hosts} inside host(s) and ${o.outside_destinations} outside destination(s): ${o.open} open finding(s), ${o.high} high.`,
|
|
19
|
+
check: { title: 'Review network flows', description: 'Review the flow export and list findings worst first: inbound risky ports, cleartext protocols, out-of-hours uploads, scans, top talkers and small packets.' },
|
|
20
|
+
explain: { arg: 'host', argSchema: { type: 'string', maxLength: 100, description: 'Inside or outside address from traffic_check' }, title: 'Explain one host', description: 'Everything found for one address.', match: (i, v) => i.subject === v || i.key === v || String(i.key).startsWith(`${v}:`) || String(i.key).split('>').includes(v) },
|
|
21
|
+
report: {
|
|
22
|
+
title: 'Network flow review', base: 'network-traffic',
|
|
23
|
+
sections: (o) => [{ title: 'By host', rows: o.hosts.slice(0, 20).map((h) => ({ host: h.host, bytes: h.bytes, flows: h.flows })), columns: ['host', 'bytes', 'flows'] }, { title: 'By protocol', rows: Object.entries(o.by_protocol).map(([protocol, bytes]) => ({ protocol, bytes })), columns: ['protocol', 'bytes'] }],
|
|
24
|
+
limits: [LIMITS.files, 'Flow data shows who talked to whom and how much, not what was said: a finding is a lead for a person to confirm, not proof of an attack or a leak.', 'Inside and outside are decided by internal_cidrs (private ranges by default); NAT can hide the real inside host.', LIMITS.defaults, LIMITS.live],
|
|
25
|
+
},
|
|
26
|
+
note: { noun: 'change_request', verb: 'submit', category: 'production_deploy', actor: 'the network owner', to: 'network change board', subject: 'Network changes to review from the flow export', ask: 'Please confirm each item with the host owner before any port is closed or any rule is changed.' },
|
|
27
|
+
refused: [
|
|
28
|
+
{ name: 'firewall_block_address', category: 'production_deploy', description: 'Fairwire Network Traffic never blocks an address or changes a firewall; the network owner does.' },
|
|
29
|
+
{ name: 'switch_shutdown_port', category: 'production_deploy', description: 'Fairwire Network Traffic never shuts a switch port or isolates a host.' },
|
|
30
|
+
],
|
|
31
|
+
prompt: {
|
|
32
|
+
title: 'Review a flow export', description: 'Walks the host model through a flow review with Fairwire Network Traffic.',
|
|
33
|
+
text: 'You are helping an IT lead review a NetFlow, IPFIX or sFlow export with fairwire-network-traffic. Rules: Fairwire Network Traffic only reads the export and drafts notes; firewall_block_address and switch_shutdown_port are refused. 1. Call traffic_check. Lead with high findings (inbound risky ports, Telnet or FTP across the edge, large uploads out of hours). 2. Use traffic_explain for any address the person asks about. 3. Call traffic_write_report for the worklist. 4. Offer traffic_draft_change_request; traffic_request_submit waits for one named click and the network owner makes the change.',
|
|
34
|
+
},
|
|
35
|
+
});
|