Linux Enumeration
Post-exploitation enumeration commands for Linux machines on HTB.
System Information
# OS and kerneluname -acat /etc/os-releasecat /etc/issuehostnamectl
# Architecturearchuname -m
# Kernel version (for exploit research)uname -rcat /proc/versionUsers and Groups
# Current useridwhoami
# All userscat /etc/passwdcat /etc/passwd | grep -v nologin | grep -v false
# Groupscat /etc/groupgroups
# Logged in userswwholast
# Sudo privilegessudo -l
# Password hashes (if readable)cat /etc/shadowNetwork
# Interfacesip aifconfig
# Routesip routeroute -n
# Connectionsss -tulnpnetstat -tulnp
# ARP tablearp -aip neigh
# DNScat /etc/resolv.confcat /etc/hosts
# Firewall rulesiptables -L -n -vProcesses and Services
# Running processesps auxps -ef
# Process treeps auxfpstree
# Servicessystemctl list-units --type=service --state=runningservice --status-all
# Cron jobscrontab -lls -la /etc/cron*cat /etc/crontabls -la /var/spool/cron/crontabs/
# Timerssystemctl list-timersSUID/SGID/Capabilities
# SUID binariesfind / -perm -4000 -type f 2>/dev/null
# SGID binariesfind / -perm -2000 -type f 2>/dev/null
# Bothfind / -perm -6000 -type f 2>/dev/null
# Capabilitiesgetcap -r / 2>/dev/null
# Writable filesfind / -writable -type f 2>/dev/null | grep -v procFile System
# Mounted filesystemsmountdf -hcat /etc/fstab
# Find interesting filesfind / -name "*.conf" -type f 2>/dev/nullfind / -name "*.config" -type f 2>/dev/nullfind / -name "*.db" -type f 2>/dev/nullfind / -name "*.sqlite" -type f 2>/dev/nullfind / -name "*.bak" -type f 2>/dev/nullfind / -name "*.old" -type f 2>/dev/nullfind / -name "*.log" -type f 2>/dev/nullfind / -name "id_rsa" -type f 2>/dev/nullfind / -name "*.key" -type f 2>/dev/nullfind / -name "*.pem" -type f 2>/dev/nullfind / -name ".env" -type f 2>/dev/null
# Recently modified filesfind / -mmin -10 -type f 2>/dev/null
# Writable directoriesfind / -writable -type d 2>/dev/nullInteresting Locations
# Home directoriesls -la /home/ls -la /root/
# SSH keysls -la ~/.ssh/cat ~/.ssh/authorized_keyscat ~/.ssh/id_rsa
# History filescat ~/.bash_historycat ~/.zsh_historycat ~/.mysql_historycat ~/.psql_history
# Config filescat /etc/apache2/sites-enabled/*cat /etc/nginx/sites-enabled/*cat /opt/*/config*cat /var/www/html/*.php
# Database configsgrep -ri "password" /var/www/ 2>/dev/nullgrep -ri "DB_PASS" /var/www/ 2>/dev/nullDocker/Container Check
# Am I in a container?cat /proc/1/cgroupls -la /.dockerenvhostname
# Docker socketls -la /var/run/docker.sock
# Docker commands (if available)docker imagesdocker ps -aAutomated Tools
# LinPEAScurl -L https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh | sh
# LinEnum./LinEnum.sh -t
# linux-exploit-suggester./linux-exploit-suggester.sh
# pspy (process monitoring without root)./pspy64