A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
Calling another security tool from Bash creates a contract: input arguments, working directory, environment, output streams, and exit status. Make those pieces visible. Use arrays for complex argument lists so Bash does not have to reinterpret a prebuilt command string.
| Question to ask | Why it matters |
|---|---|
| Invoke external tools with explicit arguments and bounded scope | Keeps the lesson tied to an observable security outcome. |
| Failure signal | Use exit status and raw evidence to separate “no finding” from “check failed”. |
The safest pattern is direct execution, not `eval`. Build an argument array, invoke the command, redirect stdout and stderr deliberately, then inspect the return code. This preserves argument boundaries and makes whitespace in a path much less surprising.
Stores a controlled scanner invocation as separate Bash array elements. The useful habit here is to treat the command output as evidence about one system fact, not as a magical diagnosis.
When a tool is optional, check for it explicitly and report a clear dependency error. A script that silently falls back to a different scanner produces harder-to-audit results than one that stops and tells the operator what is missing.
Checks whether the scanner is available in PATH before use. Read the result in context: the same command can be correct yet insufficient if a permission boundary, alternate configuration, or different backend changes what it reports.
Captures the two output streams and records the exit status for troubleshooting. In a production workflow, save the raw result when the observation contributes to a finding. That keeps later analysis honest and makes troubleshooting reproducible.
A practitioner’s checkpoint: compare the observed behavior with the assumption your script is about to make. If the assumption is broader than the evidence, narrow the rule. If the evidence is incomplete, report the uncertainty instead of converting it into a confident finding.
Lab discipline: stay inside the declared course environment, prefer read-only checks for learning exercises, and preserve the original output of security tools before transforming it.
Finish the lesson once you have worked through the material. This awards ★ 35 XP.