How to Start Ethical Hacking: Wireshark, Kali, Nmap and Dirb in a Safe Lab
· Cybersecurity, Ethical Hacking, Wireshark, Nmap, Kali Linux

Most people who want to learn ethical hacking quit in the first week. Not because it is too hard, but because they start with theory, never see a real packet, and never build a place where they are allowed to practice. This guide fixes both. It walks through three free video resources in the order that makes sense, and pairs each one with a hands-on exercise you run in your own lab.
The three resources:
- A Wireshark tutorial: see real network traffic with your own eyes, so everything else starts to make sense.
- freeCodeCamp's hands-on cybersecurity course: you are inside Kali Linux in the first hour, instead of watching theory for days.
- Nmap + Dirb + Wireshark in one attack: the three tools working together, which almost no tutorial shows.
Before any of that, there is Step 0. Do not skip it.
Step 0: The rules and your safe lab
Only scan, probe, or attack systems you own or have written permission to test. In the United States, unauthorized access is a crime under the Computer Fraud and Abuse Act, and most countries have similar laws. A port scan against your employer, your school, or a random IP "just to see" can get you fired, expelled, or charged. Every exercise in this guide targets a machine inside your own lab.
What you need
| Piece | What it is | Why |
|---|---|---|
| VirtualBox (or VMware Workstation / UTM on Apple Silicon) | Free hypervisor | Runs both machines on your laptop |
| Kali Linux VM | Attacker machine with the tools preinstalled | Nmap, Dirb, and Wireshark come with it |
| Metasploitable 2 | Intentionally vulnerable Linux VM | A legal target that is meant to be broken |
| DVWA (optional) | Damn Vulnerable Web Application | A deliberately weak web app for Dirb and web practice |
| 8 GB RAM minimum | 16 GB is more comfortable | Two VMs at once |
Network setup
Put both VMs on a Host-Only network (in VirtualBox: File → Tools → Network Manager, then set each VM's adapter to Host-only Adapter). The default range is usually 192.168.56.0/24.
This matters for safety: Metasploitable 2 is full of known holes. Never bridge it to your home network or expose it to the internet. Host-Only means the two VMs can see each other and your laptop, and nothing else.
Check that it works from Kali:
ip addr # find Kali's address, e.g. 192.168.56.101
ping -c 3 192.168.56.102 # Metasploitable's address (log in and run ip addr on it)
Prefer not to build anything? Browser-based labs like TryHackMe and Hack The Box give you legal targets with a VPN connection. Their beginner paths are a good companion to this guide.
Step 1: Wireshark Tutorial (see real traffic)
Wireshark captures every packet crossing a network interface and decodes it layer by layer. The moment you watch a DNS question go out and an answer come back, "the network" stops being abstract. Every tool later in this guide is easier to understand when you can see what it sends.
What to watch for in the video
- How to pick the right interface to capture on
- The three panes: packet list, packet details (the layers), and raw bytes
- Display filters versus capture filters
- Follow → TCP Stream to read a whole conversation
Display filters you will use constantly
| Filter | Shows |
|---|---|
ip.addr == 192.168.56.102 | Everything to or from one host |
dns | DNS questions and answers |
http.request | HTTP requests (method, URL, host) |
tcp.flags.syn == 1 && tcp.flags.ack == 0 | New TCP connection attempts (SYNs) |
tcp.port == 80 | Traffic on port 80 |
!(arp or dns) | Hide background noise |
Capture filters (set before you start) use a different syntax, BPF: host 192.168.56.102 or port 80.
Lab exercise 1
- In Kali, open Wireshark and capture on the Host-Only interface (often
eth0oreth1). - In a terminal:
curl http://192.168.56.102/ - Stop the capture. Filter
tcp.port == 80. - Find the three-way handshake (SYN, SYN-ACK, ACK), the
GET /request, and the response. - Right-click a packet → Follow → TCP Stream. You are reading the raw HTTP conversation.
That is the core lesson: unencrypted protocols (HTTP, FTP, Telnet) show everything, including passwords, to anyone who can capture the traffic. That is why HTTPS exists.
Step 2: freeCodeCamp Hands-On Course (Kali Linux + Nmap)
freeCodeCamp's Hands-On Cybersecurity and Ethical Hacking course gets you into Kali fast. It covers Linux terminal basics, files and directories, piping and redirection, users and permissions (including sudo), networking with ip addr, package management, an introduction to Nmap and port scanning, Wi-Fi security concepts with Aircrack-ng, and a Wireshark section.
What to focus on
- The terminal first.
ls,cd,cat,grep,|,>,sudo. Every security tool is a command-line tool underneath. - Permissions. Understanding
rwxand whysudoexists explains half of what privilege escalation means later. - Nmap. Your first real recon tool.
- The Wi-Fi section is for your own router only. Capturing handshakes or sending de-authentication frames on networks you do not own is illegal in most places, and de-auth attacks disrupt other people's connections.
Nmap in your lab
Nmap sends probes and reports which hosts are up, which ports are open, and what is listening.
# 1. Which hosts are alive on the lab network? (no port scan)
nmap -sn 192.168.56.0/24
# 2. Top 1,000 TCP ports on the target
nmap 192.168.56.102
# 3. Service and version detection plus default scripts
sudo nmap -sV -sC 192.168.56.102
# 4. Every TCP port (slower, finds services on odd ports)
sudo nmap -p- 192.168.56.102
# 5. Save results in all formats
sudo nmap -sV -oA scan1 192.168.56.102
Reading the output
| State | Meaning |
|---|---|
open | Something is listening and answered |
closed | Host is reachable, nothing listening on that port |
filtered | No answer; a firewall is probably dropping the probe |
Against Metasploitable 2 you will see a long list: FTP (21), SSH (22), Telnet (23), HTTP (80), SMB (139/445), MySQL (3306), and more, often with old version numbers. Each old version is a lead to research, which is exactly what recon is for.
Why sudo? As root, Nmap's default is a SYN scan (-sS), which sends a SYN and never completes the handshake. Without root it falls back to a full TCP connect scan (-sT). Results are similar; the packets are different, and you will see that difference in Step 3.
Step 3: Nmap + Dirb + Wireshark in a Real Attack
This is the part most tutorials skip: running the tools as a workflow, and watching what each one does on the wire.
The workflow
- Nmap finds the door. It tells you port 80 is open and running a web server.
- Dirb looks for hidden rooms. It requests thousands of common paths (
/admin,/backup,/phpmyadmin) and reports which ones exist. - Wireshark shows the noise. You see every probe both tools send, which is also exactly what a defender would see.
Dirb in your lab
Dirb is a dictionary-based web content scanner. It is preinstalled on Kali, with wordlists in /usr/share/dirb/wordlists/.
# Default wordlist (common.txt)
dirb http://192.168.56.102/
# Choose a wordlist and look for specific extensions
dirb http://192.168.56.102/ /usr/share/dirb/wordlists/common.txt -X .php,.txt,.bak
Read the results by status code:
| Code | Meaning for you |
|---|---|
200 | The page exists and is readable |
301 / 302 | Redirect, often a directory (Dirb marks these DIRECTORY) |
403 | Exists but access is forbidden: still interesting |
401 | Exists and asks for a login |
On Metasploitable 2, Dirb typically turns up the bundled web apps (such as /dvwa/, /mutillidae/, /phpMyAdmin/) plus directories that should never be public. Modern alternatives with the same idea are gobuster and ffuf, which are faster; learn Dirb first because its output is simple.
Lab exercise 3
- Start a Wireshark capture on the Host-Only interface.
- Run
sudo nmap -sS -p 1-1000 192.168.56.102. Stop and filtertcp.flags.syn == 1 && tcp.flags.ack == 0: hundreds of SYNs to different ports in seconds. For open ports the target answers SYN-ACK and Kali replies RST, so the handshake never completes. - Start a new capture. Run
dirb http://192.168.56.102/. Filterhttp.request: thousands ofGETrequests for paths that mostly return 404. - Write down what a defender would notice: one source IP, many ports or many 404s, in a very short time. That is what intrusion detection systems and web application firewalls alert on.
You have now done reconnaissance and seen it from the blue-team side. That double view is what makes someone useful in a security job.
What to learn next
| Next step | Why |
|---|---|
| TryHackMe Pre Security and Jr Penetration Tester paths | Guided, legal targets |
| Hack The Box Starting Point | More realistic boxes once basics feel easy |
| OWASP Top 10 + DVWA | How web apps actually break |
| CompTIA Security+ | Common entry-level certification for security roles |
| INE eJPT | Beginner hands-on penetration testing certification |
| Write-ups of every lab | Your notes become your portfolio |
Quick reference
| Tool | Question it answers | First command |
|---|---|---|
| Wireshark | What is actually on the wire? | Capture, filter ip.addr == TARGET |
| Nmap | Which hosts and ports are open, running what? | sudo nmap -sV -sC TARGET |
| Dirb | Which hidden web paths exist? | dirb http://TARGET/ |
Credits
The three videos belong to their creators; they are embedded here so you can watch them in order. freeCodeCamp's course is free on their YouTube channel. Everything else in this guide (lab setup, exercises, filters, and commands) is our own study material.
Practice only on machines you own or are allowed to test. Follow @rankcore.ai for daily lessons, and read more on blog.rankcore.ai.
Want to go deeper?
Our step-by-step video courses turn these ideas into results.
Comments
No comments yet — be the first.