mirror of
https://github.com/Kiritow/wg-ops.git
synced 2024-03-22 13:11:37 +08:00
Add tools
This commit is contained in:
parent
f491ce801e
commit
f4d46d9f94
15
tools/get-gateway.py
Normal file
15
tools/get-gateway.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
sys.stderr.write('python3 get-gateway.py <network>\n')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
network_name = sys.argv[1]
|
||||||
|
output = subprocess.check_output(["podman", "network", "inspect", network_name])
|
||||||
|
|
||||||
|
j = json.loads(output)
|
||||||
|
print(j[0]["plugins"][0]["ipam"]["ranges"][0][0]["gateway"])
|
Loading…
Reference in New Issue
Block a user