Last active
December 1, 2017 00:32
-
-
Save karagenit/95107ac81ed3a5e20a13af8e6ce5cedf to your computer and use it in GitHub Desktop.
PHP Hardcoded Credential Cleaner
This file contains 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
#!/usr/bin/env bash | |
pword=$1 | |
shift | |
while [ $1 ] | |
do | |
# NOTE: Make sure to add .db-password to Git Ignore AND HT Access | |
sed -i -E "s/\"${pword}\"/file_get_contents\(\".db-password\"\)/" $1 | |
shift | |
done |
This file contains 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
main: install | |
install: | |
sudo cp ./clean-creds.sh /usr/bin/clean-creds | |
sudo chmod 777 /usr/bin/clean-creds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
git filter-branch --tree-filter 'script.sh PASSWORD FILES' HEAD
(typical usage for cleaning credentials out of entire commit history)