Остання активність 1 month ago

gistfile1.txt Неформатований
1wc -l /etc/wireguard/wgctl/core/lib/events.py
2head -30 /etc/wireguard/wgctl/core/lib/events.py
3673 /etc/wireguard/wgctl/core/lib/events.py
4"""
5events.py — WireGuard and firewall event processing.
6"""
7
8import os
9import json
10import sys
11from collections import defaultdict
12from datetime import datetime
13
14from lib.util import (
15 DATETIME_FMT, PROTO_MAP,
16 build_ip_to_name, load_net_data, load_hosts_data,
17 reverse_lookup, hosts_lookup, resolve_display,
18 fmt_ts, fmt_ts_hour, ts_to_unix, parse_since,
19 make_dest_display,
20)
21
22
23# ──────────────────────────────────────────
24# fw_events
25# ──────────────────────────────────────────
26
27def fw_events(file, filter_ip, filter_type, clients_dir, net_file,
28 limit, collapse='1', since='', filter_dest_ip='',
29 filter_dest_port='', sort_order='desc', endpoint_cache_file=''):
30 """
31 Format firewall drop events with dedup, counts, and service annotation.
32
33 collapse='1' (default): hourly aggregation