Port Scanning & Security Checks – The Ninja’s Secret Weapon!
Now we enter the shadowy world of network security. Today, you learn the ninja art of port scanning – the ability to see what doors are open on a machine and who left their security wide open!
But beware… with great power comes great responsibility (and maybe some angry sysadmins if you misuse it 😬).
What Are Ports? – The Secret Entryways
Think of a computer like a fortress 🏰, Ports are the doors through which data flows.
- Port 22 → SSH (Remote login 🖥️)
- Port 80 → HTTP (Web browsing 🌍)
- Port 443 → HTTPS (Secure web browsing 🔒)
- Port 3306 → MySQL (Databases 📊)
Your mission, should you choose to accept it, is to find open ports and check if the system is exposed to threats.
The Art of Stealth Scanning – Using nmap
A true ninja never barges in through the front door – they scan quietly! nmap
is the ultimate tool for scanning open ports, detecting services, and even identifying operating systems.
Command | What It Does |
---|---|
nmap scanme.nmap.org | 🔍 Basic scan of a target |
nmap -sS scanme.nmap.org | 🕶 Stealth scan (avoids detection) |
nmap -p 22,80,443 scanme.nmap.org | 🎯 Scan specific ports |
nmap -A scanme.nmap.org | 🕵️ Detect OS and services |
💡 Example:
nmap -p 22,80,443 scanme.nmap.org # Check if SSH, HTTP, or HTTPS is open
If port 22 is open, the system allows remote logins (potential vulnerability!). 😨
Who’s Listening? – Using netcat
netcat
(nc
) is a ninja tool for checking open ports and even chatting secretly through a network.
Command | What It Does |
---|---|
nc -zv scanme.nmap.org 22 | 🕵️ Check if SSH is open |
nc -zv scanme.nmap.org 80 | 🌍 Check if a web server is running |
nc -lvnp 4444 | 🔊 Listen on port 4444 (for backdoors 😏) |
💡 Example:
nc -zv scanme.nmap.org 443 # Check if HTTPS is open
If a port is open, it means a service is running there – and possibly exploitable. 😈
Firewall Checks – Is My Defense Strong?
A fortress is useless without strong walls. Test your own firewall to see what ports are open and if attackers can slip in.
Command | What It Does |
---|---|
sudo ufw status | 🔥 Check if firewall is active |
sudo iptables -L | 🛡 View current firewall rules |
nmap -Pn YOUR_IP | 🎯 Check your own attack surface |
💡 Example:
sudo ufw status # Make sure your firewall is blocking unwanted access
If firewall is off, your system is wide open to attackers! 😱