Skip to content

Latest commit

Β 

History

History
380 lines (300 loc) Β· 8.58 KB

IMPROVEMENTS.md

File metadata and controls

380 lines (300 loc) Β· 8.58 KB

Conan OSINT - Improvements & Bug Fixes

πŸ› Critical Bugs Fixed

1. PROFILE_COUNT Not Reset Between Searches

  • Issue: The atomic counter persisted between web searches, causing incorrect profile counts
  • Fix: Added PROFILE_COUNT.store(0, Ordering::Relaxed) at the start of each search
  • Files: src/web/server.rs:33

2. Missing Input Validation

  • Issue: Username input was not validated, allowing path traversal and invalid characters
  • Fix: Added comprehensive validation:
    • Length check (1-100 characters)
    • Path traversal prevention (.., /, \)
    • Proper error responses with 400 Bad Request
  • Files: src/web/server.rs:22-30

3. Poor Error Handling in Web Server

  • Issue: Early returns prevented file cleanup on errors
  • Fix: Implemented proper error handling with guaranteed cleanup:
    • Wrapped search logic in async block
    • Always cleanup output files regardless of success/failure
    • Return partial results with error messages
  • Files: src/web/server.rs:50-93

4. Missing data.json File

  • Issue: Critical file needed for compilation was gitignored
  • Fix: Created generate_sample_data.py to generate test dataset
  • Files: generate_sample_data.py, src/data.json

✨ New Features

1. Health Check & Status Endpoints

  • GET /health - Returns server health status and version
  • GET /status - Returns detailed server status, uptime, and configuration
  • Benefits:
    • Easy monitoring and debugging
    • Verify server is running before searches
    • Check if website data is loaded correctly
curl http://localhost:8080/health
# {"status":"healthy","version":"1.0.0"}

2. Batch Username Search

  • POST /batch-search - Search multiple usernames at once
  • Features:
    • Process multiple usernames in a single request
    • Individual validation and error handling per username
    • JSON response with per-username results and profile counts
  • Web UI: New "Batch Search" tab with textarea input

Example Request:

{
  "usernames": ["user1", "user2", "user3"],
  "api_key": "optional_key"
}

Example Response:

{
  "results": [
    {
      "username": "user1",
      "success": true,
      "message": "Found 15 profiles",
      "profile_count": 15
    }
  ]
}

3. JSON/CSV Export Module

  • New export.rs module for structured data export
  • Features:
    • Export search results to JSON format
    • Export search results to CSV format
    • Structured data with timestamps
    • Support for multiple result types
  • Usage: Foundation for future export endpoints

4. Enhanced Web UI

Loading States

  • Animated spinner during searches
  • Disabled buttons to prevent multiple submissions
  • Real-time search duration display

Tab Navigation

  • Single Search tab for individual lookups
  • Batch Search tab for multiple usernames
  • Clean, modern interface with smooth transitions

Better Error Handling

  • Color-coded message boxes (success/error/info)
  • Detailed error messages with troubleshooting hints
  • Graceful degradation on failures

Improved Visual Design

  • Loading spinner with animation
  • Success/error indicators
  • Batch result cards with status icons
  • Better typography and spacing
  • Responsive layout

5. Sample Data Generator

  • Python script to generate test data.json
  • Includes 12 popular platforms:
    • GitHub, Twitter, Instagram, Reddit
    • LinkedIn, YouTube, TikTok, Facebook
    • Pinterest, Twitch, Medium, Snapchat
  • Helps with testing and development

Usage:

python3 generate_sample_data.py

πŸ”§ Code Quality Improvements

1. Better Logging

  • Added middleware logger to web server
  • Better error messages with context
  • Console logging for debugging

2. Resource Management

  • Guaranteed file cleanup with proper error handling
  • Proper async error propagation
  • Memory-safe atomic operations

3. Security Enhancements

  • Input sanitization to prevent path traversal
  • Length limits on user input
  • Validation before processing

4. Code Organization

  • New export module for data export functionality
  • Separated concerns (search, export, web)
  • Reusable components

πŸ“Š API Documentation

Endpoints

POST /search

Search for a single username across all configured websites.

Request:

{
  "username": "testuser",
  "api_key": "optional_breach_directory_key"
}

Response: Plain text results with profile URLs


POST /batch-search

Search for multiple usernames at once.

Request:

{
  "usernames": ["user1", "user2"],
  "api_key": "optional_breach_directory_key"
}

Response:

{
  "results": [
    {
      "username": "user1",
      "success": true,
      "message": "Found 10 profiles",
      "profile_count": 10
    }
  ]
}

GET /health

Check if the server is healthy.

Response:

{
  "status": "healthy",
  "version": "1.0.0"
}

GET /status

Get detailed server status.

Response:

{
  "server": "Conan OSINT",
  "version": "1.0.0",
  "uptime": "1234567890",
  "websites_loaded": true
}

πŸš€ Usage Examples

Start the Web Server

cargo run --release -- web

Server will start at: http://127.0.0.1:8080

CLI Search

# Single username
cargo run --release -- search --username testuser

# With Breach Directory API
cargo run --release -- search --username testuser -b YOUR_API_KEY

# No false positives
cargo run --release -- search --username testuser --no-false-positives

Using the Web UI

  1. Open browser to http://127.0.0.1:8080
  2. Enter username in the search box
  3. (Optional) Add Breach Directory API key
  4. Click "Search"
  5. View results in real-time

Batch Search

  1. Click "Batch Search" tab
  2. Enter usernames (one per line)
  3. (Optional) Add API key
  4. Click "Search All"
  5. View results for all usernames

πŸ”„ Before & After Comparison

Before

❌ Profile count persisted between searches ❌ No input validation ❌ Poor error handling ❌ No health checks ❌ Basic web UI ❌ Missing data.json file ❌ No batch search capability

After

βœ… Profile count resets correctly βœ… Comprehensive input validation βœ… Robust error handling with cleanup βœ… Health and status endpoints βœ… Modern, responsive web UI βœ… Sample data generator included βœ… Batch search for multiple users βœ… Loading states and progress tracking βœ… JSON/CSV export foundation


πŸ“ Files Modified

Core Changes

  • src/web/server.rs - Complete refactor with new endpoints
  • src/lib.rs - Added export module
  • src/search.rs - No changes (maintained compatibility)
  • src/models.rs - No changes
  • src/breach_directory.rs - No changes

New Files

  • src/export.rs - Export functionality module
  • src/web/static/script.js - Enhanced with batch search
  • src/web/static/style.css - New styles for UI improvements
  • src/web/static/index.html - Updated with tabs and loading
  • generate_sample_data.py - Sample data generator
  • src/data.json - Generated test dataset
  • IMPROVEMENTS.md - This documentation

πŸ§ͺ Testing

Build Test

cargo build --release
# βœ… Compiles successfully

Run Tests

cargo test
# Includes tests for export module

Manual Testing

  1. Start server: cargo run -- web
  2. Open: http://127.0.0.1:8080
  3. Test single search
  4. Test batch search
  5. Check health endpoint
  6. Verify error handling with invalid input

🎯 Future Enhancements

Potential Features

  • Export endpoint (GET /export/{username}/{format})
  • Search history with caching
  • Rate limiting per IP
  • Webhook notifications
  • Dark mode toggle
  • Search result filtering
  • Statistics dashboard
  • Docker containerization
  • CI/CD pipeline
  • Complete website database from GoSearch

Performance Optimizations

  • Result caching with TTL
  • Database backend for history
  • WebSocket support for real-time updates
  • Progressive result streaming

πŸ“š Resources


🀝 Contributing

To contribute to this project:

  1. Review the code structure
  2. Add tests for new features
  3. Update documentation
  4. Follow Rust best practices
  5. Ensure all tests pass before committing

πŸ“„ License

GPL-3.0 - See LICENSE file for details


Version: 1.0.0 Last Updated: 2025-11-13 Improvements By: Claude Code Assistant