ASP Email Obfuscator

23.11.2003

Okuyucu : 10.548
Günlük Okuyucu : 6,4

Encode email addresses to make it harder for spammers to harvest them. Get more information from http://www.zapyon.de/spam-me-not/ Live Demonstaration - View Source

Kaynak Kodunu Download Edin (Download Source Code);

/opensource/source-code/obfuscate.txt

Kaynak Kod;

1 : <%
2 : '***********************************************************
3 : 'Copyright 2003 Ferruh Mavituna
4 : 'ASP Email Obfuscator v1.1
5 : 'http://ferruh.mavituna.com
6 : 'Encode email addresses to make it harder for spammers to harvest them.
7 : 'Inspired from http://www.zapyon.de/spam-me-not/
8 : '***********************************************************
9 : 'This program is free software; you can redistribute it and/or modify
10 : 'it under the terms of the GNU General Public License as published by
11 : 'the Free Software Foundation; either version 2 of the License, or
12 : '(at your option) any later version.
13 : '
14 : 'This program is distributed in the hope that it will be useful,
15 : 'but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : 'GNU General Public License for more details.
18 : '
19 : 'You should have received a copy of the GNU General Public License
20 : 'along with this program; if not, write to the Free Software
21 : 'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 : '***********************************************************
23 : 'Details : http://www.gnu.org/licenses/gpl.txt
24 : '***********************************************************

26 : '***********************************************************
27 : '// USAGE
28 : '***********************************************************
29 : '// [1] Add fm_str2Arr, fm_decode, fm_obfuscate function into your page or include.
30 : '// [2] Print fm_obfuscate
31 :     '// ARGUMENTS
32 :     '// @email : String
33 :     '// @method : Number (default=3)
34 :         '// 1 : Decimal
35 :         '// 2 : Hexadecimal
36 :         '// 3 : Random
37 :     '// @Optional Text : E-mail Text
38 : '// SAMPLE (see more in demonstrations -at the end of the code-)
39 : '// Response.Write fm_obfuscate("email@address.com",2,"Drop me a mail")
40 : '// OptText Encode Fixed
41 : '***********************************************************


44 : '******************************************************************
45 : '// Convert a String to Array by Ferruh Mavituna
46 : '******************************************************************
47 : Function fm_str2Arr(byVal Str, byRef Arr)
48 :     Dim i, StrLen
49 :     StrLen = Len(Str)-1
50 :     
51 :     Redim Arr(StrLen)

53 :     For i = 0 to StrLen
54 :         Arr(i)=Left(Str,1)
55 :         If Len(Str)>0 Then Str=Right(Str,Len(Str)-1)
56 :     Next
57 : End Function


60 : '******************************************************************
61 : '// Decode Characters by Ferruh Mavituna
62 : '******************************************************************
63 : Function fm_decode(byVal Char, byVal method)
64 :     '// Randomize
65 :     '***********************************
66 :     If method=3 Then
67 :         Randomize Timer
68 :         method = CInt(Rnd*1)+1
69 :     End If

71 :     '// Select Method
72 :     '***********************************
73 :     Select Case method
74 :         Case 1 '// Decimal Notation
75 :         '***********************************
76 :         fm_decode = Asc(Char)

78 :         Case 2 '// Hexadecimal Notation
79 :         '***********************************
80 :         fm_decode = "x" & Hex(Asc(Char))
81 :     End Select
82 : End Function


85 : Function fm_obfuscate(byVal email,byVal method, byval OptText)
86 :     Dim tmpStr, mailArr(), i, finalStr, mailtoArr(), tmpMailtoStr, OptStrArr()

88 :     '// Fix method
89 :     If NOT isNumeric(method) Then method = 3
90 :     If method>3 Then method = 3

92 :     '// Encode "mailto:"
93 :     fm_str2Arr "mailto:",mailtoArr
94 :     For i = 0 To Ubound(mailtoArr)
95 :         tmpMailtoStr = tmpMailtoStr & "&#" & fm_decode(mailtoArr(i),method) & ";"
96 :     Next    

98 :     '// Convert String to Array
99 :     '***********************************
100 :     fm_str2Arr email,mailArr
101 :     
102 :     '// Generate Text
103 :     '***********************************
104 :     For i = 0 To Ubound(mailArr)
105 :         finalStr = finalStr & "&#" & fm_decode(mailArr(i),method) & ";"
106 :     Next

108 :     '// Fix OptionText
109 :     '***********************************
110 :     If OptText="" Then
111 :         OptText = finalStr
112 :     Else
113 :         fm_str2Arr OptText,OptStrArr
114 :             '// Generate Text
115 :             '***********************************
116 :             OptText=""
117 :             For i = 0 To Ubound(mailArr)
118 :                 OptText = OptText & "&#" & fm_decode(mailArr(i),method) & ";"
119 :             Next
120 :     End If
121 :         finalStr = tmpMailtoStr & finalStr

123 :     '// Return
124 :     '***********************************
125 :     fm_obfuscate = "<a href=""" & finalStr & """>" & OptText & "</a><br />"
126 : End Function

128 : '***********************************
129 : '***********************************
130 : '// Demonstrations
131 : '***********************************
132 : '***********************************
133 :     Response.Write "by <a href=""http://ferruh.mavituna.com"">Ferruh Mavituna</a> | <a href=""http://ferruh.mavituna.com/opensource/obfuscate/obfuscate.txt"">Download Source Code</a><p>"
134 :     '// Decimal
135 :     '***********************************
136 :     Response.Write "<h1>Decimal</h1>"
137 :     Response.Write fm_obfuscate("whoooo@yupyupgup.com",1,"")

139 :     '// Decimal with Text
140 :     '***********************************
141 :     Response.Write "<h1>Decimal with Text</h1>"
142 :     Response.Write fm_obfuscate("whoooo@yupyupgup.com",1,"Drop me a mail")

144 :     '// Hexadecimal
145 :     '***********************************
146 :     Response.Write "<h1>Hexadecimal</h1>"
147 :     Response.Write fm_obfuscate("whoooo@yupyupgup.com",2,"")

149 :     '// Hexadecimal with Text
150 :     '***********************************
151 :     Response.Write "<h1>Hexadecimal with Text</h1>"
152 :     Response.Write fm_obfuscate("whoooo@yupyupgup.com",2,"Drop me a mail")

154 :     '// Random
155 :     '***********************************
156 :     Response.Write "<h1>Random</h1>"
157 :     Response.Write fm_obfuscate("whoooo@yupyupgup.com",3,"")

159 :     '// Random with Text
160 :     '***********************************
161 :     Response.Write "<h1>Random with Text</h1>"
162 :     Response.Write fm_obfuscate("whoooo@yupyupgup.com",5,"Drop me a mail")

164 :     '// See Real Results
165 :     '***********************************
166 :     'Response.Write Server.HTMLEncode(fm_obfuscate("whoooo@yupyupgup.com",1,""))
167 :     'Response.Write Server.HTMLEncode(fm_obfuscate("whoooo@yupyupgup.com",1,"Drop me a mail"))
168 :     'Response.Write Server.HTMLEncode(fm_obfuscate("whoooo@yupyupgup.com",2,""))
169 :     'Response.Write Server.HTMLEncode(fm_obfuscate("whoooo@yupyupgup.com",2,"Drop me a mail"))
170 :     'Response.Write Server.HTMLEncode(fm_obfuscate("whoooo@yupyupgup.com",3,""))
171 :     'Response.Write Server.HTMLEncode(fm_obfuscate("whoooo@yupyupgup.com",3,"Drop me a mail"))
172 : %>
Source Script is modified version of HiLiter

Yorumlar

RSS Bu makalenin yorumlarını RSS ile takip et!

ne işe yarar bu ? :)

ingilizce bilmiyorumda :)

[ # | 18.12.2003 ]

Özel bir encode yöntemi ile email adreslerinin spamciler tarafından ele geçirilmesini engeller. http://www.fazlamesai.net/modules.php?name=News&file=article&sid=1793 adresinde de türkçe bilgi mevcut.

Ferruh Mavituna [ # | 18.12.2003 ]

Çok güzel. Elinize sağlık.

Onur Koncaoğlu [ # | 05.06.2004 ]


<%
Function EncryptMail(sMail)

Dim sEncryptedMail,i

For i = 0 to len(sMail) - 1
sEncryptedMail = sEncryptedMail + chr ( asc ( mid(sMail,i + 1,1) ) - 1 )
Next

EncryptMail = sEncryptedMail

End Function
%>

Fakat bu ifadeyi sadece örümcek değil ziyaretçinin browser ı ve tabiiki kullanıcılarda anlamayacaklardır. O halde browser ve kullanıcılar için bir javascript kullanarak bu ifadeyi aslına çevirecek bir decoder yazalım :

<script>
function myMailSender(s){
var s2 = '';
for(var i = 0; i < s.length; i++){
s2 += String.fromCharCode(s.charCodeAt(i) + 1 );
}

document.location.href="mailto:" + s2;
}
</script>

Ceyhun AKSAN [ # | 20.04.2005 ]

Yanlış bunu her popüler browser anlayabiliyor, tabii ki teoride yazılan iyi bir spider' da bunu anlayabilecektir, ve doğrudur da.

Ferruh Mavituna [ # | 20.04.2005 ]

örnek bi result görebilirmiyim :S

Tontonq Abi [ # | 20.08.2006 ]

bende gerçekten güzel bişiy sanmıştım wbb ni memberslist.php si de böleydi aştım ogame forumunun maillistini topladım

örnek :

// decimal decode chalintidir
function unhtmlentities($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}


$cicidata = unhtmlentities($data);


if($mail_sayisi = preg_match_all("'[a-z\d\.]+([@])+([a-z\d\.]+[a-z\d\.]+)'",$cicidata, $mail_adresleri))
{

for( $i=0 ; $i<=$mail_sayisi ; $i++ )



Töbe töbe :D ulu orta yaymamak gerek ya nese

Tontonq Abi [ # | 20.08.2006 ]

Yorum Ekle





Kullanılabilir Taglar : [<blockquote>] [<strong>] [<em>]

Diğer Yazılar

Neredeyim ?

Ferruh.Mavituna » Kod Parçaları (Code Snippets) » ASP Email Obfuscator

Ferruh Mavituna
© 2002-2007, Ferruh Mavituna

Sabit IP Adresi : 81.22.99.133, SSL Erişimi, Hakkında