Hey! Are you ready to learn about network scanning? In this post, I’ll show you how to install and use Nmap, a popular tool for checking networks and security, on your Android device with Termux!
Whether you want to be an ethical hacker or just love tech, Nmap helps you find out more about the networks around you. With a few simple commands, you can scan networks, see connected devices, find open ports and operating systems!
I’ll explain everything step-by-step and share some interesting examples to help you get started. By the end, you’ll have Nmap running in Termux and know how to scan networks like a pro.
So, get ready! Learning Nmap is very useful for anyone interested in cybersecurity. Let’s open Termux and begin!
What is Nmap
Nmap is a free tool that helps you scan networks and find important information about connected devices and systems. If you want to be a good ethical hacker or a network security expert, learning Nmap is very important. With a few simple commands, you can get details about networks and devices, like open ports, services running on those ports, and operating system information. Nmap works by sending data to the target system and looking at the answers it gets back, making it a key tool for exploring networks.
With Nmap, you can gather a lot of information about networks and devices. It can scan a network to find connected devices, identify open ports, and show the names of services on those ports.
If you want to scan a website, Nmap can help you find its open ports, see active IPs, and get other important details quickly. For anyone serious about cybersecurity, Nmap is a necessary tool. To learn more, visit their official website at Nmap.org.
How to Install Nmap in Termux
Installing Nmap in Termux is easy, just like installing any other package. To avoid problems, we should first update and upgrade the Termux packages. Let’s get started!
Step 1: Update and Upgrade Termux
Nmap is important for checking networks, so we want it to work well. First, we need to update and upgrade all packages in Termux. Use this command:
apt update && apt upgrade -y
This command updates the package list and upgrades all installed packages to the latest versions. This helps avoid issues when installing or using Nmap.
Step 2: Install Nmap in Termux
Nmap is a simple package in Termux and can be installed like any other package. It's small, so it won't use much data or take long to download. Run this command to install Nmap:
pkg install nmap -y
This command will download and install Nmap. Once it’s finished, Nmap will be ready to use.
Step 3: Check the Installation
To make sure Nmap is installed correctly, check its version by running:
nmap --version
This will show the version number and confirm that Nmap is installed and ready.
Step 4: Start Using Nmap
Now that Nmap is installed, you can start using it right away. For example, you can scan your own computer by running:
nmap 127.0.0.1
This will scan your system and show details about open ports and services on your computer.
Troubleshooting
If you encounter any issues during the installation:
- Ensure Termux has storage permissions:
termux-setup-storage
By following these steps, you have successfully set up Nmap in Termux. You now have a powerful tool for checking networks and security!
Common Nmap Commands in Termux
Now we will look at some useful Nmap commands that will help you use it well in Termux. The examples here will show you how to use Nmap from simple to more advanced ways. Always remember to get permission before scanning any device or network to stay out of legal trouble.
Let’s get into some important Nmap commands that will help you make the most of your Termux setup.
1. How to Scan a Website with Nmap in Termux
Scanning websites with Nmap helps you collect information for network
security. To scan a website, you need its URL
or
IP address
.
Info! For the examples below, we will use the test website
scanme.nmap.org
. This website is provided by the creators of Nmap
for testing purposes. You can replace it with any website or IP address you
have permission to scan.
To scan the website, use this command:
nmap scanme.nmap.org
Results:
Nmap will show the website's IP address
, response time in
seconds, and details about open ports. For example, it will list open ports
like 22 (SSH)
or 80 (HTTP)
and give service details
for those ports.
2. Scan Your Local Network
If you want to check what devices are on your home network, Nmap can help. You can scan the whole network to see connected devices and their open ports.
Use this command to scan your local network:
nmap 192.168.1.1/24
Output:
This command will show all devices connected to your network, including their
IP addresses
and open ports. For example, it might show your
router at 192.168.1.1
and other devices like phones or computers,
with ports like 80 (HTTP)
or 443 (HTTPS)
open.
Change 192.168.1.1/24
to match your network's gateway IP and
subnet. To find your gateway IP, use ip route
or
ifconfig
commands in Termux.
3. Do an Aggressive Scan
The aggressive scan is a strong feature of Nmap that helps you get a lot of information about a target. This includes finding out the operating system, version numbers, and the network path. It is helpful for checking security and finding weaknesses.
To do an aggressive scan, use this command:
nmap -A scanme.nmap.org
Results:
This command will give you a detailed report, showing the host's operating
system, service versions, and network path. It will also look for any security
issues. Example: The results might show operating systems like
Ubuntu Linux
and list open services such as
22 (SSH)
or 80 (HTTP)
.
Aggressive scans take longer than regular scans, especially on bigger networks. They also create more network traffic, so use them carefully on networks you own or have permission to scan.
4. Find Out the Operating System of a Device
Nmap can try to find out the operating system of a device by looking at its network responses. This helps network managers and ethical hackers know what systems are on a network.
Use this command for OS detection:
nmap -O scanme.nmap.org
Result:
Nmap will try to guess the operating system of the target based on its network
responses. For example, it might say Ubuntu Linux
. While it may
not always be completely correct, this feature gives useful information about
the network.
Error: TCP/IP fingerprinting (for OS scan) requires root privileges. QUITTING!
Nmap requires root access to perform certain scans, such as OS fingerprinting. To resolve this, you can use Termux with root privileges if your device is rooted.
If your device is not rooted, you won’t be able to perform this type of scan. Consider using a rooted device or alternative methods.
5. Check One Port
Sometimes, you may want to look at just one port on a device instead of scanning everything. Checking one port is faster and more direct, which is helpful when fixing problems or looking for certain services.
To check port 80 (HTTP)
on a device, use this command:
nmap -p 80 scanme.nmap.org
Output:
Nmap will see if port 80
is open or closed on the given IP
address/Website. If it is open, it might also tell you what service is running
on that port (like HTTP
).
You can change 80
to any port you want to check, like
443
for HTTPS, 22
for SSH, or 21
for
FTP.
6. Scan Multiple Ports
Sometimes, you may want to check many ports at the same time. This is helpful
if you're trying to find a service on different ports, like a web server that
has both HTTP
and HTTPS
open.
Use this command to check ports 80
and 443
:
nmap -p 80,443 scanme.nmap.org
Output:
Nmap will look at the specified ports (80
and 443
)
for every device in the network. The output will show which devices have these
ports open.
Nmap will show that ports 80 (HTTP)
and
443 (HTTPS)
are open or closed.
Note: You can change 80,443
to any other ports you want to
check. Just separate multiple ports or ranges with commas.
7. Ping a Host
Sometimes, you want to see if a Host is up. You can do this by sending a ping and checking how long it takes to get a reply. This helps you quickly check the status of a device or website.
To ping a Host, use this command:
nmap -sP 192.168.1.202
or
nmap -sP www.google.com
Output:
Nmap will tell you if the Host is up and show the response time in seconds. For example, if you ping Google, it will show the response time and confirm that the site is reachable.
Change 192.168.1.202
or www.google.com
to the IP
address or website you want to ping.
8. Do a Quick Scan
If you are short on time and just need basic info, a quick scan is a good
choice. The -F
option tells Nmap to do a fast scan that checks
only the most common ports, saving time while still giving useful results.
Use this command for a quick scan:
nmap -F scanme.nmap.org
Output:
The results will show information about open ports but will not look deeper into things like operating system or version. This makes the scan much faster.
Note: Use this option when you want a quick look at a network or device.
9. Save Scan Results
If you want to keep your scan results to look at later, Nmap lets you save them as a text file or XML file. This helps you record what you found or use the data with other tools.
To save the results as a text file, use this command:
nmap -oN results.txt scanme.nmap.org
To save as an XML file, use this command:
nmap -oX results.xml scanme.nmap.org
Change results.txt
or results.xml
to whatever name
you want.
10. Run a Vulnerability Scan
If you are checking security, Nmap has built-in tools to find weaknesses in a
system. The --script vuln
option runs a scan to find known
issues.
Use this command to start a scan:
nmap --script vuln 192.168.1.1
Nmap will look for common problems like outdated services, open ports that should be closed, and wrong settings.
Use this command carefully and make sure you have permission before scanning for weaknesses.
These are just a few ways you can use Nmap in Termux to check networks, find devices, and study services. By trying out these commands, you will learn more about how networks work and how to protect them. Always use Nmap in a good way, respect privacy, and get permission before scanning any network or device. Happy scanning!
💬 We Want Your Feedback!Have you used Nmap in Termux? Which commands did you find useful, or are there any features you want to try? Please share your thoughts, tips, or questions in the comments below! If you have other tools or topics you want us to talk about, tell us—we're here to help you learn about Termux and ethical hacking! Let's chat!