gistfile1.txt
· 819 B · Text
原始檔案
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"
root@wireguard:~# sed -n '/^def fw_events/,/^def [a-z]/p' /etc/wireguard/wgctl/core/json_helper.py | tail -20
try:
with open(conf) as f:
for line in f:
if line.startswith('Address'):
ip = line.split('=')[1].strip().split('/')[0]
ip_to_name[ip] = name
except Exception:
pass
# Load net services for reverse lookup — independent of rest of function
net_data = {}
if net_file and os.path.exists(net_file):
try:
with open(net_file) as f:
net_data = json.load(f)
except Exception:
pass
| 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 | |
| 21 |