Networking basics and nmap against the lab
IP addresses, ports and services, then map your practice targets with nmap.
Roman Urdu: IP, ports aur services samjho, phir nmap se apne practice targets ka naqsha banao.
Video transcript
You cannot defend, or test, what you have not found. So every real assessment starts with recon: mapping what is there.
Every machine on a network has an address. Think of it as a building. Ports are its numbered doors. Behind an open door, a service is listening: a web server, a remote login, a database.
A port scanner, like nmap, knocks on each door and notes the answer. Open: a service answered. Closed: nothing is there. Filtered: a firewall dropped the knock.
Recon goes in two steps. First, find the practice hosts, and check that each one answers. Then pick one, and list its open ports, and which service and version sits behind each. Old versions are where known bugs live.
One rule before anything else. Scanning is knocking on someone's doors. Only scan systems you own, or have written permission to test. The practice lab is yours to scan.
So: find it first, then test it. In the lab, you find the three practice hosts, then list the open ports and services on the target.
Rules: Only test systems you own or have written permission to test. Everything in this track runs against practice targets inside your own machine. Scanning or attacking anyone else’s system without permission is a crime in most countries.
Goal
Find the three practice hosts and list the open ports and services on target.lab.
Why it matters
You cannot defend or test what you have not found. Recon is the first step of every real assessment.
Your machine · learn-cyber · lab cyber-02
A terminal on your own cyber machine, right in this page. It keeps your files between lessons.
First time: make your course machine from any terminal (Mac, Linux and Windows 10+ all have ssh). Your ssh key is your login; a new key picks a handle and accepts the terms first.
$ ssh -t -p 2200 m.logicpacks.io new cyber --name learn-cyberAfter that, come back to the same machine any time. Your files are still there:
$ ssh -t -p 2200 learn-cyber@m.logicpacks.ioTo use the terminal in this page, sign this browser in once: run this and open the link it prints.
$ ssh -p 2200 m.logicpacks.io webAll your machines in the browser: logicpacks.io/m. A guest key gets one machine: if you already use it for something else, rm that one or link a free account (3 machines). How machines work, credits and terms: logicpacks.io/machines
Step by step
Start the practice targets (about 20 seconds; Juice Shop is the slowest).
$ lab start$ lab statusA port scan is knocking on doors: each port answers open, closed or filtered. Only scan what you own or are allowed to test. The targets live inside your machine on their own addresses (127.66.0.10-12), so nothing you scan leaves it. See how the names resolve.
$ getent hosts target.lab dvwa.lab juice.labFind which of them are up (a ping sweep, no port scan).
$ nmap -sn 127.66.0.10-12Scan the 1,000 most common ports on the target. (
nmap -p- ${T}checks all 65,535; it takes about a minute and a half on a small machine.)$ nmap target.labAsk each open port what is running and which version, and save it. Lesson 8 uses it.
$ mkdir -p ~/scans && nmap -sV -p 22,80,3000,3306 target.lab -oN ~/scans/target.txt
Check my work
Run this in your machine. It checks your work and prints PASS, or FAIL with a hint about what is missing.
$ lab check cyber-02