Linux

Spawning a better shell

python3 -c 'import pty;pty.spanw("/bin/bash")' 

Spawning a better shell (if no Python on target)

/usr/bin/script -qc /bin/bash /dev/null
  • CTRL-Z
stty raw -echo; fg
  • Hit ENTER twice
export TERM=xterm

Check commands ran by Root (without sudo)

ps auxww | awk '$1=="root" || NR==1{print}'

Check PATH for irregularities

echo $PATH

Find SUID binaries

find / -user root -perm -4000 -exec ls -ldb {} \; 2>/dev/null

Find all binaries with SUID 's' set

find / -perm -u=s -type f 2>/dev/null

Find any database files

find /home/app -type f -name "*.db" 2>/dev/null

Check all open ports

ss -lntp

Show all running processes

ps -ef --forest | less -S

List all running services

systemctl list-units --type=service

Find specific service

find /etc/ -name *.service | grep cozy

Use case: Search all files in 'dev' user that have the name 'prod'

find / -type f -user dev -exec grep prod {} \; 2>/dev/null