cheatsheet // 2026-01-05 // ID: REF-Example Cheatsheet: Regex

Example Cheatsheet: Regex


Welcome, aspiring cybersecurity professionals! This walkthrough is designed to demystify the initial steps of a penetration test, focusing on how we gather information about a target system. We'll be using a powerful tool called Nmap to scan for open ports and services, and we'll explain why each piece of information is important from a security perspective.

Think of this like being a detective. Before you can solve a crime, you need to gather clues. In cybersecurity, our initial clues come from scanning the target system to see what services it's running and what doors (ports) are open.

Reconnaissance

Reconnaissance is the first phase of a penetration test. It's all about gathering as much information as possible about the target without actively trying to break in. This helps us understand the "attack surface" – the parts of the system that an attacker could potentially interact with.

Network Scanning with Nmap

We'll start by using Nmap (Network Mapper), a versatile tool for network discovery and security auditing. Let's imagine we've identified an IP address for our target and we want to see what's running on it.

A common initial scan is to look for all common TCP ports and try to identify the services running on them.

nmap -sC -sV 192.168.1.100

🧠 Beginner Analysis

Let's break down this command:

Now, let's imagine we get some output from this scan.

Starting Nmap 7.91 ( https://nmap.org ) at 2023-10-27 10:30 EDT
Nmap scan report for 192.168.1.100
Host is up (0.00020s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE VERSION
21/tcp   open  ftp     vsftpd 3.0.3
22/tcp   open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0)
80/tcp   open  http    Apache httpd 2.4.41 ((Ubuntu))
139/tcp  open  netbios Microsoft Windows netblabla 6.1.7601
445/tcp  open  microsoft-ds Windows netblabla 6.1.7601
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 12.34 seconds

🧠 Beginner Analysis

This is where the magic happens! Let's dissect the output line by line:

Now, let's look at the open ports and understand why they are interesting:

This initial Nmap scan has given us a wealth of information! We know which doors are open and what services are behind them. Our next steps would involve investigating each of these open ports in more detail to find potential weaknesses.