#Info about me id || (whoami && groups) 2>/dev/null #List all users cat /etc/passwd | cut -d: -f1 #List users with console cat /etc/passwd | grep "sh$" #List superusers awk -F: '($3 == "0") {print}' /etc/passwd #Currently logged users w #Login history last | tail #Last log of each user lastlog
#List all users and their groups for i in $(cut -d":" -f1 /etc/passwd 2>/dev/null);doid$i;done 2>/dev/null | sort #Current user PGP keys gpg --list-keys 2>/dev/null
if [ `which xclip 2>/dev/null` ]; then echo"Clipboard: "`xclip -o -selection clipboard 2>/dev/null` echo"Highlighted text: "`xclip -o 2>/dev/null` elif [ `which xsel 2>/dev/null` ]; then echo"Clipboard: "`xsel -ob 2>/dev/null` echo"Highlighted text: "`xsel -o 2>/dev/null` elseecho"Not found xsel and xclip" fi
Enumerating Hostname
1
hostname
Enumerating System
1 2 3 4 5 6 7
uname -a cat /etc/issue cat /proc/version cat /etc/*-release (cat /proc/version || uname -a ) 2>/dev/null lsb_release -a 2>/dev/null # old, not by default on many systems cat /etc/os-release 2>/dev/null # universal on modern systems
find / '(' -type f -or -type d ')''(''(' -user $USER')' -or '(' -perm -o=w ')'')' 2>/dev/null | grep -v '/proc/' | grep -v $HOME | sort | uniq#Find files owned by the user or writable by anybody for g in `groups`; do find \( -type f -or -type d \) -group $g -perm -g=w 2>/dev/null | grep -v '/proc/' | grep -v $HOME; done#Find files writable by any group of the user
When privilege esclating via an SUID program to run /bin/bash, remember to use the -p flag. bash will drop all privileges unless -p is specified.
Open Shell Sessions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
screen -ls screen -dr <session> #The -d is to detach whoever is attached to it screen -dr 3350.foo #In the example of the image
tmux ls ps aux | grep tmux #Search for tmux consoles not using default folder for sockets tmux -S /tmp/dev_sess ls#List using that socket, you can start a tmux session in that socket with: tmux -S /tmp/dev_sess
tmux attach -t myname #If you write something in this session it will appears in the other opened one tmux attach -d -t myname #First detach the session from the other console and then access it yourself
ls -la /tmp/dev_sess #Check who can access it rw-rw---- 1 root devs 0 Sep 1 06:27 /tmp/dev_sess #In this case root and devs can # If you are root or devs you can access it tmux -S /tmp/dev_sess attach -t 0 #Attach using a non-default tmux socket