Skip to content

Instantly share code, notes, and snippets.

@karagenit
Last active December 1, 2017 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karagenit/95107ac81ed3a5e20a13af8e6ce5cedf to your computer and use it in GitHub Desktop.
Save karagenit/95107ac81ed3a5e20a13af8e6ce5cedf to your computer and use it in GitHub Desktop.
PHP Hardcoded Credential Cleaner
#!/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
main: install
install:
sudo cp ./clean-creds.sh /usr/bin/clean-creds
sudo chmod 777 /usr/bin/clean-creds
@karagenit
Copy link
Author

git filter-branch --tree-filter 'script.sh PASSWORD FILES' HEAD

(typical usage for cleaning credentials out of entire commit history)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment