From fbb5e453676d364cd86289145d8ce4e2f42f765f Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Fri, 22 Jul 2005 11:50:14 +0000 Subject: 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 --- Makefile | 6 ++++++ chapter01/changelog.xml | 7 +++++-- general.ent | 4 ++-- obfuscate.sh | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 obfuscate.sh diff --git a/Makefile b/Makefile index 625612e4d..6e35ef8c3 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,10 @@ lfs: cd $(BASEDIR)/; sed -i -e "s@../images@images@g" \ *.html + for filename in `find $(BASEDIR) -name "*.html"`; do \ + sh obfuscate.sh $$filename; \ + done; + for filename in `find $(BASEDIR) -name "*.html"`; do \ tidy -config tidy.conf $$filename; \ true; \ @@ -56,6 +60,8 @@ nochunks: --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \ stylesheets/lfs-nochunks.xsl index.xml + sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT) + tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true sed -i -e "s@text/html@application/xhtml+xml@g" \ diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 9650993bc..9f5e27d32 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -94,7 +94,7 @@ First a summary, then a detailed log. &perl-libc-patch; - + Removed: gcc-3.4.3-linkonce-1.patch @@ -107,6 +107,9 @@ First a summary, then a detailed log. +July 22th, 2005 [manuel]: Added obfuscate.sh and modified the +Makefile to obfuscate e-mail addresses in XHTML output. + July 19th, 2005 [matt]: Removed flex++ from the list of installed files, as it is no longer present (Randy McMurchy) July 15th, 2005 [matt]: Updated to Linux-2.6.12.3. @@ -601,7 +604,7 @@ should fix the TLS strip issue that's been seen, at least on X86December 22, 2004 [manuel]: Readded to chapter09/reboot.xml a para lost from version 5.1. -December 20, 2004 [manuel]: Made grub's configuration location +December 20, 2004 [manuel]: Made grub's configuration location FHS compliant. December 19, 2004 [manuel]: Added the irc.lfs-matrix.de IRC server. diff --git a/general.ent b/general.ent index 4a9e8722f..56f83ecd0 100644 --- a/general.ent +++ b/general.ent @@ -1,6 +1,6 @@ - - + + 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 +# Original Perl expression by Anderson Lizardo +# 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 -- cgit v1.2.3-54-g00ecf