Skip to content

Latest commit

 

History

History
277 lines (198 loc) · 6.9 KB

File metadata and controls

277 lines (198 loc) · 6.9 KB

Spaceship Domain Management Tools

Python scripts for managing domains via the Spaceship.com API. Automate domain transfers, DNS management, and more.

🚀 Features

1. Unlock Domains & Get Auth Codes (unlock_domain_transfers.py)

  • 🔓 Unlocks domain transfer locks
  • 🔑 Retrieves authorization/EPP codes automatically
  • 💾 Saves all results to CSV
  • ✅ Supports batch processing of hundreds of domains

2. Delete A Records (delete_spaceship_a_records.py)

  • 🗑️ Removes all A records from domains
  • 📋 Processes domains from CSV
  • 🔸 Dry-run mode to preview changes
  • ⚡ Built-in rate limiting

📋 Prerequisites

  1. Python 3.x

  2. Spaceship API Credentials

    • Go to: https://www.spaceship.com/application/api-manager/
    • Click "New API key"
    • Enable required permissions:
      • domains:read - Read domain information
      • domains:transfer - Unlock domains and get auth codes
      • dnsrecords:read - Read DNS records
      • dnsrecords:write - Modify/delete DNS records
    • Save your API Key and API Secret
  3. Python Dependencies

    pip install requests

🔧 Setup

1. Clone or Download

git clone https://github.com/yourusername/spaceship-domain-tools.git
cd spaceship-domain-tools

2. Install Dependencies

pip install -r requirements.txt

3. Configure API Credentials

Create a .env file in the project directory:

cp .env.example .env

Edit .env and add your credentials:

SPACESHIP_API_KEY=your_api_key_here
SPACESHIP_API_SECRET=your_api_secret_here

⚠️ Important: Never commit .env to git! It's already in .gitignore.

📖 Usage

Unlock Domains & Get Auth Codes

From CSV File

# Dry-run first (recommended)
python3 unlock_domain_transfers.py --csv domains.csv --dry-run

# Run for real
python3 unlock_domain_transfers.py --csv domains.csv --yes

Single Domain

# With confirmation prompt
python3 unlock_domain_transfers.py --domain example.com

# Skip confirmation
python3 unlock_domain_transfers.py --domain example.com --yes

CSV Input Format

The script accepts two formats:

Format 1: Plain text (one domain per line)

example.com
test.com
mysite.com

Format 2: CSV with headers

domain,platform
example.com,Spaceship
test.com,Spaceship

Output

Results are saved to unlock_results.csv:

domain unlock_success unlock_message is_locked auth_code auth_code_expires timestamp
example.com True Unlocked False ABC123xyz@#$ 2100-01-01T00:00:00Z 2025-10-23T10:30:45

The auth_code column contains the codes you need for transferring domains!

Delete A Records

From CSV File

# Dry-run first (recommended)
python3 delete_spaceship_a_records.py --csv domains.csv --dry-run

# Run for real
python3 delete_spaceship_a_records.py --csv domains.csv

The script will:

  1. Load domains from CSV (filters for platform=Spaceship by default)
  2. Fetch DNS records for each domain
  3. Identify A records
  4. Delete them (with confirmation)

⚙️ Command Line Options

unlock_domain_transfers.py

Required (one of):
  --csv FILE          Path to CSV file or plain text file with domains
  --domain DOMAIN     Single domain name

Optional:
  --dry-run          Preview changes without making them
  --yes, -y          Skip confirmation prompts
  --platform NAME    Filter CSV by platform (default: None)
  --output FILE      Output CSV path (default: unlock_results.csv)
  --lock             Lock domains instead of unlocking
  --api-key KEY      API key (or use .env)
  --api-secret SEC   API secret (or use .env)

delete_spaceship_a_records.py

Optional:
  --csv FILE          Path to CSV file (default: domain_resolution_results.csv)
  --dry-run          Preview what would be deleted
  --api-key KEY      API key (or use .env)
  --api-secret SEC   API secret (or use .env)

🔒 Security Best Practices

  1. Never commit .env files - Already in .gitignore
  2. Keep auth codes secure - The output CSV contains sensitive data
  3. Use dry-run first - Always preview changes before running
  4. Limit API permissions - Only enable what you need
  5. Rotate keys regularly - Generate new API keys periodically

📊 Examples

Example 1: Transfer 100 domains to another registrar

# Step 1: Create a list of domains
cat > my_domains.txt <<EOF
example.com
test.com
mysite.com
EOF

# Step 2: Unlock and get auth codes (dry-run first)
python3 unlock_domain_transfers.py --csv my_domains.txt --dry-run

# Step 3: Run for real
python3 unlock_domain_transfers.py --csv my_domains.txt --yes

# Step 4: Open the results to get auth codes
open unlock_results.csv

Example 2: Remove parking page A records

# Preview which domains have A records
python3 delete_spaceship_a_records.py --csv domains.csv --dry-run

# Delete them
python3 delete_spaceship_a_records.py --csv domains.csv

Example 3: Single domain transfer

# Quick unlock for one domain
python3 unlock_domain_transfers.py --domain example.com --yes

# View the auth code
cat unlock_results.csv | grep example.com

🚨 Troubleshooting

"Permission denied - check domains:transfer scope"

  • Your API key doesn't have the required permission
  • Regenerate the key with correct scopes at the API manager

"Domain not found"

  • Domain is not in your Spaceship account
  • Check spelling or verify ownership

"Rate limit exceeded"

  • Wait a few minutes before retrying
  • Scripts include rate limiting (1.5s per domain)

"EOF when reading a line"

  • You're running in the background without --yes flag
  • Add --yes flag or run in foreground

📝 Rate Limits

Spaceship API rate limits:

  • Transfer operations: 5 requests per domain within 300 seconds
  • DNS operations: Standard rate limits apply

Scripts are configured conservatively:

  • Unlock script: 1.5 seconds per domain (2 API calls each)
  • Delete script: 0.5 seconds between requests

🤝 Contributing

Found a bug or want to contribute? Feel free to:

  • Open an issue
  • Submit a pull request
  • Share feedback

📄 License

MIT License - feel free to use and modify as needed.

⚠️ Disclaimer

These scripts interact with live domain data. Always:

  • ✅ Use dry-run mode first
  • ✅ Keep backups of important DNS configurations
  • ✅ Test with a single domain before batch processing
  • ✅ Understand what each script does before running

🔗 Resources

📮 Support

For API-related issues, contact Spaceship support at: support@spaceship.com


Made with ❤️ for domain portfolio management