v2: ID verification by state, 15 photos/5 albums, 20 quick replies, logo, mobile polish
This commit is contained in:
25
deploy/list-cf-zones.py
Normal file
25
deploy/list-cf-zones.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import re
|
||||
import urllib.request
|
||||
import paramiko
|
||||
|
||||
PASS = "Bbt9115xty9176!"
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("10.10.0.1", username="admin", password=PASS, timeout=15)
|
||||
_, o, e = c.exec_command("cat /usr/local/etc/wan-dns-failover.env", timeout=30)
|
||||
o.channel.recv_exit_status()
|
||||
TOK = re.search(r"CLOUDFLARE_API_TOKEN=([^\s\"']+)", (o.read() + e.read()).decode()).group(1)
|
||||
c.close()
|
||||
|
||||
req = urllib.request.Request(
|
||||
"https://api.cloudflare.com/client/v4/zones?per_page=50",
|
||||
headers={"Authorization": f"Bearer {TOK}", "Content-Type": "application/json"},
|
||||
)
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
zones = json.load(r)["result"]
|
||||
|
||||
for z in sorted(zones, key=lambda x: x["name"]):
|
||||
mark = " <--" if "exposed" in z["name"] or "gay" in z["name"] else ""
|
||||
print(f"{z['name']:35} {z['status']:10} {z['id']}{mark}")
|
||||
Reference in New Issue
Block a user