diff options
author | Manuel Canales Esparcia <manuel@linuxfromscratch.org> | 2005-07-22 11:50:14 +0000 |
---|---|---|
committer | Manuel Canales Esparcia <manuel@linuxfromscratch.org> | 2005-07-22 11:50:14 +0000 |
commit | fbb5e453676d364cd86289145d8ce4e2f42f765f (patch) | |
tree | 919b31360de615e1ef121ffab77ee3e123e95737 /obfuscate.sh | |
parent | 3a1ba46dd98c8113dde2b264d03226d8922e0209 (diff) |
Added obfuscate.sh to test it in production mode.
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@6568 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'obfuscate.sh')
-rw-r--r-- | obfuscate.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/obfuscate.sh b/obfuscate.sh new file mode 100644 index 000000000..0e9f8f8fe --- /dev/null +++ b/obfuscate.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# obfuscate.sh +# obfuscate email addresses in XML/HTML +# Script written (and slight perl modification) by Archaic <archaic AT linuxfromscratch D0T org> +# Original Perl expression by Anderson Lizardo <lizardo AT linuxfromscratch D0T org> +# Released under the GNU General Public License +# +# This script currently only seeks out mailto: addresses. If those same +# addresses also appear in plaintext, we need to obfuscate those as well. +# +# This script was made for a very specific purpose so I was a bit lazy in +# writing the regex's. +# +# Please send comments, enhancements, etc. to the above address + +#set -e # Bail on all errors + +# First, ensure that we are given a file to process +# if [ $# -lt 1 ]; then +# echo -e "\nYou must provide an input file." +# exit 1 +# fi + +# Nothing like a backup plan! +#cp "$1" "$1".bak + +for i in `grep -o '"mailto:.*@.*"' "$1" |sed -e 's|^"mailto:||' -e 's|"$||'`; do + link=`echo $i | perl -pe 's/[^\n]/"\\\&#".ord($&)."\;"/ge'` + plaintext=`echo $i | sed -e 's|@| AT |' -e 's|\.| D0T |g'` + sed -i "s|mailto:$i|mailto:$link|" "$1" + sed -i "s|$i|$plaintext|" "$1" +done + +#exit 0 |