Files
SnarfCode/scripts/inspect_authentik_dns_apps.py

35 lines
1.2 KiB
Python

import urllib.request
import ssl
import json
import sys
sys.stdout.reconfigure(encoding='utf-8')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
token = "SnarfNetPermanentAutomationToken2026"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
req = urllib.request.Request("https://authentik.snarfnet.net/api/v3/core/applications/", headers=headers)
with urllib.request.urlopen(req, context=ctx, timeout=8) as resp:
data = json.loads(resp.read().decode('utf-8'))
print("Applications matching pihole / technitium / dns:")
for app in data.get('results', []):
name = app.get('name', '').lower()
slug = app.get('slug', '').lower()
if 'pihole' in name or 'pihole' in slug or 'technitium' in name or 'technitium' in slug or 'dns' in name or 'dns' in slug:
print(f" Name: {app.get('name')}")
print(f" Slug: {app.get('slug')}")
print(f" PK: {app.get('pk')}")
print(f" Provider: {app.get('provider')}")
print(f" Launch URL: {app.get('meta_launch_url')}")
print(f" Group: {app.get('group')}")
print(f" Icon: {app.get('meta_icon')}")
print()