0% found this document useful (0 votes)
47 views16 pages

Recon-ng Basics for Ethical Hackers

The document provides a comprehensive guide on using Recon-ng, a reconnaissance framework, including installation, workspace management, and basic commands. It covers creating and interacting with workspaces, snapshots, dashboards, and modules, as well as managing API keys and hosting the framework locally. The instructions include command syntax and examples for various operations within the framework.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views16 pages

Recon-ng Basics for Ethical Hackers

The document provides a comprehensive guide on using Recon-ng, a reconnaissance framework, including installation, workspace management, and basic commands. It covers creating and interacting with workspaces, snapshots, dashboards, and modules, as well as managing API keys and hosting the framework locally. The instructions include command syntax and examples for various operations within the framework.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ETHICAL HACKING EXPERT

A. Installation and setup

This command installs Recon-ng on a Debian-based Linux system.

sudo apt-get install recon-ng

I had it installed so you can see nothing no new installations were made

This command starts Recon-ng

recon-ng
Recon-ng interface

B. Basic commands and syntax

1. creating and interacting with workspaces

Let’s create a workspace just like your office to work within , the command is

workspaces create workspace_name

replace workspace_name with your preferred name . The default workspace name is ‘default’

Let’s list the created workspaces , to list enter this command 👇🏽

workspaces list
these are the workspace I created for my projects , you can create different workspace for
different project.

Let’s load the demo workspace to work within it , to load any workspace enter 👇🏽

workspaces load workspace_name

Instead of workspace_name add the workspace name you wanna load, in my case ‘demo’
Example: workspaces load demo

To delete workspace just enter 👇🏽

workspaces remove workspace_name

you know what to do to the ‘workspace_name’ in the command right? good! let’s continue

2. creating and interacting with snapshots


In Recon-ng, snapshots are used to save the current state of a workspace, which includes
all modules, workspaces, and associated data. Snapshots allow you to save your progress
and return to it later, or even share it with others

to do a snapshot enter this command 👇🏽

snapshots take workspace_name

Let’s list the snapshots

snapshots list

screenshot for the snapshot I made on CEH workspace

Let’s load the snapshot

To load snapshots enter this command 👇🏽 using the name of the snapshot you made
snapshots snapshot_20230614022243.db

To remove snapshots enter this command

snapshots remove snapshot_20230614022243.db

3. Dashboards

Dashboard is used to see the summary of your activities on recon-ng

Here is the command to check for your work activity 👇🏽

dashboard

summary of my activities on recon-ng

4. Shell
In Recon-ng, the shell is used to execute various commands and modules to perform
reconnaissance on a target. The shell provides a command-line interface where you can
enter commands to interact with the framework and perform various operations such as
scanning, fingerprinting, and information gathering. You can use the shell to load and run
modules, configure options, and view the results of your reconnaissance. The shell is an
essential part of Recon-ng, and it allows you to perform reconnaissance tasks efficiently and
effectively.

To execute a shell enter

shell sh

instead of sh, enter the name your preferred

recon-ng shell

5. pdb
Pdb stands for Python Debugger, and it is a built-in debugging module in Python that can be
used in Recon-ng to debug code and modules. Pdb allows you to pause the execution of
your Python code at any point and interactively inspect the state of the program, including
the values of variables, the call stack, and the execution flow.

To use Pdb in Recon-ng, you can add the — pdb option to the run command when running
a module. For example, if you want to run the google_site_web module with Pdb enabled,
you would type run — pdb google_site_web.

6. db

In Recon-ng, db is a command used to interact with the framework’s built-in database. The
db command allows you to manipulate the data stored in the database, including adding,
modifying, and deleting records.

Here are some examples of how you can use the db command in Recon-ng:

you can perform a query on with db on recon-ng just as how you do for any database

Once you do db schema you see all this information in a database format

Now let’s add an insert port,


To insert something in db just enter

db insert ports

Instead of port you could enter whatever you want.

Here is a list you can choose from

companies|contacts|credentials|domains|hosts|leaks|locations|netblocks|ports|profiles|pushpins
|repositories|vulnerabilities

To delete any rows enter

db delete hosts

Instead of host enter what you want to delete

Let’s add notes in db

Do this 👇🏽 specify the tables and then enter the rows and the enter the change

db notes ports

7. Index

Here is where we could know the information of the module.

Example1:
Gathering information on all installed modules

index all

Now, let’s index a specific module here it will be

index brute_hosts
[Link]

In the marketplace, we are going to install, remove, search, info and refresh modules

In the marketplace, we can install all recon tools. Most of the recon tools are available in the
marketplace

Let’s search for a tool, to search just enter

marketplace search
some modules available in the marketplace

Let’s search for a specific tool, to search a specific tool enter this command 👇🏽

marketplace search dns


Instead of DNS you enter whatever you want, you could enter nmap, or any other tool you

Okay, now let’s install the searched tool, to install any tool enter this command 👇🏽

marketplace install recon/companies-domains/whoxy_dns

the module has been installed , however it needs an API key to operate. we will cover this in the
later part of the post

Instead of recon/companies-domains/whoxy_dns enter the tool you wanna install

To remove any installed tool enter

marketplace remove recon/companies-domains/whoxy_dns

9. Modules

In Recon-ng, modules are the building blocks that perform specific tasks or operations
related to reconnaissance. Modules are designed to automate common reconnaissance
tasks, such as information gathering, footprinting, and vulnerability scanning, and can be
used to gather information about targets, identify potential attack vectors, and assess the
security posture of a system or network.

Now, let’s check for the installed tool in the marketplace, the tool will be saved in modules and
to look for it enter this command
Modules search

To load the module just enter 👇🏽

modules load recon/domains-contacts/whois_pocs

Instead of recon/domains-contacts/whois_pocs enter the tool you wanna load

Now let’s do info and look at the loaded module,

info

Changing target

options unset SOURCE

Now we have unset the target, check your SOURCE there is nothing

To add the target simply enter 👇🏽

options set SOURCE [Link]

the red highlight shows the commands to load a module and find its info and the green shows
how to set and unset a domain for the module

Now the new target is set (caution: do not use a domain you are not permitted to use ,
THIS POST IS FOR ACADEMIC PURPOSES ONLY)
To run the set target just enter

run

the url doesnt have much info , its probably for demonstration purposes

10. keys

You should have noticed at the marketplace some tools asking for API keys.

So, to add the API key follow these step

API keys are unique identifiers that grant access to an API (Application Programming
Interface) service. To get an API key for a module, you typically need to follow these steps:

1. Visit the website or documentation of the module’s API service.


2. Look for the section on API keys or authentication.
3. Follow the instructions to create an account or sign in to an existing account.
4. Generate an API key, which may involve providing additional information or verifying
your identity.
5. Copy the API key and use it in your code to authenticate your requests to the API
service.

Note that the exact process for obtaining API keys may vary depending on the module and
API service you’re using. Additionally, some API services may charge fees for API access or
have limits on the number of requests you can make with your API key.

Firstly you should install a module that has API key dependency and once installed , do this
command and see what all tools require keys

keys list
I created an account with [Link] and thats how i got the API key for shodan_api

I have installed these tools 👆 which requires API and one tool has API key.

To add an API key just follow my steps 👇🏽

keys add whoxy_api 1234567890abcdefgh

Instead of whoxy_api add the module you want

To remove an API key do it 👇🏽

keys remove builtwith_api 0000000000000000000000000000000

11. Show

In Recon-ng, the “show” command is used to display information about the available
modules, workspaces, and other aspects of the framework.

Now to see any framework (eg. hosts) just enter 👇🏽

show hosts

12. Hosting on local host with python


Aside the show command you can also view your framwork on the web by hosting it on your
localhost with python

cd /usr/share/recon-ng

now use python to host it on your localhost

python3 recon-web

you can now copy the url (that’s [Link] ) and paste it in your browser
you can navigate through the web interface

Common questions

Powered by AI

The marketplace in Recon-ng facilitates the installation and management of reconnaissance tools by providing a central location to search, install, and remove modules. Key commands used in the marketplace include 'marketplace search' to find tools, 'marketplace install recon/companies-domains/whoxy_dns' to install, and 'marketplace remove recon/companies-domains/whoxy_dns' to uninstall modules. This setup streamlines the process of integrating various reconnaissance tools into Recon-ng, enhancing the framework's versatility and functionality .

Modules in Recon-ng serve as the building blocks that automate specific reconnaissance tasks, such as information gathering and vulnerability scanning. They contribute to the automation of reconnaissance by allowing users to perform common tasks systematically and efficiently, reduce manual effort, and improve accuracy. Modules can be loaded, configured, and executed using commands like 'modules load recon/domains-contacts/whois_pocs', providing a versatile and extensible framework for various reconnaissance activities .

Snapshots enhance the functionality of Recon-ng's workspaces by allowing users to save the current state of a workspace, including all modules and data, which can be revisited or shared later. To manage snapshots, users can execute commands like 'snapshots take workspace_name' to create a snapshot and 'snapshots list' to view existing snapshots. Additional commands such as 'snapshots snapshot_20230614022243.db' to load and 'snapshots remove snapshot_20230614022243.db' to delete a snapshot aid in efficient management of workspace states .

Workspaces in Recon-ng serve as isolated environments to organize and manage different projects. They are utilized effectively by creating a dedicated workspace for each project, which allows users to maintain separate sets of data and configurations. Commands such as 'workspaces create workspace_name' and 'workspaces load workspace_name' allow users to create and switch between workspaces, ensuring a clean and organized workflow for different reconnaissance tasks .

The Python Debugger (Pdb) is integrated into Recon-ng to provide interactive debugging capabilities for modules. By using the '--pdb' option with the run command, users can pause the execution of Python code to inspect variables, the call stack, and execution flow. This integration is significant during module execution as it allows developers to troubleshoot and resolve issues in real-time, which is vital for maintaining accurate and effective reconnaissance processes .

Hosting Recon-ng on a local web interface using Python involves navigating to the Recon-ng directory with 'cd /usr/share/recon-ng' and using 'python3 recon-web' to start the hosting service. This process allows users to access Recon-ng through a browser interface at 'http://127.0.0.1:5000/'. The benefits include a more user-friendly environment for navigation and interaction, improved accessibility for users who prefer graphical interfaces, and the facilitation of multi-user collaborations by allowing access through a web browser .

API keys in Recon-ng function as unique identifiers that grant access to specific API services required by some modules. The process for managing them involves obtaining an API key from the relevant service provider, which includes creating an account and following their instructions to generate keys. In Recon-ng, keys can be managed using commands such as 'keys add whoxy_api 1234567890abcdefgh' to add and 'keys remove builtwith_api 0000000000000000000000000000000' to remove keys, ensuring secure and authenticated API interactions .

Users can display information about the current framework setup in Recon-ng using the 'show' command, such as 'show hosts'. This functionality allows users to view critical aspects, like lists of hosts or modules available, which aids in understanding the current state and configuration of their reconnaissance setup. The benefits include enhanced situational awareness, quick access to relevant information, and streamlined project management by providing insights into what elements are present and active within the framework .

The shell in Recon-ng is crucial for executing various reconnaissance commands and modules. It supports reconnaissance activities by providing a command-line interface where users can load and run modules, configure options, and view results. This allows for efficient and effective execution of tasks such as scanning and information gathering, making the shell an essential component for interacting with the framework .

The command-line interface (CLI) in Recon-ng is significant as it provides direct access to the framework's capabilities and functionalities. By using the CLI, users can execute specific commands to configure settings, run modules, and manage data efficiently. The CLI impacts user efficiency positively by enabling quick execution of tasks, automation through scripting, and flexibility in toolkit integration. This streamlined operation reduces time spent on manual processes and empowers users to perform complex reconnaissance tasks with precision and control .

You might also like