GO KALI FREE

theHarvester

Information Gathering

Beginnerlow risk

theHarvester is a comprehensive OSINT tool for gathering email addresses, subdomains, employee names, open ports, and banners from public sources including search engines, PGP key servers, Shodan, and DNS databases for passive reconnaissance and attack surface mapping.

Installation

sudo apt install theharvester

Basic Syntax

theHarvester -d <domain> -b <source> [options]

Quick Facts

Category
OSINT / Passive Reconnaissance
Platform
Linux / macOS / Windows
Type
Passive Information Gathering
Difficulty
Beginner-Friendly
Common Usage
Email & Subdomain Discovery
Language
Python 3
License
GPL
Risk Level
Low (Passive)

Tool Overview

theHarvester is a Python-based OSINT tool designed for passive reconnaissance. It gathers publicly available information about a target domain including email addresses, subdomains, employee names, open ports, and service banners from multiple public sources without directly interacting with the target infrastructure.

The tool queries search engines (Google, Bing, Yahoo, DuckDuckGo), certificate transparency logs (crt.sh), DNS databases (DNSDumpster, PassiveTotal), and specialized APIs (Shodan, Hunter, SecurityTrails) to compile a comprehensive intelligence report. This passive approach makes theHarvester ideal for early-stage reconnaissance where minimal detection risk is required.

theHarvester is essential for penetration testers, red teamers, bug bounty hunters, and security auditors who need to map an organization's external attack surface before launching active scanning. The discovered emails feed into phishing campaigns, subdomains reveal forgotten infrastructure, and employee names enable social engineering attacks.

Common Commands

theHarvester -d example.com -b googleGoogle search — Gather emails and subdomains using Google search engine
theHarvester -d example.com -b bingBing search — Discover emails and subdomains via Bing search engine
theHarvester -d example.com -b allAll sources — Run enumeration across all supported public engines and APIs
theHarvester -d example.com -b linkedinLinkedIn search — Find employee names and professional profiles
theHarvester -d example.com -b bing -l 200Limit results — Restrict Bing search to first 200 results
theHarvester -d example.com -b google -f report.htmlHTML output — Save results to an HTML report file
theHarvester -d example.com -b all -sDNS brute-force — Enable DNS brute-force subdomain enumeration
theHarvester -d example.com -b crtshCertificate transparency — Query crt.sh for subdomains via CT logs
theHarvester -d example.com -b shodanShodan search — Query Shodan for open ports and banners (requires API key)
theHarvester -d example.com -b hunterHunter search — Query Hunter.io for corporate email patterns (requires API key)
theHarvester -d example.com -b securitytrailsSecurityTrails — Query SecurityTrails for historical DNS and subdomain data (requires API key)
theHarvester -d example.com -b dnsdumpsterDNSDumpster — Query DNSDumpster for DNS reconnaissance and subdomain discovery
theHarvester -d example.com -b bing -l 500 -f report.html -sCombined scan — Bing search with 500 limit, DNS brute-force, and HTML output
theHarvester -d example.com -b all -s -f output.html -nFull scan — All sources with DNS brute-force, HTML output, and DNS resolution
theHarvester -d example.com -b google -cVirtual hosts — Discover virtual hosts hosting the target domain

Step-by-Step Guide

  1. 1Define the target domain you want to research and ensure you have authorization
  2. 2Choose your data sources: search engines (google, bing), certificate logs (crtsh), or APIs (shodan, hunter)
  3. 3Run theHarvester with your chosen parameters: theHarvester -d <domain> -b <sources>
  4. 4Review the discovered email addresses and note patterns (first.last@, firstlast@, flast@)
  5. 5Analyze the subdomains list for forgotten systems, staging environments, and exposed services
  6. 6Cross-reference findings with DNS Lookup and IP Lookup tools for deeper analysis
  7. 7Use discovered subdomains for active scanning with Nmap or vulnerability assessment
  8. 8Document all findings for your security assessment or bug bounty report

Warnings

Use Cases

Bug Bounty Reconnaissance

Map the target's external attack surface before active scanning. Discover subdomains, email patterns, and exposed services to identify potential vulnerabilities.

External Attack Surface Mapping

Identify all public-facing assets including subdomains, email infrastructure, and open services for comprehensive security assessments.

Corporate OSINT Investigation

Gather intelligence on organizational structure, employee emails, and technology stack from public sources for penetration testing engagements.

Employee Discovery

Extract employee names and email patterns from LinkedIn and search engines to build credential lists for brute-force or phishing attacks.

Subdomain Enumeration

Discover forgotten subdomains, staging environments, and internal applications exposed to the internet through certificate transparency logs.

Phishing Campaign Preparation

Build targeted email lists and understand corporate email naming patterns for realistic phishing simulations during authorized engagements.

Key Features

Comparison

theHarvester vs Amass vs Subfinder — Recon Feature Matrix

FeaturetheHarvesterAmassSubfinder
Primary FocusEmails + subdomains + OSINTAttack-surface mappingSubdomains only
Email DiscoveryYes (core feature)NoNo
Subdomain Sources20+ mixed sources40+ (deepest)40+ passive
Open Ports / BannersYes (via Shodan)LimitedNo
Employee NamesYes (search engines)NoNo
SpeedFastSlow (thorough)Very fast
Best ForBroad OSINT footprintEnterprise mappingQuick subdomain lists

Passive vs Active Reconnaissance — Where theHarvester Fits

FeaturetheHarvesterDNSenumNmap
ApproachPassive (third-party)Active (queries target DNS)Active (probes hosts)
Detection RiskVery lowMediumHigh
Touches Target?No (queries public sources)Yes (DNS servers)Yes (ports/services)
Data ReturnedEmails, subdomains, namesDNS records, subdomainsPorts, services, OS
Recon PhaseFirst (footprinting)Second (DNS mapping)Third (scanning)

theHarvester Source Types — When to Use Which

FeatureSearch EnginesCertificate LogsSecurity APIs
Examplesgoogle, bing, yahoo, duckduckgocrtsh, certspottershodan, hunter, securitytrails
Best ForEmails + employee namesReliable subdomainsPorts, patterns, history
API Key NeededNoNoYes (most)
Rate-Limit RiskHigh (429/CAPTCHA)LowDepends on tier
ReliabilityVariableHighHigh

Best Practices

Common Errors

theHarvester: command not found
Install with sudo apt update && sudo apt install theharvester. If you cloned the repo, run it from the source directory with python3 theHarvester.py -d <domain> -b all.
ModuleNotFoundError: No module named 'aiohttp' (or similar)
Reinstall dependencies: pip3 install -r requirements.txt from the repo, or reinstall the package. Use a virtualenv (python3 -m venv) to avoid system package conflicts.
No emails or subdomains found
Query multiple sources with -b all, and add API-backed sources (Shodan, Hunter, SecurityTrails). Enable DNS brute-force with -s for subdomains not indexed anywhere.
[!] Missing API key in api-keys.yaml
Add keys to ~/.theHarvester/api-keys.yaml (or the repo's api-keys.yaml). Free tiers work but are rate-limited. Skip these sources with search-engine-only sources if you have no key.
Google/Bing returns 429 or blocks queries
Slow down, reduce the result limit with -l, rotate sources, or route through a proxy. Prefer certificate-transparency (crtsh) and API sources that do not CAPTCHA.
SSL: CERTIFICATE_VERIFY_FAILED when querying a source
Update CA certs (sudo apt install --reinstall ca-certificates) and the certifi package (pip3 install -U certifi). Check the system clock — a wrong date breaks TLS validation.
Read timed out / connection errors mid-scan
Retry, or query sources individually to isolate the failing one. Transient source outages are common — rerun later or exclude the problem source.
Discovered emails or subdomains are stale/invalid
Validate before use: verify subdomains resolve (dig/httpx) and confirm email deliverability separately. Treat OSINT results as leads, not confirmed facts.
api-keys.yaml YAML parse error
Use two-space indentation and quote values with special characters. Validate the file with a YAML linter, and follow the exact template shipped in the repo.
-l limit ignored / results truncated unexpectedly
Combine multiple sources rather than pushing one source's limit. Use -b all and dedupe the aggregated output for broader coverage.
DNS brute-force (-s) finds nothing
Complement -s with dedicated brute-force tools (DNSenum -f with SecLists, or Amass) and passive sources like crt.sh and Subfinder for fuller coverage.
HTML/XML report file is empty or not written
Confirm the scan returned data first, use an absolute path you can write to, and check disk permissions. The -f file is only populated when results exist.

People Also Ask

What is the difference between theHarvester and Subfinder?

theHarvester is a broad OSINT collector that gathers emails, employee names, subdomains, ports, and banners from search engines and public APIs. Subfinder is a specialized subdomain-discovery tool that pulls from far more certificate transparency and DNS sources. Use theHarvester for people-and-email intelligence; use Subfinder for exhaustive subdomain enumeration.

Which theHarvester sources need API keys?

Free sources that need no key include crtsh (certificate transparency), duckduckgo, bing, otx, rapiddns, and threatminer. Sources that require an API key include shodan, hunter, securitytrails, censys, and github. Add keys to the api-keys.yaml file; most providers offer a limited free tier.

Can theHarvester find emails without brute-force?

Yes. theHarvester discovers emails passively through search engines (Google, Bing), LinkedIn, and Hunter.io without any DNS brute-force. The -s flag enables DNS brute-force for subdomains, not emails. For email-only discovery, omit -s and use -b google,bing,hunter.

How do I export theHarvester results?

Use the -f flag to write output to a file: theHarvester -d example.com -b all -f report. Modern versions produce an HTML report plus a JSON file. For CSV, parse the JSON output. Store one report per engagement with a dated filename and sanitize before sharing.

Is theHarvester still maintained in 2026?

Yes. theHarvester is actively maintained by Christian Martorella (laramies) and contributors on GitHub, with regular releases that add new data sources and fix broken scrapers. Keep it updated with apt upgrade, pipx upgrade, or pulling the latest Docker image for reliable results.

How is theHarvester different from Recon-ng?

theHarvester focuses on email and subdomain discovery from search engines and public APIs with a simple single-command interface. Recon-ng is a full-featured reconnaissance framework with modules for multiple OSINT tasks, database storage, and reporting. Use theHarvester for quick email discovery; Recon-ng for structured multi-phase campaigns.

Related Tools

Amass

Subdomain Discovery

OWASP subdomain discovery tool combining passive and active techniques with 40+ data sources for enterprise-level attack surface mapping.

Subfinder

Subdomain Discovery

Fast passive subdomain discovery tool using 40+ public data sources without querying the target directly.

Nmap

Network Scanner

Network scanner for port discovery, service detection, and OS fingerprinting across networks.

DNSenum

DNS Enumeration

DNS enumeration tool for zone transfers, subdomain brute-force, and DNS record analysis.

Whois Lookup

Domain Intelligence

Query domain registration data including registrar, owner, creation date, and name servers.

Dig

DNS Analysis

DNS query tool for detailed record lookups, zone transfers, and DNS troubleshooting.

Frequently Asked Questions

What is TheHarvester?

theHarvester is a passive OSINT tool for gathering email addresses, subdomains, employee names, open ports, and banners from public sources. It queries search engines, certificate transparency logs, DNS databases, and security APIs to compile intelligence reports without directly interacting with the target.

What does TheHarvester do?

theHarvester gathers publicly available information about a target domain including email addresses, subdomains, employee names, open ports, and service banners. It queries search engines (Google, Bing), certificate transparency logs (crt.sh), and APIs (Shodan, Hunter) to compile intelligence for penetration testing and security assessments.

How do I use TheHarvester?

Basic usage: theHarvester -d example.com -b google. For comprehensive results: theHarvester -d example.com -b all -s -f report.html. The -d flag specifies the domain, -b selects sources (google, bing, all, crtsh, shodan), -s enables DNS brute-force, and -f saves results to a file.

How do I install TheHarvester in Kali Linux?

theHarvester comes pre-installed in Kali Linux. If missing, install with: sudo apt install theharvester. Update to the latest version: sudo apt update && sudo apt install theharvester. For the latest development version, clone from GitHub: git clone https://github.com/laramies/theHarvester.git.

How do I install TheHarvester in Ubuntu?

Install on Ubuntu/Debian: sudo apt install theharvester. For the latest version, install via pip: pip3 install theHarvester. Alternatively, clone from GitHub: git clone https://github.com/laramies/theHarvester.git && cd theHarvester && pip3 install -r requirements.txt.

How do I update TheHarvester?

Update via apt: sudo apt update && sudo apt install theharvester. For pip installations: pip3 install --upgrade theHarvester. For GitHub installations: cd theHarvester && git pull && pip3 install -r requirements.txt. Check version with: theHarvester --version.

What sources does TheHarvester support?

theHarvester supports 20+ sources: Search engines (google, bing, yahoo, duckduckgo, yandex), certificate transparency (crtsh, certspotter), DNS databases (dnsdumpster, passivetotal, virustotal, threatminer), APIs (shodan, hunter, securitytrails, github), and social (linkedin). Use -b all to query all sources.

Can TheHarvester find emails?

Yes, email discovery is theHarvester's primary feature. It searches Google, Bing, LinkedIn, and Hunter for corporate email addresses. Use -b google for basic email discovery, -b linkedin for employee names, and -b hunter for corporate email patterns. Enable multiple sources for maximum coverage.

Can TheHarvester find subdomains?

Yes, theHarvester discovers subdomains through search engine indexing, certificate transparency logs (crtsh), and DNS brute-force (-s flag). Search engines index subdomains in results; crt.sh logs SSL certificates; DNS brute-force guesses common names (api, dev, staging). Use -b all -s for maximum subdomain coverage.

Is TheHarvester legal?

theHarvester is legal when used with authorization on domains you own or have written permission to investigate. It uses only passive techniques querying public sources. However, always obtain explicit authorization before running it against any domain. Unauthorized reconnaissance may violate computer fraud laws.

Does TheHarvester require API keys?

No, theHarvester works without API keys using search engine sources (google, bing, crtsh). However, API keys for Shodan, Hunter, and SecurityTrails significantly expand results. Configure keys in config.yaml file. Free tiers are available for all three services.

Can TheHarvester run on Windows?

Yes, theHarvester can run on Windows with Python 3 installed. Install via pip: pip3 install theHarvester. Alternatively, use WSL (Windows Subsystem for Linux) for a Linux-like environment. The tool works identically on Windows, Linux, and macOS.

Can TheHarvester run on Termux?

Yes, theHarvester can run on Termux (Android). Install Python and theHarvester: pkg install python && pip install theHarvester. Some sources may have limited functionality on mobile due to network restrictions, but core email and subdomain discovery works.

What is TheHarvester used for in cyber security?

theHarvester is used for passive OSINT reconnaissance in cyber security: email enumeration for phishing simulations, subdomain discovery for attack surface mapping, employee identification for social engineering, and domain intelligence gathering for penetration testing engagements.

What is the difference between TheHarvester and Amass?

theHarvester focuses on email discovery and basic subdomain enumeration from search engines and APIs. Amass provides deeper subdomain discovery with 40+ data sources, active DNS verification, and enterprise-level attack surface mapping. theHarvester is simpler and faster; Amass is more comprehensive but requires more configuration.

Can theHarvester find email addresses from LinkedIn?

Yes, use the -b linkedin source: theHarvester -d example.com -b linkedin. This searches Bing for LinkedIn profiles associated with the target domain, extracting employee names and email patterns. Combine with -b google for additional email discovery. LinkedIn source results depend on Bing's indexing of public LinkedIn profiles.

How do I configure API keys for theHarvester?

Edit the config.yaml file in theHarvester's installation directory (~/.theHarvester/config.yaml or /etc/theharvester/config.yaml). Add your API keys for Shodan, Hunter, SecurityTrails, and other services. Free tiers are available for Shodan (limited queries), Hunter (50 requests/month), and SecurityTrails (50 queries/month). API keys significantly expand results beyond basic search engine sources.

What is the difference between theHarvester and Recon-ng?

theHarvester focuses on email and subdomain discovery from search engines and public APIs with a simple single-command interface. Recon-ng is a full-featured reconnaissance framework with modules for multiple OSINT tasks, database storage, and reporting. theHarvester is better for quick email discovery; Recon-ng is better for structured multi-phase reconnaissance campaigns.

Can theHarvester enumerate subdomains without DNS brute-force?

Yes, use sources like crtsh (certificate transparency), dnsdumpster, and search engines (google, bing) which discover subdomains passively without DNS brute-force. The -s flag enables DNS brute-force which actively queries potential subdomain names. For passive-only discovery, omit -s and use -b crtsh,google,bing for results that do not directly interact with the target's DNS infrastructure.

How do I export theHarvester results to CSV?

Use the -f flag with an HTML output file, then convert to CSV: theHarvester -d example.com -b all -f results.html. For direct CSV, pipe results through text processing: theHarvester -d example.com -b all 2>&1 | grep -E '^[^@]*@' > emails.csv. The -f flag generates a structured HTML report with all discovered emails, subdomains, and hosts organized by category.

What API keys does theHarvester need and how do I configure them?

theHarvester requires API keys for full source functionality. Add your keys to /etc/theHarvester/api-keys.yaml: shodan: YOUR_KEY, hunterio: YOUR_KEY, securitytrails: YOUR_KEY, censys: YOUR_ID:YOUR_SECRET. Free tiers are available for Shodan (limited queries) and SecurityTrails (50 queries/month). Without API keys, only passive sources like crtsh and DNS work.

How do I use theHarvester for red team operations?

For red team operations, combine theHarvester's email discovery with password spraying using CrackMapExec. Run: theHarvester -d target.com -b all -f harvest.html to gather emails, then extract them for use in phishing campaigns or credential attacks. Use the -p flag to DNS-brute-force subdomains that may host vulnerable services, then chain with Nmap or Masscan for port scanning.

Can theHarvester discover employee names and job titles?

Yes, theHarvester can find employee names from LinkedIn, Hunter, and other professional sources using -b linkedin or -b hunter. Use the --limit flag to control the number of results. Employee names reveal organizational structure, identify high-value targets for social engineering, and help craft targeted phishing emails with realistic job titles.

How do I combine theHarvester with Subfinder for maximum coverage?

Run both tools and merge results: theHarvester -d target.com -b all -f harvest.html && subfinder -d target.com -o subfinder.txt. Extract subdomains from theHarvester's HTML output and merge with subfinder results using: sort -u merged.txt. This passive combination avoids DNS brute-force detection while maximizing subdomain coverage from both tool databases.

What is the difference between theHarvester passive and active modes?

Passive mode (-b crtsh,bing,duckduckgo) queries third-party sources without touching the target's infrastructure, generating zero network traffic to the target. Active mode adds -s for DNS brute-force, which actively queries potential subdomain names on the target's DNS servers. Use passive-only for stealthy recon and active for comprehensive discovery when detection is acceptable.

Is theHarvester legal to use?

theHarvester itself is legal software, and querying public sources like search engines and certificate transparency logs is generally lawful because the data is already public. However, using the gathered emails, names, or subdomains to attack, phish, or access systems you do not own is illegal in most jurisdictions. Only run theHarvester against domains you own or have explicit written authorization to assess, such as a signed penetration-testing scope or an in-scope bug-bounty program.

Why does theHarvester return no results or empty output?

Empty results usually mean the chosen source was rate-limited, blocked, or requires an API key you have not configured. Search engines like Google and Bing frequently throttle automated queries, so switch to -b crtsh or -b duckduckgo, add API keys for Shodan and Hunter, and confirm outbound DNS and HTTPS are not blocked by a proxy. Also verify the domain is spelled correctly and actually has public records — small or newly registered domains legitimately return little data.

How is theHarvester different from Subfinder and Amass?

theHarvester is a broad OSINT collector that gathers emails, employee names, subdomains, ports, and banners, making it ideal for the very first reconnaissance pass. Subfinder and Amass are specialized subdomain-discovery tools that pull from far more sources and scale to enterprise attack-surface mapping. In practice you run theHarvester first for people-and-email intelligence, then use Subfinder or Amass to exhaustively enumerate subdomains, and merge the results for maximum coverage.

Does theHarvester work on Windows and macOS?

Yes. theHarvester is a Python 3 application, so it runs anywhere Python 3.9+ is available. On macOS use Homebrew (brew install theharvester) or pipx; on Windows use pip inside a virtual environment or run it under WSL for the closest Linux-like experience. On Kali and most Debian-based Linux it is available directly via apt. Docker is the most portable option because it bundles every dependency.

How do I save and share theHarvester results?

Use the -f flag to write output to a file, e.g. theHarvester -d example.com -b all -f report. Modern versions produce an HTML report plus a JSON file you can feed into other tools, while older versions accept -f report.xml. Store one report per engagement with a dated filename, and sanitize it before sharing because it can contain internal hostnames and staff email addresses.

Which theHarvester sources need API keys and which are free?

Free sources that need no key include crtsh (certificate transparency), duckduckgo, bing, otx, rapiddns, and threatminer. Sources that require an API key include shodan, hunter, securitytrails, censys, and github. Add keys to the api-keys.yaml file; most providers offer a limited free tier, so you can start without paying and upgrade only if you need higher query volumes.

Is theHarvester still maintained in 2026?

Yes. theHarvester is actively maintained by Christian Martorella (laramies) and contributors on GitHub, with regular releases that add new data sources and fix broken scrapers as third-party sites change. Because sources break often, keeping theHarvester updated (apt upgrade, pipx upgrade, or pulling the latest Docker image) is important for reliable results.

Tags

#reconnaissance#osint#email-harvester#subdomain-discovery#passive-recon#domain-intelligence#cyber-security#kali-linux

Output Explanation

theHarvester output is organized into structured blocks: Emails (discovered email addresses with source attribution), Subdomains (DNS-resolved subdomains with IP addresses), Hosts (resolved IP addresses and open ports), Virtual Hosts (web servers hosting the domain), Banners (service banners from Shodan), and Employee Names (LinkedIn and social media profiles). Focus on email addresses for phishing campaigns, subdomains for attack surface mapping, and open ports for service enumeration.

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.