nuno revisó este gist 1 month ago. Ir a la revisión
1 file changed, 33 insertions
gistfile1.txt(archivo creado)
| @@ -0,0 +1,33 @@ | |||
| 1 | + | wc -l /etc/wireguard/wgctl/core/lib/events.py | |
| 2 | + | head -30 /etc/wireguard/wgctl/core/lib/events.py | |
| 3 | + | 673 /etc/wireguard/wgctl/core/lib/events.py | |
| 4 | + | """ | |
| 5 | + | events.py — WireGuard and firewall event processing. | |
| 6 | + | """ | |
| 7 | + | ||
| 8 | + | import os | |
| 9 | + | import json | |
| 10 | + | import sys | |
| 11 | + | from collections import defaultdict | |
| 12 | + | from datetime import datetime | |
| 13 | + | ||
| 14 | + | from 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 | + | ||
| 27 | + | def 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 | |
Siguiente
Anterior