DarkPC Security Lab — Part 2: Discover Open Ports with Nmap
Category: Networking & Security · Platform: Slackware 15.0 / Linux · Level: Beginner · Updated: 6 November 2026
Scope: Scan only your own devices or networks you have explicit permission to assess. A shared Wi-Fi connection is not blanket permission to scan everyone else's equipment. Start with
127.0.0.1, then move to a known host you control.
Nmap (Network Mapper) is a classic Unix-friendly tool for learning what services a machine exposes. It cannot magically tell you that a port is vulnerable, but it helps answer useful questions: Is SSH listening? Is a web server reachable? Which devices do I actually manage on my home network?
1. Check your Slackware tools
Open a terminal:
nmap --version
If the command is missing, first check your configured Slackware 15.0 repository and the available package name:
su -c 'slackpkg search nmap'
If Nmap is available in your configured repository, use Slackware's normal slackpkg installation process rather than downloading a mystery binary. The examples in this guide deliberately use TCP connect scans (-sT), which can run as an ordinary user; no root privileges are needed.
2. First scan: your own machine
Run:
nmap -sT -p 22,80,443 127.0.0.1
Here is what the pieces mean:
| Option | Meaning |
|---|---|
-sT |
Make TCP connections to check port states. |
-p 22,80,443 |
Test only three named ports. |
127.0.0.1 |
Your own computer's loopback address. |
You might see SSH open on port 22, a web server on 80 or 443, or no open ports at all. Results depend on your actual running software; don't assume a screenshot will match your system.
To compare with what Linux believes is listening locally:
ss -lnt
ss -lnt lists local listening TCP sockets. Some may bind only to loopback rather than the whole network; that difference matters.
3. Discover the lab server from Part 1
If you followed Part 1 — Compiling Proof-of-Concept Code, start its harmless Python server in another terminal:
python3 lab-server.py
Then scan its known listening port:
nmap -sT -p 8765 127.0.0.1
You should see 8765/tcp as open while the server runs. Stop it with Ctrl+C, scan again, and the port should normally appear closed. This provides a repeatable, hands-on demonstration without scanning strangers or guessing about your router.
4. Find your own network details
On Slackware, try:
ip -br address
ip route
Look for your active interface, your assigned IPv4 address and your router/default route. As an example only, an address of 192.168.1.25/24 often means a 192.168.1.0/24 local subnet. Do not copy that range blindly: some homes use 192.168.0.0/24, 10.0.0.0/24, or a different prefix. Confirm it in your router settings.
If you administer that entire subnet and are permitted to inventory its devices, use host discovery:
nmap -sn 192.168.1.0/24
The -sn option does host discovery without subsequently running a port scan. It may not detect every device, particularly when firewalls or network isolation interfere. For a beginner, a list of IP addresses and responsive hosts is already useful.
If you only control one device, skip the subnet scan and use that device's exact IP address for the following steps.
5. Check services on a device you own
Replace the example IP below with your own computer, NAS or test VM:
nmap -sT -p 22,80,443 192.168.1.10
To ask Nmap to identify software listening on those ports:
nmap -sT -sV -p 22,80,443 192.168.1.10
-sV sends additional probes to help identify services and sometimes versions. Identification can be incomplete or mistaken; an open port and a guessed software version are not proof of a security vulnerability. Nmap's official reference guide explains the details.
6. Understand the results
| State | Plain-English meaning |
|---|---|
| open | A service appears to accept connections on that port. |
| closed | The port responded, but no service appears to be listening. |
| filtered | A firewall/filter or network obstacle prevents a clear open/closed determination. |
| open|filtered | With some scan types, Nmap cannot distinguish an open port from one blocked by filtering. |
Some common TCP ports: 22 (SSH), 80 (HTTP), 443 (HTTPS), 631 (IPP printing), 445 (SMB). Port names describe conventions, not guarantees: a service can use a non-standard port, and a labelled port may run something unexpected.
7. Save a baseline to compare later
nmap -sT -sV -p 22,80,443 -oN ~/darkpc-nmap-baseline.txt 192.168.1.10
-oN writes a readable text report. Replace the IP address with a device you own. Run the same command after installing a new service or making a firewall change to see what became exposed.
A simple maintenance habit is to keep a record of expected listening services, disable those you no longer use, update software, and limit access with appropriate local or router firewall rules.
8. Troubleshooting
nmap: command not found— Check Slackware's available packages and your configured mirror.Host seems down— Verify the address and connectivity. Firewalls can prevent discovery, and devices may be asleep; do not assume a failure means the device doesn't exist.- Everything says filtered — A host firewall, VLAN isolation or router policy may be blocking probes.
- An unfamiliar port appears — Confirm it with
ss -lnton that device, then investigate the relevant application and configuration. Avoid declaring a system “hacked” from a port number alone. - Can't scan another device — Check that you have permission, the correct IP, and a real route between the two hosts.
Final thoughts
The useful habit is not scanning everything on the internet. It is knowing what your own machines are running and why. Combine Nmap results with local tools, patch management and sensible firewall rules, and you've got a practical little security audit.
Previous: Part 1 — Compiling Proof-of-Concept Code.
References
- Nmap: host discovery (
-sn) - Nmap: service/version detection (
-sV) - Nmap: port states
- Slackware official package search
Keep exploring: Part 1: Compiling.