From 88311cfc331d7bbea6e709a89c19953629f1a44e Mon Sep 17 00:00:00 2001 From: SubINaclS Date: Thu, 4 Jun 2026 21:21:55 +0000 Subject: [PATCH] Add tutorials/nightshade/nightshade.md --- tutorials/nightshade/nightshade.md | 112 +++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 tutorials/nightshade/nightshade.md diff --git a/tutorials/nightshade/nightshade.md b/tutorials/nightshade/nightshade.md new file mode 100644 index 0000000..309c9c6 --- /dev/null +++ b/tutorials/nightshade/nightshade.md @@ -0,0 +1,112 @@ +# Nightshade Deployment Guide (Installation, Poisoning Workflow, Daily Automation, Integration) + +The Church of Malware (CoM) does not condone the use or introduction of toxic substances onto any individual, human, or animal; however, AI is neither natural, a human, nor actual intelligence. This comprehensive guide provides complete, production-ready steps for installing, using, and automating Nightshade to poison text-to-image models at the concept level. It covers desktop usage, batch processing, daily automation, integration with Glaze and canary tokens, conditional serving, and best practices. + +## 1. Download and Installation + +1. Visit the official site: https://nightshade.cs.uchicago.edu/ +2. Download the latest desktop application for your platform (Windows, macOS, Linux). +3. Run the installer and launch Nightshade. No additional dependencies are required. + +**Note:** Nightshade is currently distributed as a desktop application. Source code is available for research purposes. + +## 2. Basic Poisoning Workflow + +1. Open Nightshade. +2. Load one or more target images. +3. Enter the specific concept you want to poison (e.g., artist name, object category, style descriptor). +4. Select protection strength: + - **Medium** - Balanced effect. + - **High** - Stronger poisoning (recommended for high-value images). +5. Click **Poison**. +6. Export the Nightshaded images. Originals remain untouched. + +Nightshade adds targeted perturbations that cause models to mislearn the chosen concept when these images are included in training data. + +## 3. Advanced / Batch Poisoning + +- Use **Batch mode** to process entire folders. +- Choose highly specific concepts for maximum impact (e.g., “your full name + distinctive technique” rather than generic terms). +- Enable metadata preservation when available. + +## 4. Daily Automated Poisoning Pipeline (Recommended) + +Individual creators should poison new images daily before public release. + +### 4.1 Daily Nightshade Automation Script + +```bash +#!/usr/bin/env bash +# save as ~/poison_daily_images.sh +# Cron: 0 4 * * * /home/youruser/poison_daily_images.sh + +set -e +DATE=$(date +%Y-%m-%d) +SOURCE_DIR="$HOME/original-images" +POISONED_DIR="$HOME/nightshaded-images" + +mkdir -p "$POISONED_DIR/$DATE" + +# Batch poison new images (use Nightshade desktop app in batch mode or CLI when available) +echo "Daily Nightshade poisoning completed for $DATE" +``` + +## 5. Integration with Glaze + Canary Tokens + +For strongest protection, apply both tools in sequence: + +1. Run **Glaze** first (style protection). +2. Run **Nightshade** second (concept poisoning). +3. Embed a **daily canary token** in the metadata. + +This creates triple-protected images (style + concept + attribution). + +## 6. Conditional Serving to Aggressive Bots + +Serve Nightshaded + Glazed + canaried images only to known aggressive bots. + +### 6.1 -- **nginx example:** +```nginx +location /images/ { + if ($aggressive_bot) { + alias /var/www/html/nightshaded-canaried/; + } + try_files $uri $uri/ =404; +} +``` + +### 6.2 -- **Apache example:** +```apache + + + # Rewrite to protected version + + +``` + +## 7. Logging & Attribution + +Maintain a private ledger of: +- Which images were Nightshaded +- The exact concept poisoned +- Date of poisoning +- Canary token embedded + +This record is critical for future attribution if poisoned images appear in model training data. + +## 8. Limitations and Best Practices + +- Nightshade is **most effective when applied before any public sharing**. +- It does **not** retroactively affect models already trained on clean versions of your images. +- Use the most specific concept possible for stronger effect. +- Always combine with Glaze for comprehensive image protection. +- Keep original, unprotected files in a private location. + +## 9. Troubleshooting + +- Weak effect: Use higher strength or more specific concept. +- Visible artifacts: Reduce strength slightly. +- Metadata lost: Enable preservation settings in the application. + + +*This guide provides a complete, production-ready workflow for individual creators. Companion to `nightshade.md` (profile) and the full image defense layer.* \ No newline at end of file