Update README
This commit is contained in:
85
purge_cf_cache.py
Normal file
85
purge_cf_cache.py
Normal file
@ -0,0 +1,85 @@
|
||||
"""Purge Cloudflare cache for robots.txt on gfil-lab.com"""
|
||||
import urllib.request, json, sys, io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
|
||||
|
||||
# gfil-lab.com Cloudflare zone
|
||||
CF_TOKEN = "cfut_xRDcVVOTE9hLWxe8fFUG1Xgv7aQVtV0ytWFYZKimffcc10e3"
|
||||
# Need zone ID for gfil-lab.com - get it first
|
||||
headers = {
|
||||
"Authorization": "Bearer " + CF_TOKEN,
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
# List zones to find gfil-lab.com zone ID
|
||||
req = urllib.request.Request("https://api.cloudflare.com/client/v4/zones", headers=headers)
|
||||
r = urllib.request.urlopen(req, timeout=15)
|
||||
data = json.loads(r.read().decode())
|
||||
for z in data.get("result", []):
|
||||
print(f" Zone: {z['name']} -> ID: {z['id']}")
|
||||
|
||||
# Find gfil-lab.com zone
|
||||
zone_id = None
|
||||
for z in data.get("result", []):
|
||||
if z["name"] == "gfil-lab.com":
|
||||
zone_id = z["id"]
|
||||
break
|
||||
|
||||
if not zone_id:
|
||||
print("ERROR: gfil-lab.com zone not found")
|
||||
sys.exit(1)
|
||||
|
||||
print(f"\nPurging cache for gfil-lab.com (zone: {zone_id})...")
|
||||
|
||||
# Purge specific URLs
|
||||
purge_data = json.dumps({
|
||||
"files": [
|
||||
"https://gfil-lab.com/robots.txt",
|
||||
"https://gfil-intel.xyz/robots.txt"
|
||||
]
|
||||
}).encode("utf-8")
|
||||
|
||||
req = urllib.request.Request(
|
||||
f"https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache",
|
||||
data=purge_data,
|
||||
headers=headers,
|
||||
method="POST"
|
||||
)
|
||||
r = urllib.request.urlopen(req, timeout=15)
|
||||
result = json.loads(r.read().decode())
|
||||
print(f" Purge result: {result.get('success', False)}")
|
||||
|
||||
# Also try gfil-intel.xyz zone
|
||||
zone_id2 = None
|
||||
for z in data.get("result", []):
|
||||
if z["name"] == "gfil-intel.xyz":
|
||||
zone_id2 = z["id"]
|
||||
break
|
||||
|
||||
if zone_id2:
|
||||
print(f"\nPurging cache for gfil-intel.xyz (zone: {zone_id2})...")
|
||||
purge_data2 = json.dumps({"files": ["https://gfil-intel.xyz/robots.txt"]}).encode("utf-8")
|
||||
req2 = urllib.request.Request(
|
||||
f"https://api.cloudflare.com/client/v4/zones/{zone_id2}/purge_cache",
|
||||
data=purge_data2,
|
||||
headers=headers,
|
||||
method="POST"
|
||||
)
|
||||
r2 = urllib.request.urlopen(req2, timeout=15)
|
||||
result2 = json.loads(r2.read().decode())
|
||||
print(f" Purge result: {result2.get('success', False)}")
|
||||
|
||||
# Wait and verify
|
||||
import time
|
||||
print("\nWaiting 3 seconds for cache purge...")
|
||||
time.sleep(3)
|
||||
|
||||
print("\n=== Verification after purge ===")
|
||||
import urllib.request as ur
|
||||
for domain in ["gfil-lab.com", "gfil-intel.xyz"]:
|
||||
try:
|
||||
req = ur.Request("https://" + domain + "/robots.txt", headers={"User-Agent": "Mozilla/5.0", "Cache-Control": "no-cache"})
|
||||
r = ur.urlopen(req, timeout=10)
|
||||
content = r.read().decode()
|
||||
print(f" {domain}: {r.status} | {len(content)} chars | GPTBot={'GPTBot' in content} | ClaudeBot={'ClaudeBot' in content}")
|
||||
except Exception as e:
|
||||
print(f" {domain}: {e}")
|
||||
Reference in New Issue
Block a user