source: obfuscate.sh@ fbb5e45

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since fbb5e45 was fbb5e45, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

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

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#!/bin/bash
2
3# obfuscate.sh
4# obfuscate email addresses in XML/HTML
5# Script written (and slight perl modification) by Archaic <archaic AT linuxfromscratch D0T org>
6# Original Perl expression by Anderson Lizardo <lizardo AT linuxfromscratch D0T org>
7# Released under the GNU General Public License
8#
9# This script currently only seeks out mailto: addresses. If those same
10# addresses also appear in plaintext, we need to obfuscate those as well.
11#
12# This script was made for a very specific purpose so I was a bit lazy in
13# writing the regex's.
14#
15# Please send comments, enhancements, etc. to the above address
16
17#set -e # Bail on all errors
18
19# First, ensure that we are given a file to process
20# if [ $# -lt 1 ]; then
21# echo -e "\nYou must provide an input file."
22# exit 1
23# fi
24
25# Nothing like a backup plan!
26#cp "$1" "$1".bak
27
28for i in `grep -o '"mailto:.*@.*"' "$1" |sed -e 's|^"mailto:||' -e 's|"$||'`; do
29 link=`echo $i | perl -pe 's/[^\n]/"\\\&#".ord($&)."\;"/ge'`
30 plaintext=`echo $i | sed -e 's|@| AT |' -e 's|\.| D0T |g'`
31 sed -i "s|mailto:$i|mailto:$link|" "$1"
32 sed -i "s|$i|$plaintext|" "$1"
33done
34
35#exit 0
Note: See TracBrowser for help on using the repository browser.