This script creates a spreadsheet (packages.csv) listing every software package manually installed on a Linux system, along with its executable commands and a brief description.
echo 'Package,Commands,Description' > packages.csv
for pkg in $(apt-mark showmanual); do
desc=$(dpkg-query -W -f='${Description}' "$pkg" 2>/dev/null | head -n1)
cmds=$(dpkg -L "$pkg" 2>/dev/null \
| grep -E '/bin/' \
| xargs -r -n1 basename \
| sort -u \
| paste -sd ';' -)
printf '"%s","%s","%s"\n' \
"$pkg" "$cmds" "$desc" >> packages.csv
doneFor a pentester, this is used for post-exploitation inventory—allowing them to quickly identify pre-installed tools they can exploit to elevate their privileges (GTFOBins) or use to sneakily "live off the land" without uploading loud hacking tools.
