
पुरानी Ghost CMS वेबसाइटें जो CVE-2026-26980 के कारण समझौता (compromised) हो गई हैं, उनके पेजों में स्पैम कोड इंजेक्शन की समस्या उत्पन्न हो सकती है। इसका उपयोग कोड इंजेक्शन फ़ील्ड्स को थोक में साफ़ करने और संपादित करने के लिए करें।
Removes all per-post and per-page code injection from a Ghost CMS site via the Admin API.
Site-wide code injection (Ghost Admin → Settings → Code injection) is never touched.
pip install requests PyJWT
6478abc123def456:8f9e0d1c2b3a4567890abcdef1234567890abcdef1234567890abcdef12345678
स्क्रिप्ट के समान निर्देशिका में ghost_cleaner_config.json नामक एक फ़ाइल बनाएँ:
{
"ghost_url": "https://yourdomain.com",
"admin_api_key": "YOUR_KEY_ID:YOUR_KEY_SECRET"
}
यदि आप यह चरण छोड़ देते हैं, तो स्क्रिप्ट पहली बार चलने पर आपके लिए एक उदाहरण कॉन्फ़िग फ़ाइल बना देगी और बाहर निकल जाएगी — बस उसे भरें और दोबारा चलाएँ।
कुछ भी छूने से पहले यह देखने के लिए कि वास्तव में क्या साफ़ किया जाएगा, इसे हमेशा पहले चलाएँ:
python3 ghost_injection_cleaner.py
उदाहरण आउटपुट:
Ghost Injection Remover
Mode : DRY-RUN (read-only)
Target: https://yourdomain.com
NOTE: /ghost/api/admin/settings/ (site-wide injection) is
never read or written by this script.
============================================================
POSTS
============================================================
47 posts fetched.
✦ 'My First Post'
HEAD: '<script>(function(){var _x="...obfuscated..."</script>'
🔍 DRY-RUN — would be cleared.
============================================================
PAGES
============================================================
6 pages fetched.
============================================================
SUMMARY
============================================================
Would clear : 1 posts/pages
Already clean: 52 posts/pages
Re-run with --apply to commit these changes.
जब ड्राई-रन आउटपुट से आप संतुष्ट हों, तो --apply के साथ चलाएँ। पुष्टि करने के लिए संकेत दिया जाएगा:
python3 ghost_injection_cleaner.py --apply
Type YES to confirm changes to posts and pages: YES
...
✅ Cleared.
python3 ghost_injection_cleaner.py --config /path/to/my_config.json
हर पोस्ट और पेज के लिए, यह इन दोनों फ़ील्ड को null पर सेट करता है:
| फ़ील्ड | Ghost एडिटर में स्थान |
|---|---|
codeinjection_head | Post/page settings → Code injection → Header |
codeinjection_foot | Post/page settings → Code injection → Footer |
जिन पोस्ट और पेजों में कोई इंजेक्शन नहीं है, उन्हें चुपचाप छोड़ दिया जाता है।
Missing dependencies
pip install requests PyJWT चलाएँ और पुनः प्रयास करें।
admin_api_key must be in 'id:secret' format
सुनिश्चित करें कि आपकी कुंजी के बीच में एक कोलन है। इसे दो हेक्स स्ट्रिंग्स की तरह दिखना चाहिए जो : से अलग हों। बिना स्पेस डाले इसे सीधे Ghost Admin से कॉपी करें।
401 Unauthorized
आपकी Admin API कुंजी गलत हो सकती है या इंटीग्रेशन हटा दिया गया हो सकता है। Ghost Admin → Settings → Integrations पर जाकर जाँच करें।
ConnectionError या टाइमआउट
जाँचें कि आपके कॉन्फ़िग में ghost_url सही है और जिस मशीन पर आप स्क्रिप्ट चला रहे हैं, वहाँ से साइट पहुँच योग्य है।
बड़ी साइट पर स्क्रिप्ट हैंग हो जाती है 50 पोस्टों का प्रत्येक पृष्ठ एक नया JWT उत्पन्न करता है और API की प्रतीक्षा करता है। यह सामान्य है — इसे एक मिनट दें।