PenTest+ level · Domain 2.0 Reconnaissance and Enumeration · 21% of the mapped exam

2.3 Given a scenario, modify scripts for reconnaissance and enumeration.

11 topics · 3 quiz questions · 1 hands-on lab

Testers adapt small scripts constantly. You should be able to read Bash, Python and PowerShell and change a loop, a condition or an output format.

Purpose

Information gathering
Automating lookups and scans across many targets.
Data manipulation
Parsing, filtering and reformatting output (e.g. extracting IPs from scan results).

Scripting languages

Bash
Linux shell scripting; great for chaining command-line tools with pipes.
Python
General-purpose language with rich libraries for networking and parsing.
PowerShell
Windows-native scripting with object pipelines and deep OS and AD access.

Logic constructs

Loops
Repeat actions over a list, e.g. for each host in a range.
Conditionals
If/else decisions, e.g. only report open ports.
Boolean operator
AND, OR, NOT combining conditions.
String operator
Concatenation, comparison and matching of text.
Arithmetic operator
Addition, subtraction, increments, e.g. stepping through ports.

Use of libraries, functions, and classes

Use of libraries, functions, and classes
Reusing code (e.g. Python socket, requests, Scapy) and organising logic into functions and classes for readable, reusable tools.
Scenario

A Bash loop pings 10.0.0.1-254 but prints every result. How would you change it to print only hosts that reply?

Show answer

Wrap the ping in a conditional on its exit status, e.g. for i in $(seq 1 254); do ping -c1 -W1 10.0.0.$i >/dev/null && echo "10.0.0.$i up"; done. The && runs echo only when ping succeeds.

Hands-on practice

Check your understanding

Loading quiz…

Original CoreQ Academy material, mapped to objective 2.3 of the publicly available CompTIA PenTest+ PT0-003 exam objectives (Exam objectives V3, document version 5.0). Not affiliated with or endorsed by CompTIA. Contains no exam questions.