Download setup.py from podsni/sherlock: direct link, hf CLI and curl.
- Browser
- Download file 3.12 kB
-
https://huggingface.co/spaces/podsni/sherlock/resolve/main/setup.py
- Command line
-
hf download hf://spaces/podsni/sherlock/setup.py
-
curl -L -o setup.py https://huggingface.co/spaces/podsni/sherlock/resolve/main/setup.py
3.12 kB
| #!/usr/bin/env python3 | |
| """ | |
| Setup script for Sherlock OSINT Tool | |
| """ | |
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| def run_command(command: str, description: str) -> bool: | |
| """Run a command and return success status.""" | |
| print(f"π {description}...") | |
| try: | |
| result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True) | |
| print(f"β {description} completed successfully") | |
| return True | |
| except subprocess.CalledProcessError as e: | |
| print(f"β {description} failed: {e}") | |
| if e.stdout: | |
| print(f"STDOUT: {e.stdout}") | |
| if e.stderr: | |
| print(f"STDERR: {e.stderr}") | |
| return False | |
| def check_uv_installed() -> bool: | |
| """Check if UV is installed.""" | |
| try: | |
| result = subprocess.run(["uv", "--version"], capture_output=True, text=True) | |
| print(f"β UV is installed: {result.stdout.strip()}") | |
| return True | |
| except FileNotFoundError: | |
| print("β UV is not installed") | |
| return False | |
| def install_uv() -> bool: | |
| """Install UV package manager.""" | |
| print("π Installing UV package manager...") | |
| try: | |
| # Try to install UV | |
| install_cmd = "curl -LsSf https://astral.sh/uv/install.sh | sh" | |
| result = subprocess.run(install_cmd, shell=True, check=True) | |
| print("β UV installed successfully") | |
| return True | |
| except subprocess.CalledProcessError: | |
| print("β Failed to install UV automatically") | |
| print("Please install UV manually: https://astral.sh/uv/") | |
| return False | |
| def setup_environment() -> bool: | |
| """Set up the Python environment.""" | |
| print("\nπ Setting up Sherlock OSINT Tool environment...") | |
| # Check if UV is installed | |
| if not check_uv_installed(): | |
| if not install_uv(): | |
| return False | |
| # Create virtual environment and install dependencies | |
| commands = [ | |
| ("uv sync", "Installing dependencies with UV"), | |
| ("uv run python test_sherlock.py", "Running tests"), | |
| ] | |
| success = True | |
| for command, description in commands: | |
| if not run_command(command, description): | |
| success = False | |
| break | |
| return success | |
| def main(): | |
| """Main setup function.""" | |
| print("π Sherlock OSINT Tool Setup") | |
| print("=" * 40) | |
| # Check if we're in the right directory | |
| if not Path("data.json").exists(): | |
| print("β data.json not found. Please run this script from the sherlock directory.") | |
| sys.exit(1) | |
| # Set up environment | |
| if setup_environment(): | |
| print("\nπ Setup completed successfully!") | |
| print("\nπ Next steps:") | |
| print("1. Copy .env.example to .env and configure if needed") | |
| print("2. Run the web interface: uv run python app.py") | |
| print("3. Or run CLI: uv run python -m sherlock.cli --help") | |
| print("\nπ Web interface will be available at: http://localhost:7860") | |
| else: | |
| print("\nβ Setup failed. Please check the errors above.") | |
| sys.exit(1) | |
| if __name__ == "__main__": | |
| main() | |