Disclaimer: This material is provided solely for educational purposes.
You are fully responsible for how
you use the information.
We
do not encourage any kind of illegal or harmful activity.
- search for files that contain the string “passw” and “pwd” across the entire filesystem
grep --color=auto -rnw '/' -iIe "PASS\|PASSW\|PASSWD\|PASSWORD\|PWD" --color=always 2>/dev/null
- navigate to common folders where we normally find interesting files, such as /var/www, /tmp, /opt, /home.
grep --color=auto -rnw -iIe "PASSW\|PASSWD\|PASSWORD\|PWD" --color=always 2>/dev/null
- search for configuration files
for l in $(echo ".conf .config .cnf"); do echo -e "\nFile extension: $l"; find / -name *$l 2>/dev/null | grep -v "lib\|fonts\|share\|core"; done
- extract credentials from configuration files
for i in $(find / -name *.cnf 2>/dev/null | grep -v "doc\|lib"); do echo -e "\nFile: $i"; grep "user\|password\|pass" $i 2>/dev/null | grep -v "\#"; done
- Searches for all files that end with _history
find / -name *_history -xdev 2> /dev/null
- search for database files
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
- search for common file types used with scripts.
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
-
search for various document file types, excluding certain directories
for ext in $(echo ".xls .xls* .xltx .csv .od* .doc .doc* .pdf .pot .pot* .pp*"); do echo -e "\nFile extension: $ext"; find / -name *$ext 2>/dev/null | grep -v "lib\|fonts\|share\|core"; done
-
search logs for sensitive data
for i in $(ls /var/log/* 2>/dev/null); do GREP=$(grep "accepted\|session opened\|session closed\|failure\|failed\|ssh\|password changed\|new user\|delete user\|sudo\|COMMAND\=\|logs" $i 2>/dev/null); if [[ $GREP ]]; then echo -e "\n#### Log file: $i"; grep "accepted\|session opened\|session closed\|failure\|failed\|ssh\|password changed\|new user\|delete user\|sudo\|COMMAND\=\|logs" $i 2>/dev/null; fi; done
-
credentials stored in memory
strings /dev/mem -n10 | grep -ie "PASSWORD\|PASSWD" --color=always
-
search for notes that may contain credentials.
find /home/* \( -type f -name "*.txt" -o -type f ! -name "*.*" \)
-
search for the string "password=" in all files (case-insensitive)
grep --color=auto -rnw '/' -ie "PASSWORD=" --color=always 2>/dev/null
-
scripts often contain hardcoded credentials.
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
-
Search the filesystem for files named authorized_keys:
find / -name authorized_keys 2> /dev/null
-
search the filesystem for key terms PRIVATE KEY to discover SSH keys
grep -rnw "PRIVATE KEY" /* 2>/dev/null | grep ":1"
-
search for the keywords PRIVATE KEY within files contained in a user's home directory.
grep -rnw "PRIVATE KEY" /home/* 2>/dev/null | grep ":1"