### Holehe Docker Usage Examples Source: https://context7.com/megadose/holehe/llms.txt Provides instructions for building and running Holehe within a Docker container. This allows for execution without local dependency installation, demonstrating how to build the image and run scans with or without additional flags. ```bash # Build the Docker image docker build . -t holehe-image # Run a scan using Docker docker run holehe-image holehe target@example.com # Run with additional flags docker run holehe-image holehe target@example.com --only-used --csv ``` -------------------------------- ### Install Holehe from GitHub Source: https://github.com/megadose/holehe/blob/master/README.md Installs Holehe by cloning the GitHub repository and running the setup script. This method is useful for developers who want to access the latest code or contribute to the project. ```bash git clone https://github.com/megadose/holehe.git cd holehe/ python3 setup.py install ``` -------------------------------- ### Install Holehe via PyPI Source: https://github.com/megadose/holehe/blob/master/README.md Installs the Holehe OSINT tool using pip, the Python package installer. This is the simplest method for users who have Python and pip set up. ```bash pip3 install holehe ``` -------------------------------- ### Holehe CLI Usage Examples Source: https://context7.com/megadose/holehe/llms.txt Demonstrates various command-line interface commands for Holehe, including basic scans, filtering results, exporting to CSV, and setting timeouts. It shows how to check email registration status and interpret the output. ```bash # Basic email scan holehe test@gmail.com # Show only websites where the email is registered holehe test@gmail.com --only-used # Export results to CSV file holehe test@gmail.com --csv # Disable colored output holehe test@gmail.com --no-color # Set custom timeout (default is 10 seconds) holehe test@gmail.com --timeout 15 # Skip password recovery methods (some sites like Adobe use this) holehe test@gmail.com --no-password-recovery # Example output: # ******************** # test@gmail.com # ******************** # [+] spotify.com # [+] twitter.com # [-] instagram.com # [x] snapchat.com (rate limited) # # [+] Email used, [-] Email not used, [x] Rate limit, [!] Error # 120 websites checked in 8.45 seconds ``` -------------------------------- ### Run Holehe with Docker Source: https://github.com/megadose/holehe/blob/master/README.md Builds a Docker image for Holehe and runs it to check an email address. This is ideal for users who prefer containerized environments or want a consistent setup. ```bash docker build . -t my-holehe-image docker run my-holehe-image holehe test@gmail.com ``` -------------------------------- ### Use Holehe in Python Application Source: https://github.com/megadose/holehe/blob/master/README.md Integrates Holehe's functionality into a Python application using the `trio` and `httpx` libraries. This example demonstrates how to check for a Snapchat account associated with an email. ```python import trio import httpx from holehe.modules.social_media.snapchat import snapchat async def main(): email = "test@gmail.com" out = [] client = httpx.AsyncClient() await snapchat(email, client, out) print(out) await client.aclose() trio.run(main) ``` -------------------------------- ### Python: Check Multiple Services Concurrently with Holehe Source: https://context7.com/megadose/holehe/llms.txt Illustrates how to check multiple services concurrently for email registration using the Holehe Python library and trio's nursery for parallel execution. It shows importing various service modules and processing the aggregated results. ```python import trio import httpx from holehe.modules.social_media.twitter import twitter from holehe.modules.social_media.instagram import instagram from holehe.modules.programing.github import github from holehe.modules.mails.google import google async def check_multiple_services(): email = "target@example.com" results = [] client = httpx.AsyncClient(timeout=10) # Run all checks concurrently async with trio.open_nursery() as nursery: nursery.start_soon(twitter, email, client, results) nursery.start_soon(instagram, email, client, results) nursery.start_soon(github, email, client, results) nursery.start_soon(google, email, client, results) await client.aclose() # Process results for result in sorted(results, key=lambda x: x['name']): status = "[+]" if result['exists'] else "[-]") if result['rateLimit']: status = "[x]" print(f"{status} {result['domain']}") trio.run(check_multiple_services) # Output: # [+] github.com # [-] google.com # [x] instagram.com # [+] twitter.com ``` -------------------------------- ### Python: Check Single Service with Holehe Source: https://context7.com/megadose/holehe/llms.txt Demonstrates how to use the Holehe Python library to check a specific service (e.g., Snapchat) for email registration. It utilizes the trio library for asynchronous operations and httpx for making HTTP requests, showing how to process the results. ```python import trio import httpx from holehe.modules.social_media.snapchat import snapchat async def check_snapchat(): email = "test@gmail.com" results = [] client = httpx.AsyncClient(timeout=10) await snapchat(email, client, results) await client.aclose() # Results contain a dictionary with check details for result in results: print(f"Service: {result['name']}") print(f"Domain: {result['domain']}") print(f"Exists: {result['exists']}") print(f"Rate Limited: {result['rateLimit']}") print(f"Recovery Email: {result['emailrecovery']}") print(f"Phone Number: {result['phoneNumber']}") trio.run(check_snapchat) # Output: # Service: snapchat # Domain: snapchat.com # Exists: True # Rate Limited: False # Recovery Email: None # Phone Number: None ``` -------------------------------- ### Full Email Scan with All Python Modules Source: https://context7.com/megadose/holehe/llms.txt Dynamically imports and runs all available holehe modules to perform a comprehensive email scan. It utilizes trio for concurrent checks and httpx for asynchronous HTTP requests. The results are then categorized into found, not found, and rate-limited services. ```python import trio import httpx from holehe.core import import_submodules, get_functions async def full_scan(email: str): # Import all holehe modules dynamically modules = import_submodules("holehe.modules") websites = get_functions(modules) results = [] client = httpx.AsyncClient(timeout=10) async def check_site(module, email, client, out): try: await module(email, client, out) except Exception: pass # Run all checks concurrently async with trio.open_nursery() as nursery: for website in websites: nursery.start_soon(check_site, website, email, client, results) await client.aclose() # Categorize results found = [r for r in results if r['exists'] == True] not_found = [r for r in results if r['exists'] == False and not r['rateLimit']] rate_limited = [r for r in results if r['rateLimit'] == True] print(f"Email: {email}") print(f"Found on {len(found)} services:") for r in sorted(found, key=lambda x: x['name']): extras = "" if r['emailrecovery']: extras += f" | Recovery: {r['emailrecovery']}" if r['phoneNumber']: extras += f" | Phone: {r['phoneNumber']}" if r['others'] and 'FullName' in str(r['others']): extras += f" | {r['others']}" print(f" [+] {r['domain']}{extras}") print(f"\nNot found: {len(not_found)}") print(f"Rate limited: {len(rate_limited)}") trio.run(full_scan, "test@gmail.com") # Output: # Email: test@gmail.com # Found on 15 services: # [+] github.com # [+] gravatar.com | {'FullName': 'John Doe / https://gravatar.com/johndoe'} # [+] spotify.com # [+] twitter.com # ... # # Not found: 98 # Rate limited: 7 ``` -------------------------------- ### Create Custom Holehe Module for MyService Source: https://context7.com/megadose/holehe/llms.txt This Python code defines a custom module for Holehe to check email registration status on 'myservice.com'. It sends a POST request to the service's API and outputs the result, including whether the email exists and rate limiting status. Dependencies include 'holehe.core' and 'holehe.localuseragent'. ```python from holehe.core import * from holehe.localuseragent import * async def myservice(email, client, out): name = "myservice" domain = "myservice.com" method = "register" # or "login", "password recovery", "other" frequent_rate_limit = False headers = { 'User-Agent': random.choice(ua["browsers"]["chrome"]), 'Accept': 'application/json', } try: # Make request to check email existence response = await client.post( "https://api.myservice.com/check-email", json={"email": email}, headers=headers ) data = response.json() exists = data.get("email_registered", False) out.append({ "name": name, "domain": domain, "method": method, "frequent_rate_limit": frequent_rate_limit, "rateLimit": False, "exists": exists, "emailrecovery": None, "phoneNumber": None, "others": None }) except Exception: # Handle errors gracefully out.append({ "name": name, "domain": domain, "method": method, "frequent_rate_limit": frequent_rate_limit, "rateLimit": True, "exists": False, "emailrecovery": None, "phoneNumber": None, "others": None }) ``` -------------------------------- ### Run Holehe from CLI Source: https://github.com/megadose/holehe/blob/master/README.md Executes the Holehe tool directly from the command-line interface (CLI) to check a given email address. This is a quick way to perform a check without writing any code. ```bash holehe test@gmail.com ``` -------------------------------- ### Scan Emails and Export Results to CSV using Holehe Source: https://context7.com/megadose/holehe/llms.txt This Python script scans a given email address against various services using Holehe modules and exports the results to a CSV file. It utilizes 'trio' for asynchronous operations and 'httpx' for making HTTP requests. The output file is named with a timestamp and the email address, containing columns like 'name', 'domain', 'exists', etc. ```python import csv import trio import httpx from datetime import datetime from holehe.core import import_submodules, get_functions async def scan_and_export(email: str): modules = import_submodules("holehe.modules") websites = get_functions(modules) results = [] client = httpx.AsyncClient(timeout=10) async def safe_check(module, email, client, out): try: await module(email, client, out) except Exception: pass async with trio.open_nursery() as nursery: for website in websites: nursery.start_soon(safe_check, website, email, client, results) await client.aclose() # Export to CSV timestamp = int(datetime.now().timestamp()) filename = f"holehe_{timestamp}_{email}_results.csv" with open(filename, 'w', newline='', encoding='utf-8') as f: if results: writer = csv.DictWriter(f, fieldnames=results[0].keys()) writer.writeheader() writer.writerows(sorted(results, key=lambda x: x['name'])) print(f"Results exported to {filename}") return filename trio.run(scan_and_export, "test@gmail.com") # Creates file: holehe_1699123456_test@gmail.com_results.csv # CSV columns: name, domain, method, frequent_rate_limit, rateLimit, exists, emailrecovery, phoneNumber, others ``` -------------------------------- ### Standard Holehe Module Response Format (Python) Source: https://context7.com/megadose/holehe/llms.txt Defines the standardized dictionary structure returned by all holehe modules. This format ensures consistent processing of results, including service name, domain, detection method, existence status, and optional recovery or phone number information. ```python # Standard response structure from any module response = { "name": "twitter", # Module/service name "domain": "twitter.com", # Service domain "method": "register", # Detection method: register, login, password recovery, other "frequent_rate_limit": False,# Whether this service commonly rate limits "rateLimit": False, # True if request was rate limited "exists": True, # True if email is registered on service "emailrecovery": None, # Partially obfuscated recovery email if available "phoneNumber": None, # Partially obfuscated phone number if available "others": None # Additional info (e.g., FullName, creation date) } # Example with extra data (gravatar response) gravatar_response = { "name": "gravatar", "domain": "en.gravatar.com", "method": "other", "frequent_rate_limit": False, "rateLimit": False, "exists": True, "emailrecovery": None, "phoneNumber": None, "others": { "FullName": "John Doe / https://gravatar.com/johndoe" } } # Example with recovery info (mail.ru response) mailru_response = { "name": "mail_ru", "domain": "mail.ru", "method": "password recovery", "frequent_rate_limit": False, "rateLimit": False, "exists": True, "emailrecovery": "ex****e@gmail.com", "phoneNumber": "0*******78", "others": None } ``` -------------------------------- ### Email Validation Helper Function (Python) Source: https://context7.com/megadose/holehe/llms.txt Provides a utility function `is_email` to validate the format of email addresses. This function can be used to pre-filter email inputs before initiating scans, ensuring that only syntactically correct email addresses are processed. ```python from holehe.core import is_email # Validate email addresses before processing emails = [ "valid@example.com", "also.valid+tag@domain.co.uk", "invalid-email", "missing@domain", "@nodomain.com" ] for email in emails: if is_email(email): print(f"✓ Valid: {email}") else: print(f"✗ Invalid: {email}") # Output: # ✓ Valid: valid@example.com # ✓ Valid: also.valid+tag@domain.co.uk # ✗ Invalid: invalid-email # ✗ Invalid: missing@domain # ✗ Invalid: @nodomain.com ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.