Эх сурвалжийг харах

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
Manuel Canales Esparcia 20 жил өмнө
parent
commit
fbb5e45367
4 өөрчлөгдсөн 48 нэмэгдсэн , 4 устгасан
  1. 6 0
      Makefile
  2. 5 2
      chapter01/changelog.xml
  3. 2 2
      general.ent
  4. 35 0
      obfuscate.sh

+ 6 - 0
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"  \

+ 5 - 2
chapter01/changelog.xml

@@ -94,7 +94,7 @@ First a summary, then a detailed log.</para>
 <listitem><para>&perl-libc-patch;</para></listitem>
 </itemizedlist>
 </listitem>
- 
+
 <listitem><para>Removed:</para>
 <itemizedlist>
 <listitem><para>gcc-3.4.3-linkonce-1.patch</para></listitem>
@@ -107,6 +107,9 @@ First a summary, then a detailed log.</para>
 </itemizedlist>
 </listitem>
 
+<listitem><para>July  22th, 2005 [manuel]: Added obfuscate.sh and modified the
+Makefile to obfuscate e-mail addresses in XHTML output.</para></listitem>
+
 <listitem><para>July  19th, 2005 [matt]: Removed flex++ from the list of installed files, as it is no longer present (Randy McMurchy)</para></listitem>
 
 <listitem><para>July  15th, 2005 [matt]: Updated to Linux-2.6.12.3.</para></listitem>
@@ -601,7 +604,7 @@ should fix the TLS strip issue that's been seen, at least on X86</para></listite
 <listitem><para>December 22, 2004 [manuel]: Readded to chapter09/reboot.xml a para lost
 from version 5.1.</para></listitem>
 
-<listitem><para>December 20, 2004 [manuel]: Made grub's configuration location 
+<listitem><para>December 20, 2004 [manuel]: Made grub's configuration location
 FHS compliant.</para></listitem>
 
 <listitem><para>December 19, 2004 [manuel]: Added the irc.lfs-matrix.de IRC server.</para></listitem>

+ 2 - 2
general.ent

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!ENTITY version "SVN-20050721">
-<!ENTITY releasedate "July 21, 2005">
+<!ENTITY version "SVN-20050722">
+<!ENTITY releasedate "July 22, 2005">
 <!ENTITY milestone "6.2">
 <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->
 

+ 35 - 0
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