Created
September 29, 2011 19:32
-
-
Save mark-d-holmberg/1251692 to your computer and use it in GitHub Desktop.
How to purge passwords from files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#to find the offenders | |
find -name "*\.php" -print0 | xargs -0 grep -Rin "password" > results.txt | |
# to replace it with garbage | |
find . -name "*.php" -print0 | xargs -0 sed -i -e 's/FINDME/REPLACEWITHME/g' | |
# you can change '*.php' to the extension you want. | |
# remove the command from .bash_history | |
> ~/.bash_history | |
history -c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment