feat: add automation scripts for NAS fixes, Authentik monitoring, and Technitium DNS management
This commit is contained in:
26
scripts/test_tech_delete_record.py
Normal file
26
scripts/test_tech_delete_record.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import urllib.request
|
||||
import ssl
|
||||
import json
|
||||
import urllib.parse
|
||||
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
|
||||
def get_token(host):
|
||||
url = f"https://{host}/api/user/login?user=admin&pass=snarfnetadmin&includeInfo=true"
|
||||
with urllib.request.urlopen(urllib.request.Request(url), context=ctx, timeout=8) as resp:
|
||||
return json.loads(resp.read().decode())['token']
|
||||
|
||||
token = get_token("dns1.snarfnet.net")
|
||||
params = {
|
||||
"token": token,
|
||||
"domain": "test.snarfnet.net",
|
||||
"zone": "snarfnet.net",
|
||||
"type": "A",
|
||||
"ipAddress": "140.44.4.11",
|
||||
"ptr": "true"
|
||||
}
|
||||
url = f"https://dns1.snarfnet.net/api/zones/records/delete?{urllib.parse.urlencode(params)}"
|
||||
with urllib.request.urlopen(urllib.request.Request(url), context=ctx, timeout=8) as resp:
|
||||
print("Delete record response:", json.loads(resp.read().decode()))
|
||||
Reference in New Issue
Block a user