clfs-1.2
clfs-2.1
clfs-3.0.0-systemd
clfs-3.0.0-sysvinit
systemd
sysvinit
Last change
on this file since 686a790 was 3f8be484, checked in by Jim Gifford <clfs@…>, 19 years ago |
r627@server (orig r625): jim | 2005-10-31 12:59:34 -0800
Import of Cross-LFS Book
|
-
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 |
|
---|
28 | for 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"
|
---|
33 | done
|
---|
34 |
|
---|
35 | #exit 0
|
---|
Note:
See
TracBrowser
for help on using the repository browser.