VB icon

Cloaker Script

Email
Submitted on: 8/13/2019 8:44:53 PM
By: Dave Vroman 
Level: Beginner
User Rating: Unrated
Compatibility: ASP (Active Server Pages)
Views: 662
 
     This routine converts a string of text to a string of unicode characters. So the string: "look@me.com"
Becomes:
UTF-8
"look@me.com"
"look@me.com"
Long UTF-8
"&#0000108&#0000111&#0000111&#0000107&#0000064&#0000109&#0000101&#0000046&#0000099&#0000111&#0000109"
"look@me.com"
UTF-8 Hex
"look@me.com"
"look@me.com"
This effectively masks the address so that it can't be scanned and it is still effective. The second line of each case is the same string as above not modified for display:
Note that it looks identical to the top string.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Cloaker Script
' Description:This routine converts a string of text to a string of unicode characters. So the string:
<small><b>"look@me.com"</b><br></small>
Becomes:<br>
UTF-8<br>
<small><b>"&#108;&#111;&#111;&#107;&#64;&#109;&#101;&#46;&#99;&#111;&#109;"</b></small><br>
<small><b>"look@me.com"</b></small><br>
Long UTF-8<br>
<small><b>"&#0000108&#0000111&#0000111&#0000107&#0000064&#0000109&#0000101&#0000046&#0000099&#0000111&#0000109"</b></small><br>
<small><b>"look@me.com"</b></small><br>
UTF-8 Hex <br>
<small><b>"&#x6C;&#x6F;&#x6F;&#x6B;&#x40;&#x6D;&#x65;&#x2E;&#x63;&#x6F;&#x6D;"</b></small><br>
<small><b>"look@me.com"</b></small><br>
This effectively masks the address so that it can't be scanned and it is still effective.
The second line of each case is the same string as above not modified for display:<br>
Note that it looks identical to the top string.
' By: Dave Vroman
'**************************************

<%@ Language=VBScript %>
<%
Function CloakIt(ByVal inTxt, ByVal iType)
' Convert An Input String To Unicode Character Codes
Dim iInd
Dim sOut
If Len(inTxt) = 0 Then
CloakIt = ""
Exit Function
End If
For iInd = 1 To Len(inTxt)
Select Case iType
Case 2
' Long UTF-8 encoding without semicolons
sOut = sOut & "&#" & Right("0000000" & CStr(Asc(Mid(inTxt, iInd, 1))), 7)
Case 3
' Hex encoding without semicolons
sOut = sOut & "&#x" & Hex(Asc(Mid(inTxt, iInd, 1)))
Case 4
' Hex encoding with semicolons
sOut = sOut & "&#x" & Hex(Asc(Mid(inTxt, iInd, 1))) & ";"
Case Else
' UTF-8 Unicode Encoding
sOut = sOut & "&#" & CStr(Asc(Mid(inTxt, iInd, 1))) & ";"
End Select
Next
CloakIt = sOut
End Function
%>
<html><head><title> Cloak-It
</title>
</head>
<body link=#000080 text=#000000 vLink=#008080 bgColor=#ffffff><font face="Tahoma,Arial,Helvetica,Verdana">
<h3 align=center>Cloak It - Email Address Cloaker</h3>
<form action="CloakIt.asp?entered=true" method=post id=form1 name=form1>
<table border=0 cellspacing=1 cellpadding=1>
<TR>
<td align=right width=25%>Plain String:</td>
<td><input type="text" size=100 id=plain name=plain value="<%= Request.Form("plain") %>"></td>
</TR>
<TR>
<td align=right><%
Select Case Request.Form("CloakType")
Case "2"
Response.Write "Long UTF-8 encoding:"
Case "3"
Response.Write "Hex encoding No "";"":"
Case "4"
Response.Write "Hex encoding With "";"":"
Case Else
Response.Write "UTF-8 Unicode Encoding:"
End Select
%></td>
<td><input type="text" id=cloaked name=cloaked size=100 value="<%= replace(CloakIt(Request.Form("plain"), Request.Form("cloaktype")),"&", "&amp;") %>"></td>
</tr>
<tr>
<td align=right>Displayed Encoded String 1:</td>
<td><%= CloakIt(Request.Form("plain"), Request.Form("CloakType")) %></td>
</tr>
<tr>
<td align=right>Displayed Encoded String 2:</td>
<td><input type="text" id=show name=show size=100 value="<%= CloakIt(Request.Form("plain"), Request.Form("CloakType")) %>"></td>
</tr>
<tr>
<td align=right valign=top>Cloaking Type:</td>
<td><input type=radio name="CloakType" value="1" <%If Request.Form("CloakType")="1" Then Response.Write " CHECKED"%>> UTF-8 Unicode Encoding<br>
<input type=radio name="CloakType" value="2" <%If Request.Form("CloakType")="2" Then Response.Write " CHECKED"%>> Long UTF-8 encoding without semicolons<br>
<input type=radio name="CloakType" value="3" <%If Request.Form("CloakType")="3" Then Response.Write " CHECKED"%>> Hex encoding without semicolons<br>
<input type=radio name="CloakType" value="4" <%If Request.Form("CloakType")="4" Then Response.Write " CHECKED"%>> Hex encoding with semicolons
</td>
</tr>
</TABLE>
<input type="submit" value="Submit" name=Submit> <input type="reset" value="Reset" id=reset1 name=reset1>
</form>
</font></body></html>


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.