Initial commit: Consolidated DevOps scripts and K8s manifests

This commit is contained in:
codex
2026-06-05 07:00:43 +00:00
commit 08fa407f57
16 changed files with 922 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import urllib.request
import json
token = "LfObAyuwjRs_X7Emp-kNl4AFjU1FX0XdLqVwgX0p"
zone_id = "f019fee4c5b58c48e4493b931f800ff5" # makeanyplace.com
print("--- Page Rules ---")
req = urllib.request.Request(
f'https://api.cloudflare.com/client/v4/zones/{zone_id}/pagerules',
headers={'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'}
)
try:
resp = json.loads(urllib.request.urlopen(req).read())
print(json.dumps(resp, indent=2))
except Exception as e:
print("Error:", e)
print("\n--- Rulesets ---")
req2 = urllib.request.Request(
f'https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets',
headers={'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'}
)
try:
resp2 = json.loads(urllib.request.urlopen(req2).read())
print(json.dumps(resp2, indent=2))
except Exception as e:
print("Error:", e)
+48
View File
@@ -0,0 +1,48 @@
import urllib.request
import json
import sys
# Try both tokens
tokens = [
"LfObAyuwjRs_X7Emp-kNl4AFjU1FX0XdLqVwgX0p",
"cfat_ub1jXkUJinoJDmhiUJJpwQni2rSVnLnysHzvcwwH351fdff8"
]
domains = ["makeanyplace.com", "makeanyplace.org"]
for token in tokens:
print(f"=== Trying Token: {token[:8]}... ===")
for domain in domains:
# Get Zone ID
req = urllib.request.Request(
f'https://api.cloudflare.com/client/v4/zones?name={domain}',
headers={'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'}
)
try:
resp = json.loads(urllib.request.urlopen(req).read())
if not resp.get('result'):
print(f"Zone {domain} not found with this token.")
continue
zone = resp['result'][0]
zone_id = zone['id']
status = zone['status']
print(f"Domain: {domain}, Zone ID: {zone_id}, Status: {status}")
print(f"Nameservers: {zone.get('name_servers', [])}")
# Fetch DNS Records
rec_req = urllib.request.Request(
f'https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records',
headers={'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'}
)
rec_resp = json.loads(urllib.request.urlopen(rec_req).read())
print("DNS Records at Cloudflare:")
for rec in rec_resp.get('result', []):
print(f" Type: {rec.get('type')}, Name: {rec.get('name')}, Content: {rec.get('content')}, Proxied: {rec.get('proxied')}")
except urllib.error.HTTPError as he:
print(f"HTTP Error for {domain}: {he.code} {he.reason}")
print(he.read().decode())
except Exception as e:
print(f"Error for {domain}: {e}")
print()
+37
View File
@@ -0,0 +1,37 @@
import urllib.request
import json
pb_key = "pk1_6e51c25cc1f0ded78246f0a4cd4a3cef404c47308dcc2f8b66bf8065ec6350bf"
pb_secret = "sk1_7dc521cdfb1a987285af2b811333e2fed77ba1013559c6671e25f948305d4f29"
domains = ["makeanyplace.com", "makeanyplace.org"]
for domain in domains:
print(f"=== Domain: {domain} ===")
# Get Nameservers
ns_req = urllib.request.Request(
f'https://api.porkbun.com/api/json/v3/domain/getNs/{domain}',
data=json.dumps({"apikey": pb_key, "secretapikey": pb_secret}).encode(),
headers={'Content-Type': 'application/json'}
)
try:
ns_resp = json.loads(urllib.request.urlopen(ns_req).read())
print(f"Nameservers: {ns_resp.get('ns', [])}")
except Exception as e:
print(f"Error getting NS: {e}")
# Get DNS Records
dns_req = urllib.request.Request(
f'https://api.porkbun.com/api/json/v3/domain/dns/retrieve/{domain}',
data=json.dumps({"apikey": pb_key, "secretapikey": pb_secret}).encode(),
headers={'Content-Type': 'application/json'}
)
try:
dns_resp = json.loads(urllib.request.urlopen(dns_req).read())
print("DNS Records:")
for rec in dns_resp.get('records', []):
print(f" Type: {rec.get('type')}, Name: {rec.get('name')}, Content: {rec.get('content')}")
except Exception as e:
print(f"Error getting DNS: {e}")
print()
+41
View File
@@ -0,0 +1,41 @@
import urllib.request, json, sys
cf_token = "LfObAyuwjRs_X7Emp-kNl4AFjU1FX0XdLqVwgX0p"
cf_account = "e3584bc80d5c6df89d93078172898d73"
pb_key = "pk1_6e51c25cc1f0ded78246f0a4cd4a3cef404c47308dcc2f8b66bf8065ec6350bf"
pb_secret = "sk1_7dc521cdfb1a987285af2b811333e2fed77ba1013559c6671e25f948305d4f29"
domain = "mrhavens.one"
# 1. Create Zone in Cloudflare
cf_req = urllib.request.Request(
'https://api.cloudflare.com/client/v4/zones',
data=json.dumps({"name": domain, "account": {"id": cf_account}, "type": "full"}).encode(),
headers={'Authorization': f'Bearer {cf_token}', 'Content-Type': 'application/json'}
)
try:
cf_resp = json.loads(urllib.request.urlopen(cf_req).read())
nameservers = cf_resp['result']['name_servers']
print("Cloudflare Zone Created. Nameservers:", nameservers)
except urllib.error.HTTPError as e:
err_body = e.read().decode()
if "already exists" in err_body or e.code == 400:
print("Zone already exists. Fetching...")
cf_get = urllib.request.Request(
f'https://api.cloudflare.com/client/v4/zones?name={domain}',
headers={'Authorization': f'Bearer {cf_token}', 'Content-Type': 'application/json'}
)
cf_resp = json.loads(urllib.request.urlopen(cf_get).read())
nameservers = cf_resp['result'][0]['name_servers']
print("Fetched existing zone nameservers:", nameservers)
else:
print("CF Error:", err_body)
sys.exit(1)
# 2. Update Porkbun Nameservers
pb_req = urllib.request.Request(
f'https://api.porkbun.com/api/json/v3/domain/updateNs/{domain}',
data=json.dumps({"apikey": pb_key, "secretapikey": pb_secret, "ns": nameservers}).encode(),
headers={'Content-Type': 'application/json'}
)
pb_resp = json.loads(urllib.request.urlopen(pb_req).read())
print("Porkbun Update Response:", pb_resp)
+20
View File
@@ -0,0 +1,20 @@
import urllib.request, json
pb_key = "pk1_6e51c25cc1f0ded78246f0a4cd4a3cef404c47308dcc2f8b66bf8065ec6350bf"
pb_secret = "sk1_7dc521cdfb1a987285af2b811333e2fed77ba1013559c6671e25f948305d4f29"
domain = "makeanyplace.org"
nameservers = ["adrian.ns.cloudflare.com", "buck.ns.cloudflare.com"]
print(f"Updating nameservers for {domain} on Porkbun...")
pb_req = urllib.request.Request(
f'https://api.porkbun.com/api/json/v3/domain/updateNs/{domain}',
data=json.dumps({"apikey": pb_key, "secretapikey": pb_secret, "ns": nameservers}).encode(),
headers={'Content-Type': 'application/json'}
)
try:
pb_resp = json.loads(urllib.request.urlopen(pb_req).read())
print(f"Success! Porkbun Response: {pb_resp}")
except Exception as e:
print(f"Failed to update Porkbun: {e}")