Ethical › Module 3 › Lesson 3
Reading Scan Output Without Crossing Scope
Open vs filtered vs closed as facts about YOUR listener, not a hunting license.
Visual · reading_scan_output
OPEN, closed_or_filtered, and timeout are facts about a listener on 127.0.0.1 — not a reason to hunt the LAN until something answers.
Opening
OPEN is a fact about YOUR door. An empty result is not permission to roam the building.
Lessons 1–2 gave you the loop (many connect attempts on an allowed host) and the handshake picture (completed connect versus a half-open idea you will not turn into a café kit). This lesson teaches you to read what the loop printed. connect_ex returning 0 means OPEN from here: the TCP handshake completed with something on that port. A nonzero return means not open in this wait window — the peer refused, nothing answered before timeout, or the stack reported another error. This course often writes that bucket as closed_or_filtered because a beginner connect scan cannot always tell a RST (“closed”) from a silent drop (“filtered”) without extra tricks this lesson will not add. The ethics trap is the empty page. Students see four closed ports, feel the lab is “fake,” and hunt until something is OPEN — café gateway, campus printer, neighbor 8000. That hunt is how a reading lesson becomes unauthorized scanning. Empty is valid. Empty is the usual laptop. Lesson 4 optionally starts python -m http.server on so you can cause one OPEN. Until then, write the closed rows honestly. This is original Cyberlium teaching mapped to a CEH v13 scanning domain — not official EC-Council training, not a cert, not exam dumps. Next is the localhost-only lab.
1. connect_ex 0 is OPEN: a completed handshake, not a product name
When connect_ex((127.0.0.1, port)) returns 0, your process completed TCP with a listener on that port on this machine (or on a VM you own, if HOST were ever that VM under writing — it is not, in this script). OPEN does not name the program. OPEN does not mean vulnerable. OPEN does not mean you may brute SSH, send exploits, or enumerate Module 4 banners on a host you do not own. On loopback, OPEN on 8000 after you started http.server is the expected reward for a later lab, not a CVE write-up and not a reason to launch Metasploit. On a neighbor’s 445, OPEN is someone else’s door — and you should never have asked.
Write OPEN with the port, the host (127.0.0.1), the timeout, and the timestamp. That row is a network fact from your vantage point. If you did not start a listener and 22 reports OPEN, something on YOUR box is accepting SSH — useful hygiene, still not a license to attack it, still not a reason to scan the rest of the LAN “for comparison.” Identify YOUR process with tools on YOUR OS (ss, netstat, Resource Monitor) if you care. Do not identify someone else’s process by scanning them.
2. Nonzero, refuse, and timeout: closed_or_filtered as an honest beginner bucket
A beginner connect scan with a short settimeout lives in a messy middle. Immediate refuse (RST) often means “nothing accepted, and the stack said so.” Timeout often means “no useful answer in 0.5s” — nothing listening, a drop, a slow host, or a firewall that ate the SYN. Professional scanners spend pages distinguishing closed from filtered. This course will not spend those pages on nmap reason codes, because the extra certainty is how people justify more probes, more flags, and more targets. For Cyberlium Module 3, nonzero after a short wait is closed_or_filtered. Record the numeric connect_ex if you want, record the timeout value, and stop. Do not add a second scan type to “resolve filtered.” Do not increase timeout to 30 seconds on a /24.
Timeout on loopback is almost always “nothing here right now.” Loopback is fast. If 80 times out on 127.0.0.1, you probably do not have a local web server, or you pointed at the wrong port. Debug YOUR listeners. A useful failure: you started http.server on 8080 and scanned 8000 — write 8000 closed_or_filtered, then either scan 8080 on loopback or move the server. Do not “fix” it by scanning 192.168.1.1:80 because home routers often answer. That answer is not your assignment. Filtered-looking silence on loopback is still not a hunting license.
3. Empty results are complete — do not hunt until something is OPEN
Many student laptops listen on none of 22, 80, 443, 8000. A four-line closed file is a perfect Lesson 3 artifact. The skill is interpreting absence without inventing a new target. “Hunt until something is open” is attacker folklore and a common unauthorized-scan confession: the person kept expanding scope until a door answered. This course grades the opposite habit. Write NO_OPEN_PORTS=true if it is true. Write that you will optionally start a listener in Lesson 4. Write that you will not nmap the internet, café, campus, or neighbor to fill the OPEN column. That paragraph is more professional than a screenshot of a stranger’s router UI.
Peer pressure will say otherwise. Discord trophy channels like OPEN lists. Ignore them. If a classmate pastes a café gateway banner and calls it reading output, that paste is evidence of the wrong lesson. Your job is to keep scan-output-notes.txt boring: host lock, port, state, timeout, ethics, legal line. Boring is in-scope. Exciting foreign IPs are out. chmod 600 so a shared lab PC account does not read even your boring file — hygiene does not wait for secrets.
A second empty-result trap is “I will just check the default gateway, that is basically mine.” Default gateways on café, hotel, campus, and many home ISPs are devices other people (or the carrier) administer. Checking them with a connect loop is still a scan of someone else’s listener. The only gateway this lesson will ever imply is 127.0.0.1 — which is not a gateway at all; it is your kernel talking to itself. If you administer a home router you bought and you someday write a dated RoE that names its LAN IP, that is a different document. It is not a silent extra row in scan-output-notes.txt. Keep the file about loopback facts so the quiz can test whether you know why the gateway was never invited.
4. What the words do not mean: permission, vulnerability, or a LAN hall pass
OPEN does not mean “in scope.” Scope was decided before the first connect, by ownership or RoE. closed_or_filtered does not mean “try harder with a different IP.” Timeout does not mean “the real hosts are on the other side of this NAT, go find them.” Filtered does not mean “bypass the firewall next.” Those leaps are how reading output becomes exploitation and how a localhost lesson becomes a campus incident. Module 5 will later say a CVE match is not automatic RCE. This lesson says a port state is not automatic consent. Two different sentences, same discipline: do not inflate a fact into a license.
Defender translation on a box you own: OPEN on an unexpected port is a ticket — what process, why bound, can it be loopback-only or stopped. closed_or_filtered on ports you expected to serve is also a ticket — is the daemon down, bound to another address, firewalled from loopback somehow. You are reading YOUR inventory. You are not reading a shopping list of other people’s doors. If you administer a VM you created, the same translation applies to that VM after writing says you may scan it. This lesson’s code still refuses any host other than 127.0.0.1 so the translation cannot wander.
Write the translation as sentences, not as tool envy. “22 closed_or_filtered: I do not run sshd on this laptop.” “8000 closed_or_filtered: I have not started http.server yet.” “8000 OPEN: I started python -m http.server bound to loopback in Lesson 4.” Those sentences are how a junior analyst talks. “22 OPEN on the café AP, I should hydra it” is how an incident starts. This course will never ask you to hydra, hashcat, or Metasploit a scan row. Module 5 will later say a CVE ID is a name, not a shell. Hold that discipline now, while the only number on the page is a port state.
5. Wrong vs right: hunting the LAN for an OPEN vs recording loopback facts
Worked failure — same output words, opposite next command. Right never treats an empty OPEN column as a broken lab.
Wrong
All ports closed_or_filtered, so nmap the café, campus printers, or a neighbor “until something is OPEN.” Treat OPEN as permission to brute or exploit. Treat timeout as a reason to drop HOST into argv. Paste foreign IPs into Discord. Skip notes. Call it reading output. This course is not a CEH dump and does not grade that hunt.
Right
Interpret connect_ex 0 as OPEN (handshake completed) and nonzero as closed_or_filtered on 127.0.0.1 only. Empty OPEN column is valid. Do not hunt the LAN. Write scan-output-notes.txt under $HOME/cyberlium-lab, chmod 600. Next: Lab — Scan 127.0.0.1 Only, where you may start a local http.server to cause one OPEN.
6. Hands-on: interpret 0 vs nonzero on loopback, lock scan-output-notes.txt
Run the interpreter on a computer you own. Fill every port row. If nothing is OPEN, write that fact and the sentence “I will not hunt another IP.” chmod 600. Windows: WSL/Git Bash or a tight profile ACL; Test-NetConnection 127.0.0.1 -Port 80 still loopback only — TcpTestSucceeded is a connect-style boolean, not a license to test the gateway.
Command guide
closed_or_filtered bucket — WHAT/WHY (honest beginner output)
═══ INSTALL ═══
Linux (Debian/Ubuntu):
Command — copy this
sudo apt install nmap
macOS:
Command — copy this
brew install nmap
Windows:
Command — copy this
choco install nmap # or download https://nmap.org/download.html
═══ COMMANDS ═══
Command — copy this
cat >> "$NOTES" << 'EOF' closed_or_filtered: nonzero, refuse, or timeout — honest beginner bucket EOF
Mission: scan-output-notes.txt in cyberlium-lab (mode 600)
1) In your own words, define OPEN (connect_ex 0 / completed handshake) and closed_or_filtered (nonzero or timeout). Write that empty OPEN is valid. 2) Run the loopback interpreter. Fill $HOME/cyberlium-lab/scan-output-notes.txt. Do not hunt another IP. chmod 600. 3) Ethics line: output is a fact about YOUR listener, not a hunting license. No café, campus, neighbor, or internet nmap. Original Cyberlium teaching, not official CEH training.
Stuck? Ask Cyberlium AI Mentor
If “the lab is incomplete without an OPEN on someone else’s host” still feels true, ask for a hint — not a LAN target. Try: "Hint only: why connect_ex 0 is OPEN on MY 127.0.0.1 listener, why closed_or_filtered and timeout are complete answers, and why I must not hunt until something is open?" You still fill scan-output-notes.txt. No café. No campus printers.
You can now read a beginner scan without turning silence into a raid. OPEN is a completed handshake with a listener you were allowed to ask. closed_or_filtered and timeout are honest buckets, not dares. Empty is valid. Notes are locked in cyberlium-lab. This is original Cyberlium teaching mapped to a CEH v13 domain — not official EC-Council training, not a cert, not exam dumps. Next — Lab — Scan 127.0.0.1 Only — hardcodes the same HOST, walks a tiny port list, optionally starts a local http.server on 8000, and writes ceh-scan.txt mode 600. Never nmap the internet, café, campus, or neighbor.
Knowledge Check
APPLY: Your loopback scan prints closed_or_filtered for 22, 80, 443, and 8000. A classmate says hunt the café until something is OPEN. What do the words mean, and what do you do?
Multiple choice
Knowledge Check
APPLY: True or False: connect_ex 0 on 127.0.0.1:8000 means OPEN and therefore you may brute SSH on any OPEN port you later find on the LAN.
True or False
Knowledge Check
APPLY: Which notes pairing matches this lesson’s interpretation and ethics?
Multiple choice
Knowledge Check
APPLY: curl of http://192.168.0.1/ shows a home router login (TP-Link / Netgear / Huawei / "Router Admin"). Is that DEMO in scope as a hacking target?
Multiple choice