r6772 - branches/cross-lfs/BOOK

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Mon Aug 29 11:52:26 PDT 2005


Author: manuel
Date: 2005-08-29 12:52:26 -0600 (Mon, 29 Aug 2005)
New Revision: 6772

Added:
   branches/cross-lfs/BOOK/obfuscate.sh
Modified:
   branches/cross-lfs/BOOK/Makefile
Log:
Added obfuscate.sh.

Modified: branches/cross-lfs/BOOK/Makefile
===================================================================
--- branches/cross-lfs/BOOK/Makefile	2005-08-29 18:11:45 UTC (rev 6771)
+++ branches/cross-lfs/BOOK/Makefile	2005-08-29 18:52:26 UTC (rev 6772)
@@ -82,8 +82,7 @@
 	@for filename in `find $(BASEDIR) -name "*.html"`; do \
 	  tidy -config tidy.conf $$filename; \
 	  true; \
-	done;
-	@for filename in `find $(BASEDIR) -name "*.html"`; do \
+	  sh obfuscate.sh $$filename; \
 	  sed -i -e "s at text/html at application/xhtml+xml at g" $$filename; \
 	done;
 

Added: branches/cross-lfs/BOOK/obfuscate.sh
===================================================================
--- branches/cross-lfs/BOOK/obfuscate.sh	2005-08-29 18:11:45 UTC (rev 6771)
+++ branches/cross-lfs/BOOK/obfuscate.sh	2005-08-29 18:52:26 UTC (rev 6772)
@@ -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


Property changes on: branches/cross-lfs/BOOK/obfuscate.sh
___________________________________________________________________
Name: svn:keywords
   + "Author Date Revision Id"




More information about the lfs-book mailing list