How to use the command 'theHarvester' (with examples)

How to use the command 'theHarvester' (with examples)

theHarvester is a tool designed to be used in the early stages of a penetration test. It allows users to gather information on a specified domain using various sources, such as Google, Bing, and crt.sh. Users can also customize the limit of results and save the output in XML and HTML format.

Use case 1: Gather information on a domain using Google

Code:

theHarvester --domain domain_name --source google

Motivation: This use case is useful for gathering information on a specific domain using the Google search engine as the source. By using this command, users can gather valuable information about the target domain, such as email addresses, subdomains, and open ports.

Explanation:

  • --domain: Specifies the target domain.
  • --source: Specifies the source to use for gathering information. In this case, the source is Google.

Example Output:

Emails found:
- example1@gmail.com
- example2@gmail.com

Subdomains found:
- subdomain1.example.com
- subdomain2.example.com

Use case 2: Gather information on a domain using multiple sources

Code:

theHarvester --domain domain_name --source google,bing,crtsh

Motivation: Gathering information from multiple sources can provide a more comprehensive view of the target domain. By specifying multiple sources, users can increase the chances of finding relevant information.

Explanation:

  • --domain: Specifies the target domain.
  • --source: Specifies the sources to use for gathering information. In this case, the sources are Google, Bing, and crt.sh.

Example Output:

Emails found:
- example1@gmail.com
- example2@gmail.com

Subdomains found:
- subdomain1.example.com
- subdomain2.example.com

Certificates found:
- certificate1
- certificate2

Use case 3: Change the limit of results to work with

Code:

theHarvester --domain domain_name --source google --limit 200

Motivation: Changing the limit of results can be beneficial when the default limit is not sufficient. By increasing the limit, users can gather more information from the specified source.

Explanation:

  • --domain: Specifies the target domain.
  • --source: Specifies the source to use for gathering information. In this case, the source is Google.
  • --limit: Specifies the maximum number of results to retrieve.

Example Output:

Emails found:
- example1@gmail.com
- example2@gmail.com
- ...

Subdomains found:
- subdomain1.example.com
- subdomain2.example.com
- ...

(Note: Only the first 200 results are shown)

Use case 4: Save the output to two files in XML and HTML format

Code:

theHarvester --domain domain_name --source google --file output_file_name

Motivation: Saving the output in XML and HTML format allows users to store the gathered information for further analysis or reporting purposes.

Explanation:

  • --domain: Specifies the target domain.
  • --source: Specifies the source to use for gathering information. In this case, the source is Google.
  • --file: Specifies the file name to save the output. The output will be saved in both XML and HTML format with the provided file name.

Example Output:

The output files (output_file_name.xml and output_file_name.html) have been saved successfully.

Use case 5: Output all available options

Code:

theHarvester --help

Motivation: When users are not familiar with the command and its options, the --help command can be used to display all the available options, their descriptions, and how to use them.

Explanation:

  • --help: Displays the help menu, including all the available options and their descriptions.

Example Output:

The help menu with all the available options and their descriptions is displayed.

Conclusion:

theHarvester is a powerful tool for gathering information on a specified domain during the early stages of a penetration test. By utilizing different sources, adjusting result limits, and saving output in different formats, users can gain valuable insights into the target domain. It is important to note that the tool should be used responsibly and ethically, adhering to the relevant laws and regulations.

Related Posts

How to use the command `conda` (with examples)

How to use the command `conda` (with examples)

conda is a command-line tool that is used for package, dependency, and environment management for any programming language.

Read More
How to use the command 'argocd app' (with examples)

How to use the command 'argocd app' (with examples)

The argocd app command-line interface is used to manage applications in Argo CD.

Read More
Resizing and Rotating Images with imgp (with examples)

Resizing and Rotating Images with imgp (with examples)

Use Case 1: Convert single images and/or whole directories containing valid image formats imgp -x 1366x1000 path/to/directory path/to/file Motivation: The motivation behind using this command is to convert single images or a whole directory of images to a specific resolution, in this case, 1366x1000 pixels.

Read More