6.2.1. Information collection¶
6.2.1.1. Obtaining kernel, operating system and device information¶
- Version Information
uname -aall versionsuname -rKernel version informationuname -nsystem hostnameuname -mLinux Kernel Architecture
kernel information
cat /proc/versionCPU information
cat /proc/cpuinfo- release news
cat /etc/*-releasecat /etc/issue
host name
hostnameFile system
df -akernel log
dmesg//var/log/dmesg
6.2.1.2. Users and Groups¶
List all users of the system
cat /etc/passwdList all groups in the system
cat /etc/groupList all users hash(root)``cat /etc/shadow``
- user
Query user’s basic information
fingercurrently logged in user
userswho -a/var/log/utmpQuery passwordless users
grep 'x:0:' /etc/passwd
currently logged in user
wlogged in user information
last//var/log/wtmpDisplay the latest login information of all users in the system
lastlog//var/log/lastlogLogin success log
/var/log/secureLogin failure log
/var/log/faillogView Privileged Users
grep :0 /etc/passwdView passwd last modification time
ls -l /etc/passwdCheck if there is an empty password user
awk -F: 'length($2)==0 {print $1}' /etc/shadowView remote login accounts
awk '/\$1|\$6/{print $1}' /etc/shadow- View users with sudo privileges
cat /etc/sudoers | grep -v "^#\|^$" | grep "ALL=(ALL)"
6.2.1.3. User and Privilege Information¶
Current user
whoamicurrent user information
idA user that can be elevated to root using sudo
cat /etc/sudoersList current user executable and non-executable commands
sudo -l
6.2.1.4. Environmental Information¶
print system environment information
envprint system environment information
setPath information in environment variables
echo $PATHprint history command
history/~/.bash_historyshow current path
pwdShow default system traversal
cat /etc/profileshow available shell
cat /etc/shells
6.2.1.5. Process Information¶
View process information
ps auxresource occupancy
top -cView process association files
lsof -c $PIDfull command line information
/proc/$PID/cmdlineprocess command name
/proc/$PID/commA symbolic link to the current working directory of the process
/proc/$PID/cwdSymbolic link to run the program
/proc/$PID/exeProcess environment variables
/proc/$PID/environWhen a process opens a file
/proc/$PID/fd
6.2.1.6. Service Information¶
List of services managed by inetd
cat /etc/inetd.confList of services managed by xinetd
cat /etc/xinetd.confnfs server configuration
cat /etc/exportsmail message
/var/log/mailogssh configuration
sshd_config
6.2.1.7. Scheduled tasks¶
Displays scheduled jobs for the specified user (root)
crontab -l -u %user%- Scheduled Tasks
/var/spool/cron/*/var/spool/anacron/*/etc/crontab/etc/anacrontab/etc/cron.*/etc/anacrontab
- Startup items
/etc/rc.d/init.d/
6.2.1.8. Networking, Routing and Communication¶
list network interface information
/sbin/ifconfig -a/ip addr showList network interface information
cat /etc/network/interfacesView system arp table
arp -aprint routing info
route/ip ro showView dns configuration information
cat /etc/resolv.confPrint local port open information
netstat -anList iptable configuration rule
iptables -LView port service mapping
cat /etc/servicesHostname
hostname -fView process port status
netstat -anltp | grep $PID
6.2.1.9. Installed Programs¶
rpm -qa --lastRedhatyum list | grep installedCentOSls -l /etc/yum.repos.d/dpkg -lDebiancat /etc/apt/sources.listDebian APTpkg_infoxBSDpkginfoSolarispacman -QArch LinuxemergeGentoo
6.2.1.10. File¶
Files from the last five days
find / -ctime +1 -ctime -5file system details
debugfs
6.2.1.11. Public and private key information¶
~/.ssh/etc/ssh
6.2.1.12. Logs¶
/var/log/boot.log/var/log/cron/var/log/faillog/var/log/lastlog/var/log/messages/var/log/secure/var/log/syslog/var/log/syslog/var/log/wtmp/var/log/wtmp/var/run/utmp
6.2.1.13. Virtual Environment Detection¶
lsmod | grep -i "vboxsf\|vboxguest"lsmod | grep -i "vmw_baloon\|vmxnet"lsmod | grep -i "xen-vbd\|xen-vnif"lsmod | grep -i "virtio_pci\|virtio_net"lsmod | grep -i "hv_vmbus\|hv_blkvsc\|hv_netvsc\|hv_utils\|hv_storvsc"
6.2.1.14. Container Information Collection¶
capsh --printcat /proc/1/cgroupenv | grep KUBEls -l .dockerenvls -l /run/secrets/Kubernetes.io/mountps aux