How to Use Recon-ng for OSINT: Workspaces, Modules, API Keys and Reports

Looking to master Recon-ng for cybersecurity reconnaissance and open-source intelligence (OSINT)? This complete tutorial on how to use Recon-ng walks you through everything from installation and essential commands to real-world examples of modules like domain enumeration, email harvesting, and host discovery. Bug bounty hunters, ethical hackers, and cybersecurity students will learn how to use API keys, manage workspaces, explore the module marketplace, and perform passive and active recon with Recon-ng. This guide also includes essential Recon-ng commands, module configurations, and step-by-step instructions to automate recon tasks for real-world targets.

Apr 09, 2025 - 10:13
Updated: 
118.1k

Security Tools, Authorized Labs & CTFs in Cybersecurity & Ethical Hacking · Tutorial

How to Use Recon-ng for OSINT: Workspaces, Modules, API Keys and Reports

Quick answer: Recon-ng is a free, Python-based OSINT framework with a Metasploit-like console. You create a workspace, seed it with a domain, install modules from the marketplace, and run them to collect subdomains, hosts and contacts into a local database. Add API keys for services such as Shodan, then export the results. Use it only within an authorised scope.

Key takeaways

  • Recon-ng organises reconnaissance into workspaces, a database of results, and modules that each query one data source.
  • Most modules are passive: they ask third-party services what is already known, rather than touching the target. That still needs a defined scope on an engagement.
  • Many useful modules need an API key. The free tiers of those services have limits.
  • Collected data is personal and company information. Store it securely, keep to scope and delete it when the engagement ends.

What is Recon-ng for?

Reconnaissance is the first phase of a security assessment: learning what an organisation exposes before anyone tests it. Recon-ng, which is maintained as an open-source project at github.com/lanmaster53/recon-ng, automates the gathering of public information such as subdomains, IP addresses, contacts and leaked data, and keeps everything in one place.

It suits two jobs: building an inventory of an organisation's internet-facing assets for an authorised test, and learning how OSINT works. For a broader introduction, see what Recon-ng is and how ethical hackers use it.

Scope and legality first

Use a domain you own or one you have written permission to assess. Passive lookups are lower risk than active scanning, but they can still go outside the agreed scope, and the data collected may include personal details. In this guide, yourdomain.example stands for your own lab domain. Replace it with a domain you control, and do not point these steps at a real third-party organisation without permission, as the IT Act, 2000 applies to unauthorised access, and many programmes also forbid certain data collection.

Install and start

On Kali Linux it is a package:

sudo apt update
sudo apt install recon-ng
recon-ng

On other systems, clone the project from GitHub and follow its README, which lists the Python requirements. You will see a prompt like [recon-ng][default] >. Type help to list commands. The command set differs a little between versions, so rely on help and the project wiki if a command here is not accepted.

What are the core concepts?

  • Workspace: a separate project with its own database, so one engagement's data never mixes with another's.
  • Database tables: domains, hosts, contacts, credentials, netblocks and more. Modules read from some tables and write to others.
  • Modules: small plug-ins grouped by what they take in and give out, such as recon/domains-hosts/, which turns a domain into hosts.
  • Marketplace: modules are installed on demand with the marketplace command.
  • Keys: API keys are stored once and shared by all modules that need them.

Step-by-step workflow

1. How do you create a workspace?

[recon-ng][default] > workspaces create lab_project
[recon-ng][lab_project] > workspaces list

2. Seed the database with your scope

[recon-ng][lab_project] > db insert domains
domain (TEXT): yourdomain.example
notes (TEXT):

3. Find and install modules

[recon-ng][lab_project] > marketplace refresh
[recon-ng][lab_project] > marketplace search hackertarget
[recon-ng][lab_project] > marketplace install recon/domains-hosts/hackertarget
[recon-ng][lab_project] > modules search

4. Load, configure and run a module

[recon-ng][lab_project] > modules load recon/domains-hosts/hackertarget
[recon-ng][lab_project][hackertarget] > info
[recon-ng][lab_project][hackertarget] > options set SOURCE yourdomain.example
[recon-ng][lab_project][hackertarget] > run

Always run info first. It shows what the module needs, what it writes and whether a key is required. Without a SOURCE option, many modules default to every row in the relevant table.

5. Add API keys

Many data sources need a key. Create a free account with the service, then add the key.

[recon-ng][lab_project] > keys add shodan_api YOUR_KEY_HERE
[recon-ng][lab_project] > keys list

The key name must match what the module expects, which info shows. Treat keys as secrets: they are stored in the ~/.recon-ng/ directory on your machine, so do not share that folder or commit it to a repository.

6. Review what you found

[recon-ng][lab_project] > show domains
[recon-ng][lab_project] > show hosts
[recon-ng][lab_project] > show contacts
[recon-ng][lab_project] > dashboard

Chain modules. For instance, the hosts you find can feed a resolver module that adds IP addresses, and those can feed lookup modules that add location or network owner data. Each step enriches the database.

7. Export and keep records

[recon-ng][lab_project] > spool start session.log
[recon-ng][lab_project] > modules load reporting/csv
[recon-ng][lab_project][csv] > options set TABLE hosts
[recon-ng][lab_project][csv] > options set FILENAME /home/kali/hosts.csv
[recon-ng][lab_project][csv] > run

Other reporting modules write HTML, JSON and XML. The spool start line at the top logs the session to a file, and spool stop ends it.

Useful command summary

CommandPurpose
helpList commands for your version
workspaces create, select, listManage separate projects
db insert, showAdd seed data and view tables
marketplace search, install, refreshFind and add modules
modules search, loadFind and select an installed module
info, options set, runInspect, configure and execute
keys add, listManage API keys
dashboardSummary of activity and record counts
spool start, stopLog console output to a file

Common problems

  • Module not found: install it first from the marketplace, and run marketplace refresh if the list looks old.
  • Module needs a key: run info and add the named key.
  • No results: check the SOURCE spelling, rate limits on free API tiers, and whether the data source has anything on the domain.
  • Data looks wrong: third-party data goes stale. Verify important findings with a second source or directly, within scope.
  • Some marketplace modules fail: modules depend on external services that change or disappear. Try another module that gives the same kind of data.

From recon to defence

The point of reconnaissance is a better defence. Typical findings are forgotten subdomains, staging servers on the public internet, exposed email patterns and old contacts. An organisation can fix those by removing unused DNS records, restricting staging systems and reviewing what public registries show. Report them with that advice. Recon-ng is also used in bug bounty, and the best tools used in bug bounty hunting post puts it in context. Programme rules decide what you may collect.

Next steps

Practise on your own domain, then continue with advanced reconnaissance with Recon-ng. If you want structured training, the CEH v13 AI course includes reconnaissance within an authorised-testing framework.

Related reading

Frequently Asked Questions

Recon-ng is a Python OSINT framework that collects public information such as subdomains, hosts, contacts and network data into a workspace database. Testers use it in the reconnaissance phase of authorised assessments and bug bounty programmes.

Run sudo apt update and sudo apt install recon-ng, then start it with recon-ng. On other systems, clone the project from GitHub and follow its README for Python requirements.

Many do. Run info on a loaded module to see which key it needs, create a free account with the service, then add it with keys add name value. Free tiers usually have rate limits.

The tool is legal, and most modules query public sources. You still need authorisation and a defined scope, because collecting data about an organisation or its staff without permission can breach the law or programme rules.

Load a reporting module such as reporting/csv, set the TABLE and FILENAME options, and run it. Other reporting modules write HTML, JSON and XML. You can also log a session with spool start.

Recon-ng is a free, command-line, module-based framework that stores results in a database. Maltego is a graphical link-analysis tool with its own transforms and editions. Many analysts use both, for different kinds of investigation.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.