A Modern, Professional Tool for Searching and Collecting .onion Sites from the Clearnet
Made with ❤️ by Scayar
- Overview
- Features
- Architecture & Design
- Installation
- Usage
- Documentation
- Troubleshooting
- Security & Legal Notice
- Contributing
- Credits
ScayTor is a powerful, feature-rich command-line tool designed for security researchers, penetration testers, and cybersecurity enthusiasts who need to search and collect .onion (Tor hidden service) addresses from the clearnet.
- 🔍 Smart Search: Queries ahmia.fi search engine with intelligent retry mechanisms
- 🎨 Beautiful Interface: Hacker-themed CLI with color-coded output and animations
- 📊 Multiple Outputs: Generates both text files and professional HTML reports
- 🛡️ Robust Error Handling: Comprehensive error handling with exponential backoff
- ⚡ Performance: Threaded progress indicators and efficient processing
- 🌓 Dark/Light Mode: HTML reports support both themes with dynamic banner switching
| Feature | Description |
|---|---|
| 🔍 Smart Search | Queries ahmia.fi search engine for .onion sites |
| 🎯 Precise Extraction | Advanced regex pattern matching for valid .onion addresses (16-56 character base32) |
| 🔄 User-Agent Rotation | Randomizes user agents from user-agents.txt to avoid rate limiting |
| 📊 Progress Indicators | Real-time animated progress bars during network operations |
| 🎨 Beautiful CLI | Hacker-themed interface with color-coded output and typewriter effects |
| 💻 Command-Line Arguments | Support for --query, --limit, --output, and --no-progress flags |
| Format | Features |
|---|---|
| 📄 Text Files | Clean, line-separated .onion addresses saved to .txt files |
| 🌐 HTML Reports | Professional, responsive HTML reports with: • Dark/Light mode toggle • Dynamic banner images (CuteCat/Scarycat) • Clickable .onion links • Timestamp and search query display • Modern, accessible design |
- 🛡️ Error Handling: Comprehensive error handling with retry mechanisms and exponential backoff
- ⚡ Efficient: Threading for non-blocking progress updates
- 🔒 Safe: Proper URL encoding and input validation
- 📝 Logging: Clear status messages and warnings
- 🔄 Retry Logic: Automatic retries with exponential backoff on failures
flowchart TB
subgraph App["ScayTor Application"]
direction TB
A[CLI Interface] --> B[Argument Parser]
B --> C[Main Controller]
C --> D[Input Handler]
C --> E[Network Module]
C --> F[Processing Engine]
D --> G[Query Validator]
D --> H[Limit Validator]
E --> I[User-Agent Manager]
E --> J[HTTP Client]
E --> K[Progress Bar]
F --> L[Regex Extractor]
F --> M[Link Deduplicator]
C --> N[Output Generator]
N --> O[Text Writer]
N --> P[HTML Generator]
end
subgraph Ext["External Services"]
direction TB
Q[ahmia.fi Search Engine]
R[user-agents.txt File]
end
subgraph Out["Output Files"]
direction TB
S[.txt File]
T[.html Report]
end
J --> Q
I --> R
O --> S
P --> T
style A fill:#ff6b9d
style C fill:#00ffd0
style Q fill:#ff26a6
style S fill:#00ffd0
style T fill:#00ffd0
sequenceDiagram
participant U as User
participant C as CLI
participant P as Parser
participant N as Network
participant E as Extractor
participant O as Output
U->>C: Run ScayTor
C->>P: Parse Arguments
P-->>C: Config
alt Interactive Mode
C->>U: Prompt for Query
U-->>C: Search Query
C->>U: Prompt for Limit
U-->>C: Result Count
else CLI Arguments
C->>P: Read Args
P-->>C: Query & Limit
end
C->>N: Load User-Agent
N->>N: Read user-agents.txt
N-->>C: Random Agent
C->>N: Fetch Results
N->>N: HTTP GET Request
N->>N: Show Progress Bar
N-->>C: HTML Content
C->>E: Extract Links
E->>E: Regex Matching
E->>E: Deduplication
E-->>C: .onion Links
C->>U: Display Results
C->>O: Save Text File
C->>O: Generate HTML Report
O-->>C: Files Created
C->>U: Completion Message
┌─────────────────────────────────────────────────────────────────┐
│ ScayTor Workflow │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────┐
│ Print Banner │ ◄── ASCII Art Display
└────────┬────────┘
│
▼
┌──────────────────────────────┐
│ Parse Command-Line Args │
│ (--query, --limit, --output)│
└──────┬───────────────────────┘
│
┌────────────┴────────────┐
│ │
▼ ▼
┌───────────────┐ ┌───────────────┐
│ Interactive │ │ CLI Args │
│ Mode │ │ Mode │
└───────┬───────┘ └───────┬───────┘
│ │
└────────────┬────────────┘
│
▼
┌─────────────────┐
│ Get User Agent │ ◄── Random Selection
└────────┬────────┘ from user-agents.txt
│
▼
┌─────────────────┐
│ Build URL │ ◄── URL Encoding
│ & Headers │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Fetch Results │ ◄── HTTP GET
│ (with retries) │ Progress Bar
└────────┬────────┘ Exponential Backoff
│
▼
┌─────────────────┐
│ Extract Links │ ◄── Regex Pattern
│ (.onion URLs) │ Deduplication
└────────┬────────┘
│
▼
┌─────────────────┐
│ Display Results │ ◄── Console Output
│ (Colored) │ (Typewriter Effect)
└────────┬────────┘
│
▼
┌─────────────────────────────┐
│ Save to Files │
├─────────────────────────────┤
│ • .txt (plain text) │
│ • .html (styled report) │
└─────────────────────────────┘
flowchart TD
A[Start: HTML Content] --> B[Define Regex Pattern]
B --> C[Pattern: Base32 16-56 chars + .onion]
C --> D[Find All Matches]
D --> E{Matches Found?}
E -->|No| F[Return Empty List]
E -->|Yes| G[Convert to Dictionary]
G --> H[Keys Preserve Order]
H --> I[Remove Duplicates]
I --> J[Convert Back to List]
J --> K[Return Deduplicated Links]
style A fill:#00ffd0
style C fill:#ff26a6
style K fill:#00ffd0
Algorithm Details:
- Pattern:
\b[a-zA-Z2-7]{16,56}\.onion\b - Word Boundaries (
\b): Ensures complete matches - Base32 Alphabet (
[a-zA-Z2-7]): Tor uses base32 encoding - Length Range (
{16,56}): Valid .onion address length - Domain (
\.onion): Literal ".onion" TLD
flowchart TD
A[Start Request] --> B[Attempt = 1]
B --> C[HTTP GET Request]
C --> D{Success?}
D -->|Yes| E[Return HTML Content]
D -->|No| F{Attempt < Max?}
F -->|No| G[Return Failure]
F -->|Yes| H[Wait: 2 * Attempt seconds]
H --> I[Increment Attempt]
I --> C
style A fill:#00ffd0
style E fill:#00ffd0
style G fill:#ff26a6
Retry Strategy:
- Maximum Attempts: 3
- Exponential Backoff: 2s, 4s, 6s delays
- Timeout: 15 seconds per request
- Error Types: Timeout, ConnectionError, HTTPError
- Python 3.8+ (tested on 3.8, 3.9, 3.10, 3.11, 3.12)
- pip (Python package manager)
- Internet connection (for fetching search results)
# Clone the repository
git clone https://github.com/scayar/ScayTor.git
cd ScayTor
# Install dependencies
pip install -r requirements.txt
# Run ScayTor
python TorSearch.pygit clone https://github.com/scayar/ScayTor.git
cd ScayTorOr download and extract the ZIP file from the releases.
Using pip:
pip install -r requirements.txtOr manually:
pip install colorama requestsFor Python 3, you may need:
pip3 install colorama requestspython TorSearch.py --versionExpected output:
ScayTor 2.0.0
| Package | Version | Purpose |
|---|---|---|
colorama |
>=0.4.6 | Cross-platform colored terminal text |
requests |
>=2.31.0 | HTTP library for API requests |
python TorSearch.pyThe tool will prompt you for:
- Search query
- Number of results to retrieve
ScayTor supports various command-line arguments for automation and scripting:
python TorSearch.py --query "marketplace" --limit 20
python TorSearch.py -q "security" -l 10 -o results.txt
python TorSearch.py --query "tor" --limit 5 --no-progress| Flag | Short | Description | Example |
|---|---|---|---|
--query |
-q |
Search query | --query "marketplace" |
--limit |
-l |
Number of results | --limit 20 |
--output |
-o |
Output filename | --output results.txt |
--no-progress |
Disable progress bar | --no-progress |
|
--version |
-v |
Show version | --version |
___
,o88888
,o8888888'
,:o:o:oooo. ,8O88Pd8888"
,.::.::o:ooooOoOoO. ,oO8O8Pd888'"
,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"
, ..:.::o:ooOoOOOO8OOOOo.FdO8O8"
, ..:.::o:ooOoOO8O888O8O,COCOO"
, . ..:.::o:ooOoOOOO8OOOOCOCO"
. ..:.::o:ooOoOoOO8O8OCCCC"o
. ..:.::o:ooooOoCoCCC"o:o
. ..:.::o:o:,cooooCo"oo:o:
` . . ..:.:cocoooo"'o:o:::'
.` . ..::ccccoc"'o:o:o:::'
:.:. ,c:cccc"':.:.:.:.:.'
..:.:"'`::::c:"'..:.:.:.:.:.'
...:.'.:.::::"' . . . . .'
.. . ....:."' ` . . . . ''
. . . ...."'
.. . ."' ScayTor
[?] Enter your search: cybersecurity
[?] How many .onion sites do you want? 5
[*] Fetching from ahmia.fi |██████████████████████████████| 100%
[+] Found 12 .onion links. Displaying up to 5...
[01] example1234567890abcdef.onion
[02] example0987654321fedcba.onion
[03] exampleabcdef1234567890.onion
[04] examplefedcba0987654321.onion
[05] example1122334455667788.onion
[+] Completed! 5 links saved in a3b2c.txt
[+] HTML report generated: a3b2c.html
[=] Session complete. Stay anonymous, hacker.
$ python TorSearch.py --query "marketplace" --limit 10 --output market_results
___
,o88888
,o8888888'
,:o:o:oooo. ,8O88Pd8888"
,.::.::o:ooooOoOoO. ,oO8O8Pd888'"
,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"
, ..:.::o:ooOoOOOO8OOOOo.FdO8O8"
, ..:.::o:ooOoOO8O888O8O,COCOO"
, . ..:.::o:ooOoOOOO8OOOOCOCO"
. ..:.::o:ooOoOoOO8O8OCCCC"o
. ..:.::o:ooooOoCoCCC"o:o
. ..:.::o:o:,cooooCo"oo:o:
` . . ..:.:cocoooo"'o:o:::'
.` . ..::ccccoc"'o:o:o:::'
:.:. ,c:cccc"':.:.:.:.:.'
..:.:"'`::::c:"'..:.:.:.:.:.'
...:.'.:.::::"' . . . . .'
.. . ....:."' ` . . . . ''
. . . ...."'
.. . ."' ScayTor
[*] Fetching from ahmia.fi |██████████████████████████████| 100%
[+] Found 25 .onion links. Displaying up to 10...
[01] marketplace1234567890.onion
...
[+] Completed! 10 links saved in market_results.txt
[+] HTML report generated: market_results.html
[=] Session complete. Stay anonymous, hacker.Functions:
print_banner(): Displays ASCII art bannertype_out(): Animated character-by-character printinghacker_prompt(): Styled input prompts with typewriter effect
Features:
- Color-coded output (green for prompts, red for errors, cyan for info)
- Typewriter effect for dramatic presentation
- Cross-platform color support via colorama
Functions:
get_search_query(): Validates and URL-encodes search inputget_result_limit(): Ensures positive integer input
Validation Rules:
- Search query cannot be empty
- Result count must be positive integer
- Proper URL encoding using
urllib.parse.quote_plus
Functions:
get_user_agent(): Loads and randomizes user agentsfetch_results(): HTTP GET with retry logic and exponential backoffprogress_bar(): Animated progress indicator using threading
Features:
- 3 retry attempts on failure
- 15-second timeout per request
- Exponential backoff (2s, 4s, 6s delays)
- Threaded progress bar animation
- Random user-agent selection from
user-agents.txt - Enhanced HTTP headers for better compatibility
Functions:
extract_onion_links(): Regex-based link extraction with deduplication
Pattern:
\b[a-zA-Z2-7]{16,56}\.onion\bExplanation:
\b: Word boundary (prevents partial matches)[a-zA-Z2-7]: Base32 alphabet (no 0, 1, 8, 9){16,56}: Valid .onion address length range\.onion: Literal ".onion" TLD
Functions:
save_results(): Writes .txt file with linkssave_html_report(): Generates styled HTML report with dark/light mode
File Formats:
Text File:
- One .onion URL per line
- UTF-8 encoding
- Random 5-character alphanumeric filename (or custom via
--output) - Easy to parse programmatically
HTML File:
- Self-contained HTML with embedded CSS/JS
- Responsive design (mobile-friendly)
- Dark/Light mode toggle
- Dynamic banner switching (CuteCat/Scarycat)
- Clickable links (open in Tor Browser)
- Professional styling with CSS variables
flowchart TD
A[Operation] --> B{Error Type}
B -->|Timeout| C[Exponential Backoff]
B -->|Connection Error| C
B -->|HTTP Error| C
B -->|Other Exception| D[Log & Retry]
C --> E{Retries < Max?}
E -->|Yes| F[Wait & Retry]
E -->|No| G[Return Failure]
F --> A
D --> E
G --> H[Exit with Error Message]
style A fill:#00ffd0
style G fill:#ff26a6
style H fill:#ff26a6
Error Types Handled:
- TimeoutException → Exponential backoff
- ConnectionError → Exponential backoff
- HTTPError → Exponential backoff
- Other Exceptions → Log and retry with backoff
Retry Logic:
- Maximum 3 attempts
- Exponential backoff delays: 2s, 4s, 6s
- Clear error messages to user
- Graceful failure handling
Symptoms:
- Tool runs successfully but returns 0 links
Possible Causes:
- Search query too specific
- ahmia.fi returned no results
- Network connectivity issues
Solutions:
- Try broader search terms
- Check internet connection
- Verify ahmia.fi is accessible:
curl https://ahmia.fi - Try a different search query
Symptoms:
- Network requests fail repeatedly
Possible Causes:
- Network timeout
- ahmia.fi server issues
- Firewall blocking requests
- Proxy configuration
Solutions:
- Check internet connection
- Try again later (server might be down)
- Verify firewall/proxy settings
- Ensure
user-agents.txtexists - Try using
--no-progressflag
Symptoms:
- HTML report generated but banner images missing
Possible Causes:
- Banner images missing (
CuteCat.png,Scarycat.png) - Incorrect file paths
- File permissions
Solutions:
- Ensure
CuteCat.pngandScarycat.pngare in same directory as script - Check file permissions
- Verify filenames match exactly (case-sensitive on Linux/Mac)
- Images are optional - report will work without them
Symptoms:
ModuleNotFoundError: No module named 'colorama'
Possible Causes:
- Dependencies not installed
- Wrong Python environment
- Virtual environment not activated
Solutions:
# Install dependencies
pip install -r requirements.txt
# Or manually
pip install colorama requests
# For Python 3 specifically
pip3 install colorama requests
# If using virtual environment
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
pip install -r requirements.txtSymptoms:
- Error when trying to save output files
Possible Causes:
- Insufficient write permissions
- Read-only directory
- Disk space full
Solutions:
- Run with appropriate permissions
- Change to writable directory:
cd ~/Desktop && python TorSearch.py - Check disk space:
df -h(Linux/Mac) or check in File Explorer (Windows) - Specify output directory:
--output /path/to/writable/dir/results.txt
Symptoms:
- Errors related to character encoding
Solutions:
- Ensure terminal supports UTF-8
- On Windows, use PowerShell or modern terminal (Windows Terminal)
- Files are saved with UTF-8 encoding by default
-
Legal Compliance
- This tool is for educational and research purposes only
- Users are responsible for complying with local laws
- Accessing illegal content is prohibited
- Use at your own risk
-
Privacy Considerations
- Search queries are sent to ahmia.fi (clearnet service)
- Consider using Tor Browser for maximum anonymity
- User-agent randomization helps but doesn't guarantee anonymity
- HTTP requests are not encrypted (use HTTPS when possible)
-
Security Best Practices
- Always use Tor Browser to access .onion links
- Verify links before clicking (some may be malicious)
- Be cautious of malicious sites
- Don't share personal information on dark web sites
- Keep your system updated and use antivirus software
-
Ethical Use
- Use responsibly and ethically
- Respect terms of service of ahmia.fi
- Don't abuse the service with excessive requests
- Follow rate limiting best practices
| Use Case | Recommendation |
|---|---|
| Research | Use in controlled environments with proper authorization |
| Security Testing | Get proper authorization before testing |
| Exploration | Use Tor Browser and VPN for additional privacy |
| Privacy | Consider running through Tor network or VPN |
| Automation | Implement delays between requests to avoid rate limiting |
Contributions are welcome! Please follow these guidelines:
flowchart LR
A[Fork Repository] --> B[Create Branch]
B --> C[Make Changes]
C --> D[Test Thoroughly]
D --> E[Commit Changes]
E --> F[Push to Branch]
F --> G[Open Pull Request]
G --> H[Code Review]
H --> I{Merge?}
I -->|Yes| J[Merge to Main]
I -->|No| K[Request Changes]
K --> C
style A fill:#00ffd0
style J fill:#00ffd0
style K fill:#ff26a6
Workflow Steps:
- Fork the repository on GitHub
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your code changes following PEP 8
- Test thoroughly on different Python versions
- Commit changes with clear messages
- Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request on GitHub
- Wait for code review
- Address feedback or celebrate merge! 🎉
-
Fork the repository
git fork https://github.com/scayar/ScayTor.git
-
Create a feature branch
git checkout -b feature/amazing-feature
-
Make your changes
- Follow PEP 8 (Python style guide)
- Use descriptive variable names
- Add comments for complex logic
- Maintain existing formatting
-
Test thoroughly
- Test on different Python versions
- Test on different operating systems
- Test edge cases
-
Commit with clear messages
git commit -m 'Add amazing feature: description' -
Push to branch
git push origin feature/amazing-feature
-
Open a Pull Request
- Provide clear description
- Reference related issues
- Include screenshots if UI changes
- Follow PEP 8 (Python style guide)
- Use descriptive variable names
- Add comments for complex logic
- Maintain existing formatting
- Write docstrings for functions
- Use type hints where appropriate
If you find a bug, please open an issue with:
- Description of the problem
- Steps to reproduce
- Expected vs. actual behavior
- System information (OS, Python version)
- Error messages (if any)
- Screenshots (if applicable)
Scayar
- 🌐 Website: Scayar.com
- 📧 Email:
Scayar.exe@gmail.com - 💬 Telegram: @im_scayar
- ☕ Buy Me a Coffee: buymeacoffee.com/scayar
- ahmia.fi for providing the search API
- Tor Project for creating the Tor network
- Python Community for excellent libraries (
colorama,requests) - Contributors who help improve ScayTor
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Potential features for future versions:
- Multiple search engine support (notjustahmia, others)
- Export to JSON/CSV formats
- Link validation (check if .onion sites are active)
- Search history tracking
- Configurable themes
- Batch search capability
- Proxy support (SOCKS5, HTTP)
- Rate limiting configuration
- Database storage for results
- API mode (RESTful interface)
- Docker containerization
- GUI version (Tkinter/PyQt)
Made with ❤️ by Scayar
Stay Anonymous, Stay Safe 🛡️