Dive into Ethical Hacking Fundamentals: Your First Concrete Step Today
Ethical Hacking Fundamentals: the essentials in one article — real code, diagrams and concrete steps, extracts from a 42-lesson course.
The best way to learn Ethical Hacking Fundamentals is by doing. This article gives you a head start with practical excerpts from a 42-lesson course — enough to get your first results today.
- Prepare your lab
- Discover Ethical Hacking
- Reconnaissance and OSINT
- Scanning and enumeration
- Exploiting vulnerabilities
Service Enumeration (SMB, FTP, SSH, HTTP)
Learning objectives
1. Why enumerate services?
After scanning (Nmap), we know which ports are open and which services are listening. Enumeration goes further: it queries each service to extract structured information useful for exploitation.
🔍 What we are looking for
🎯 What we do next
🛠 Tools by service
2. SMB Enumeration — The most vulnerable service
SMB (Server Message Block) is Windows' file and printer sharing protocol. It is at the root of some of the most devastating vulnerabilities in history (EternalBlue, WannaCry). Its enumeration very often reveals valuable information.
2.1 enum4linux — The all-in-one tool
# Complete enumeration with enum4linux enum4linux -a 192.168.1.20 # Detailed options: # -a : all - equivalent to -U -S -G -P -r -o -n -i # -U : list users # -S : list shares # -G : list groups # -P : password policies # -r : RID enumeration (identifiers) # -o : OS information # -n : NetBIOS lookup # -i : printer information # With authentication (if credentials are known) enum4linux -u "user" -p "password" -a 192.168.1.20 # Improved version (enum4linux-ng) enum4linux-ng -A 192.168.1.20 enum4linux-ng -A -oJ report 192.168.1.20 # JSON output
2.2 Interpreting enum4linux results
Example of enum4linux output on Metasploitable2:
[*] Getting domain SID for 192.168.1.20
[+] Host is part of a workgroup (not a domain)
[*] Enumerating Workgroup/Domain on 192.168.1.20
[+] Got domain/workgroup name: WORKGROUP
[*] Getting OS information for 192.168.1.20
[+] Got OS info for 192.168.1.20 from smbclient:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.20-Debian]
<-- Samba 3.0.20 = CVE-2007-2447 (username map script) !
[+] Enumerating users using SID S-1-5-21-... and logon username '', password ''
S-1-5-21-...-500 METASPLOITABLE\Administrator (Local User)
S-1-5-21-...-501 METASPLOITABLE\nobody (Local User)
S-1-5-21-...-1000 METASPLOITABLE\msfadmin (Local User) <-- Target user!
[+] Enumerating shares on 192.168.1.20
//192.168.1.20/print$ Printer Drivers
//192.168.1.20/tmp oh noes! <-- tmp share, probably accessible!
//192.168.1.20/opt opt
//192.168.1.20/IPC$ IPC Service (metasploitable server)
//192.168.1.20/ADMIN$ IPC Service
[+] Password Info for Domain: METASPLOITABLE
[+] Minimum password length: 5 <-- Weak policy!
[+] Password history length: None
[+] Account lockout threshold: None <-- No lockout = brute force possible!2.3 smbclient — Accessing shares
# List available shares (anonymous access) smbclient -L //192.168.1.20 -N # -L : list shares # -N : no password (anonymous access) # List shares with a user smbclient -L //192.168.1.20 -U "user" # Connect to a specific share smbclient //192.168.1.20/tmp -N # Useful commands inside smbclient: smbclient //192.168.1.20/tmp -N -c "ls" # List contents smbclient //192.168.1.20/tmp -N -c "get file.txt" # Download a file smbclient //192.168.1.20/tmp -N -c "put local.txt" # Upload a file smbclient //192.168.1.20/tmp -N -c "dir" # List directory # Download all content from a share smbclient //192.168.1.20/tmp -N \ -c "prompt OFF; recurse ON; mget *"
2.4 smbmap — Permission mapping
# Check permissions on all shares (anonymous) smbmap -H 192.168.1.20 # With authentication smbmap -H 192.168.1.20 -u "msfadmin" -p "msfadmin" # List the contents of a specific share smbmap -H 192.168.1.20 -r "tmp" # Search for specific files smbmap -H 192.168.1.20 -u "msfadmin" -p "msfadmin" \ -R --depth 5 # Example smbmap output: # [+] Guest session IP: 192.168.1.20:445 # Disk Permissions Comment # ---- ----------- ------- # print$ NO ACCESS Printer Drivers # tmp READ, WRITE oh noes! <-- Full access! # opt NO ACCESS # IPC$ NO ACCESS IPC Service
2.5 Nmap scripts for SMB
# Detect Samba/SMB version nmap --script smb-os-discovery -p 139,445 192.168.1.20 # Enumerate users nmap --script smb-enum-users -p 445 192.168.1.20 # Enumerate shares nmap --script smb-enum-shares -p 445 192.168.1.20 # Security policies nmap --script smb-security-mode -p 445 192.168.1.20 # Detect EternalBlue (MS17-010) nmap --script smb-vuln-ms17-010 -p 445 192.168.1.20 # Detect MS08-067 (Conficker) nmap --script smb-vuln-ms08-067 -p 445 192.168.1.20 # All in one command nmap --script "smb-*" -p 139,445 192.168.1.20
3. FTP Enumeration
FTP (File Transfer Protocol) is a very common file transfer protocol, unfortunately often misconfigured and unencrypted. Anonymous access and vulnerable versions make it a prime target.
3.1 Anonymous FTP connection
# Check if anonymous access is possible nmap --script ftp-anon -p 21 192.168.1.20 # Manual connection with the FTP client ftp 192.168.1.20 # User: anonymous (or ftp) # Password: (any email address or empty) # If anonymous access is allowed, useful FTP commands: ftp> ls -la # List all files (including hidden) ftp> pwd # Current directory ftp> cd / # Go to root ftp> get file.txt # Download a file ftp> mget *.txt # Download multiple files ftp> put local.txt # Upload (if write permission) ftp> binary # Binary mode (for non-text files) ftp> passive # Passive mode (if direct connection impossible) ftp> quit # Disconnect # Anonymous access with wget (download all content) wget -r --no-passive ftp://anonymous@192.168.1.20/
ARP Spoofing and ARP cache poisoning
At the end of this lesson, you will be able to: understand the ARP protocol and its weaknesses, perform an ARP spoofing attack in the lab, use arpspoof, ettercap and Bettercap, and implement effective countermeasures.
1. The ARP protocol: how it works
ARP (Address Resolution Protocol) is a layer 2 (data link) protocol that resolves an IP address to a MAC address on a local network. Without ARP, machines could not communicate directly even on the same network segment.
📡 ARP Request
A machine sends a broadcast message across the entire network:
"Who has IP 192.168.1.1? Tell 192.168.1.10"
This message is sent to the broadcast MAC address: FF:FF:FF:FF:FF:FF
📢 ARP Reply
The target machine replies in unicast:
"It's me! My MAC address is AA:BB:CC:DD:EE:FF"
The sending machine stores this association in its ARP cache.
ARP is a stateless and unauthenticated protocol. Any machine can send an ARP reply, even without having received a request. This is called a "Gratuitous ARP".
2. The ARP cache
Each machine maintains an ARP cache: a table that associates IP addresses with MAC addresses. This table has a limited lifetime (generally 2 minutes on Linux, 10 minutes on Windows).
View the ARP cache
# On Linux arp -a # Detailed view arp -n # With ip neigh (more modern) ip neigh show # On Windows arp -a
Example output on Linux:
? (192.168.1.1) at aa:bb:cc:dd:ee:ff [ether] on eth0 ? (192.168.1.20) at 11:22:33:44:55:66 [ether] on eth0 ? (192.168.1.30) at de:ad:be:ef:ca:fe [ether] on eth0
On Kali Linux, use
ip neigh show instead of arp -a: the ip command is part of the iproute2 package and is more modern and complete.3. The ARP Spoofing attack: principle
ARP Spoofing (or ARP Poisoning) consists of sending fake ARP packets on the local network in order to associate the attacker's MAC address with the IP address of another machine (usually the gateway).
This attack is illegal on any network without explicit authorization. Practice only in your virtual lab with Kali Linux and Metasploitable.
Typical MITM attack scenario via ARP Spoofing
🆕 Step 1: Normal state
The victim (192.168.1.10) communicates normally with the gateway (192.168.1.1).
Victim ARP cache:192.168.1.1 → aa:bb:cc:11:22:33
⚡ Step 2: Poisoning
The attacker sends fake ARP Replies:
— To the victim: "192.168.1.1 = my MAC"
— To the gateway: "192.168.1.10 = my MAC"
Passive Reconnaissance — WHOIS, DNS, Google Dorks
Learning objectives
1. Passive vs active reconnaissance
The reconnaissance phase is the first step of the pentest methodology. It consists of collecting information about the target before any exploitation attempt. There are two fundamental types:
🔐 Passive reconnaissance
Definition: Information gathering without direct interaction with the target's systems. Publicly available sources (OSINT) are used.
🔹 Active reconnaissance
Definition: Direct interaction with the target's systems to gather information in real time.
2. WHOIS — Domain information
The WHOIS protocol allows querying public databases containing registration information for domain names and IP addresses. It is often the first command executed during reconnaissance.
2.1 Essential WHOIS commands
# Basic WHOIS lookup on a domain whois example.com # WHOIS on an IP address (reveals the owning organization) whois 93.184.216.34 # WHOIS using a specific server whois -h whois.arin.net 8.8.8.8 # Filter important results with grep whois example.com | grep -i "registrar\|name server\|creation\|expir\|email" # Command-line WHOIS on Windows (via Sysinternals) whois.exe example.com
2.2 Important data in a WHOIS result
| WHOIS field | Meaning | Interest for the pentester |
|---|---|---|
| Registrar | Registrar used | Identify the DNS provider, social engineering possibilities |
| Registrant Name / Org | Name and organization of the owner | Real name, parent organization, contacts |
| Admin Email | Administrator email | Potential phishing target, internal email format |
| Name Servers | Authoritative DNS servers | Identify DNS for zone transfer attacks |
| Creation Date | Domain creation date | Organization age, history |
| Expiration Date | Expiration date | Possibility of buying an expired domain |
| Updated Date | Last update | Recent activity on the domain |
| DNSSEC | DNS security enabled or not | Presence or absence of protection against cache poisoning |
2.3 Alternative web WHOIS tools
🌎 who.is
Complete web interface with WHOIS history and additional hosting information.
🌐 DomainTools
WHOIS history, reverse WHOIS (find all domains of a person), data correlation.
🔍 ViewDNS.info
Multiple DNS and WHOIS tools, reverse IP lookup, DNS history.
3. DNS — Querying the Domain Name System
The DNS (Domain Name System) is a distributed system that translates domain names into IP addresses. For a pentester, it is a goldmine of information about the target infrastructure.
This article covers the most useful excerpts — the complete Ethical Hacking Fundamentals course (12 chapters, 42 lessons, corrected exercises and final project) takes you all the way.
./access-the-full-course free course: Mastering Claude CodeFAQ
How long does it take to learn Ethical Hacking Fundamentals?
Are there any prerequisites?
Where to start concretely?
📬 Want to receive this type of guide every week? Subscribe for free — real code, zero fluff.