A Python script to find potential email addresses associated with a company domain and optionally a specific contact name (like a CEO). It uses SearXNG for web searching and applies regex and filtering rules.
- Finds potential email addresses from public web data.
- Accepts company name or domain/URL as primary input.
- Optionally accepts a CEO/contact name to refine search queries.
- Uses a SearXNG instance for web searches.
- Extracts emails from search result text content.
- Filters results against a blacklist of common/generic email providers (e.g., gmail.com, hunter.io).
- Optionally filters emails to match only the target company domain.
- Handles domain sanitization.
- Outputs results as a JSON list or a simple text list (one email per line).
- Standalone CLI Tool.
- Configurable logging level.
- Python: Python 3.7+ recommended.
- Pip: Python package installer.
- SearXNG Instance: Access to a running SearXNG instance and its base URL.
- Libraries:
requests(Install viarequirements.txt).
- Clone the repository or download the script:
-
git clone https://github.com/Aboodseada1/Email-Finder cd https://github.com/Aboodseada1/Email-Finder - Or simply download
standalone_lead_email_finder.pyandrequirements.txt. - (Recommended) Create and activate a Python virtual environment:
-
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install dependencies:
-
pip install -r requirements.txt
Run from your terminal:
python standalone_lead_email_finder.py <company_input> -s <searx_instance_url> [options]Arguments:
company_input: (Required) The company name (e.g.,"Example Corp") or domain/URL (e.g.,example.com).-s,--searx-url: (Required) The base URL of your SearXNG instance.-c,--ceo-name: (Optional) Full name of the CEO or contact person to focus the search.-o,--output-file: (Optional) Path to save the output file. If omitted, output goes to console.-f,--output-format: (Optional) Output format:json(full details) ortxt(emails only, one per line). Default:json.-l,--log-level: (Optional) Set logging level:DEBUG,INFO,WARNING,ERROR,CRITICAL. Default:INFO.
(Replace placeholders)
# Find emails for a domain, output JSON to console
python standalone_lead_email_finder.py example.com -s http://localhost:8080
# Find emails for a company name and CEO, output JSON to file
python standalone_lead_email_finder.py "Acme Corp" -c "John Smith" -s https://searx.example.org -o acme_emails.json
# Find emails for a domain, output only emails to text file
python standalone_lead_email_finder.py microsoft.com -s http://localhost:8080 -f txt -o ms_emails.txt
# Run with debug logging
python standalone_lead_email_finder.py google.com -s http://localhost:8080 -l DEBUGJSON Format (-f json, default): Outputs a JSON object:
{
"query_details": {
"search_name": "used search name",
"target_domain": "identified target domain or null"
},
"found_emails": [
"[email protected]",
"[email protected]"
],
"error": "Error message if any, otherwise null"
}TXT Format (-f txt): Outputs only the found, valid email addresses, each on a new line. If no emails are found, it outputs # No emails found. If an error occurred, it outputs Error: <error message>.
- Input Processing: Identifies if input is a domain/URL or company name; sanitizes domains.
- Query Generation: Creates targeted SearXNG queries based on available info (domain, name, CEO name). Includes specific patterns like
"ceo name" "domain" emailand broader searches. - SearXNG Search: Fetches search results from the provided SearXNG instance for each query.
- Extraction: Uses regex (
EMAIL_REGEX) to find potential email addresses within the aggregated text content of search results. - Filtering: Removes emails from common/generic providers (
BLACKLISTED_DOMAINS) and, importantly, filters to keep only emails matching the identifiedtarget_domain(if one was found). - Output: Returns the unique, filtered email addresses in the chosen format (JSON or TXT).
- Relies entirely on data available through SearXNG search results.
- Accuracy depends on search engine indexing and website content.
- The
EMAIL_REGEXis broad and might occasionally match non-email strings (though unlikely with the@and.requirements). - Filtering is based on the
BLACKLISTED_DOMAINSlist and matching the target domain; legitimate emails on other domains might be missed if filtering strictly by target domain. - Does not verify if the found email addresses actually exist or are deliverable.
requests
Improvements (e.g., better query generation, refined filtering) are welcome! Please open an issue or submit a pull request on GitHub.
If you find this tool useful, consider supporting its development via PayPal. Thank you!
This project is licensed under the MIT License.
MIT License
Copyright (c) 2025 Abood
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.