nuno gist felülvizsgálása 1 month ago. Revízióhoz ugrás
1 file changed, 20 insertions
gistfile1.txt(fájl létrehozva)
| @@ -0,0 +1,20 @@ | |||
| 1 | + | root@wireguard:~# sed -n '/^def fw_events/,/^def [a-z]/p' /etc/wireguard/wgctl/core/json_helper.py | grep -n "return\|print\|sys.exit\|raise" | |
| 2 | + | root@wireguard:~# sed -n '/^def fw_events/,/^def [a-z]/p' /etc/wireguard/wgctl/core/json_helper.py | tail -20 | |
| 3 | + | try: | |
| 4 | + | with open(conf) as f: | |
| 5 | + | for line in f: | |
| 6 | + | if line.startswith('Address'): | |
| 7 | + | ip = line.split('=')[1].strip().split('/')[0] | |
| 8 | + | ip_to_name[ip] = name | |
| 9 | + | except Exception: | |
| 10 | + | pass | |
| 11 | + | ||
| 12 | + | # Load net services for reverse lookup — independent of rest of function | |
| 13 | + | net_data = {} | |
| 14 | + | if net_file and os.path.exists(net_file): | |
| 15 | + | try: | |
| 16 | + | with open(net_file) as f: | |
| 17 | + | net_data = json.load(f) | |
| 18 | + | except Exception: | |
| 19 | + | pass | |
| 20 | + | ||
Újabb
Régebbi