Obfuscating VBScript Code

This page shows VBScript obfuscation done with the VBScript Formatter using the optional Obfuscation capability. It contains VBScript sample code, its obfuscated version, and the generated obfuscation map of names to mangled names.

VBScript Sample Code before Obfuscation

The obfuscator can obfuscate plain VBScript source files, or ASP script files containing VBScript. This is actually an ASP script taken from an freely downloadable bulletin board program. The source is about 500 lines long; click to see obfuscated version.


<!--#INCLUDE FILE="BBSAuth.inc"-->
<HTML>
<HEAD>

<!--#INCLUDE FILE="BBSRoutines.inc"-->
<!--#INCLUDE FILE="CommonRoutines.inc"-->
<!--#INCLUDE FILE="dbConnect_BBS.inc"-->
<!--#INCLUDE FILE="CheckSecurity.inc"-->
<title><%= sec_Topics("Topic Title") & " Topic File Manager" %></title>
<!--#INCLUDE FILE="header.inc"-->
</HEAD>
<BODY>
<center><h2><%= sec_Topics.Fields("Topic Title") %> - File Manager</h2>
<center>
<a href="BBSAdmin.asp?TopicID=<%= TopicID %>">Topic Admin</a>
</center>
<%
on error goto 0
'-- --------------------------- --
'-- Determine directory to view --
'-- --------------------------- --
TopicPath = AppFilePath() & "\Uploads\" & TopicID

If Not IsEmpty(Request.Form("FileDirectory")) Then
    FileDirectory = Request.Form("FileDirectory")
ElseIf Not IsEmpty(Request.QueryString("FileDirectory")) Then
    FileDirectory = Request.QueryString("FileDirectory")
Else
    FileDirectory = ""
End If
FileDirectory = Replace(FileDirectory,".","")	'- Hacker prevention

'-- ------------- --
'-- File Clean-Up --
'-- ------------- --
If Request.Form("B1") = "Delete" Then
    Set WorkFileObject = server.createobject("Scripting.FileSystemObject")
    For Each key in Request.Form
        If UCase(Left(key,6)) = "DELETE" Then
            Response.Write "Deleting " & Replace(FileDirectory,"\","/") & "/" & Request.Form(Key) & "<br>"
            On Error Resume Next
            WorkFileObject.DeleteFile(TopicPath & FileDirectory & "\" & Request.Form(Key))
            On Error GoTo 0
        End If
    Next
    Set WorkFileObject = Nothing
End If

If Not IsEmpty(Request.QueryString("MPageNo")) Then
    MPageNo = Request.QueryString("MPageNo")
ElseIf Not IsEmpty(Request.Form("MPageNo")) Then
    MPageNo = Request.Form("MPageNo")
Else
    MPageNo = 1
End If
If Not IsEmpty(Request.QueryString("MJumpTo")) Then
    MJumpTo = Request.QueryString("MJumpTo")
ElseIf Not IsEmpty(Request.Form("MJumpTo")) Then
    MJumpTo = Request.Form("MJumpTo")
Else
    MJumpTo = ""
End If
MResults = 15

'-- ------------------------------------------------- --
'-- Look at directory and decide what page you are on --
'-- Also populate the index                           --
'-- ------------------------------------------------- --
Dim Index1(101)
Dim Index2(101)
Dim Index3(101)
Dim IndexW(101)
For ICtr = 1 To 101
    Index1(ICtr) = ""
    Index2(ICtr) = ""
    Index3(ICtr) = ""
    IndexW(ICtr) = ""
Next
'response.write "c-" & now() & "<br>"

Dim FileList(15)
Dim FileType(15)
Dim FileSize(15)
For ICtr = 1 To 15
    FileList(ICtr) = ""
    FileType(ICtr) = ""
    FileSize(ICtr) = 0
Next

'response.write "d-" & now() & "<br>"

RecNo = 0
ICtr = 1
IndexCtr1 = 0
IndexCtr2 = 0
IndexCtr3 = 0
MorePages = "No"

Set WorkFileObject = server.createobject("Scripting.FileSystemObject")
Set WorkFileFolder = WorkFileObject.GetFolder(TopicPath & "\" & FileDirectory)

Set WorkFolderList = WorkFileFolder.SubFolders
Set WorkFileList = WorkFileFolder.Files

For Each WrkFileName In WorkFolderList
    If Left(WrkFileName.Name,1) <> "_" Then
        '-- ------------------------------- --
        '-- Populate the index with folders --
        '-- ------------------------------- --
        If Left(UCase(WrkFileName.Name),1) <> Index1(IndexCtr1) Then
            FoundIt = "No"
            For WCtr = 1 To IndexCtr1
                If Left(UCase(WrkFileName.Name),1) = Index1(WCtr) Then
                    FoundIt = "Yes"
                End If
            Next
            If FoundIt = "No" And IndexCtr1 <= 100 Then
                IndexCtr1 = IndexCtr1 + 1
                Index1(IndexCtr1) = Left(UCase(WrkFileName.Name),1)
            End If
        End If

        If Len(MJumpTo) > 0 Then
           If Left(MJumpTo,1) = Left(UCase(WrkFileName.Name),1) And _
               Left(UCase(WrkFileName.Name),2) <> Index2(IndexCtr2) Then
                FoundIt = "No"
                For WCtr = 1 To IndexCtr2
                    If Left(UCase(WrkFileName.Name),2) = Index2(WCtr) Then
                        FoundIt = "Yes"
                    End If
                Next
                If FoundIt = "No" And IndexCtr2 <= 100 Then
                    IndexCtr2 = IndexCtr2 + 1
                    Index2(IndexCtr2) = Left(UCase(WrkFileName.Name),2)
                End If
            End If
        End If
        If Len(MJumpTo) > 1 Then
            If Left(MJumpTo,2) = Left(UCase(WrkFileName.Name),2) And _
                Left(UCase(WrkFileName.Name),3) <> Index3(IndexCtr3) Then
                FoundIt = "No"
                For WCtr = 1 To IndexCtr3
                    If Left(UCase(WrkFileName.Name),3) = Index3(WCtr) Then
                        FoundIt = "Yes"
                    End If
                Next
                If FoundIt = "No" And IndexCtr3 <= 100 Then
                    IndexCtr3 = IndexCtr3 + 1
                    Index3(IndexCtr3) = Left(UCase(WrkFileName.Name),3)
                End If
            End If
        End If
        '-- ----------------- --
        '-- Populate the page --
        '-- ----------------- --
        If MJumpTo <> "" And Left(UCase(WrkFileName.Name),Len(MJumpTo)) <> MJumpTo Then
            '-- Ignore This one
        ElseIf RecNo < (MPageNo - 1) * MResults Then
            '-- Ignore This one
            RecNo = RecNo + 1
        ElseIf RecNo >= (MPageNo * MResults) Then
            '-- Ignore This one
            RecNo = RecNo + 1
            MorePages = "Yes"
        ElseIf RecNo < (MPageNo * MResults) Then
            FileList(ICtr) = WrkFileName.Name
            FileType(ICtr) = "Folder"
            FileSize(ICtr) = WrkFileName.Size
            ICtr = ICtr + 1
            RecNo = RecNo + 1
        End If
    End If
Next

'-- ----------------------------------------- --
'-- Populate the file list in sub-directories --
'-- ----------------------------------------- --
If FileDirectory <> "" Then
    For Each WrkFileName In WorkFileList
        '-- ----------------------------- --
        '-- Populate the index with files --
        '-- ----------------------------- --
        If Left(UCase(WrkFileName.Name),1) <> Index1(IndexCtr1) Then
            FoundIt = "No"
            For WCtr = 1 To IndexCtr1
                If Left(UCase(WrkFileName.Name),1) = Index1(WCtr) Then
                    FoundIt = "Yes"
                End If
            Next
            If FoundIt = "No" And IndexCtr1 <= 100 Then
                IndexCtr1 = IndexCtr1 + 1
                Index1(IndexCtr1) = Left(UCase(WrkFileName.Name),1)
            End If
        End If

        If Len(MJumpTo) > 0 Then
           If Left(MJumpTo,1) = Left(UCase(WrkFileName.Name),1) And _
               Left(UCase(WrkFileName.Name),2) <> Index2(IndexCtr2) Then
                FoundIt = "No"
                For WCtr = 1 To IndexCtr2
                    If Left(UCase(WrkFileName.Name),2) = Index2(WCtr) Then
                        FoundIt = "Yes"
                    End If
                Next
                If FoundIt = "No" And IndexCtr2 <= 100 Then
                    IndexCtr2 = IndexCtr2 + 1
                    Index2(IndexCtr2) = Left(UCase(WrkFileName.Name),2)
                End If
            End If
        End If
        If Len(MJumpTo) > 1 Then
            If Left(MJumpTo,2) = Left(UCase(WrkFileName.Name),2) And _
                Left(UCase(WrkFileName.Name),3) <> Index3(IndexCtr3) Then
                FoundIt = "No"
                For WCtr = 1 To IndexCtr3
                    If Left(UCase(WrkFileName.Name),3) = Index3(WCtr) Then
                        FoundIt = "Yes"
                    End If
                Next
                If FoundIt = "No" And IndexCtr3 <= 100 Then
                    IndexCtr3 = IndexCtr3 + 1
                    Index3(IndexCtr3) = Left(UCase(WrkFileName.Name),3)
                End If
            End If
        End If
        '-- ----------------- --
        '-- Populate the page --
        '-- ----------------- --
        If MJumpTo <> "" And Left(UCase(WrkFileName.Name),Len(MJumpTo)) <> MJumpTo Then
            '-- Ignore This one
        ElseIf RecNo < (MPageNo - 1) * MResults Then
            '-- Ignore This one
            RecNo = RecNo + 1
        ElseIf RecNo >= (MPageNo * MResults) Then
            '-- Ignore This one
            RecNo = RecNo + 1
            MorePages = "Yes"
        ElseIf RecNo < (MPageNo * MResults) Then
            FileList(ICtr) = WrkFileName.Name
            FileType(ICtr) = "File"
            FileSize(ICtr) = WrkFileName.Size
            ICtr = ICtr + 1
            RecNo = RecNo + 1
        End If
    Next
End If
Set WorkFileList = Nothing
Set WorkFolderList = Nothing
Set WorkFileFolder = Nothing
Set WorkFileObject = Nothing
'response.write "e-" & now() & "<br>"

'-- ----------------------- --
'-- Sort the jumpto indexes --
'-- ----------------------- --
MDone = "No"
WCtr = 1
IndexW(1) = CHR(255)
Do While MDone = "No"
    ICtr = 1
    HCtr = 1
    MDone = "Yes"
    Do While Index1(ICtr) <> ""
        If Index1(ICtr) < IndexW(WCtr) And _
           Index1(ICtr) <= Index1(HCtr) Then
            HCtr = ICtr
            MDone = "No"
        End If
        ICtr = ICtr + 1
    Loop
    If Index1(HCtr) <> CHR(255) Then
        IndexW(WCtr) = Index1(HCtr)
        Index1(HCtr) = CHR(255)
        WCtr = WCtr + 1
        IndexW(WCtr) = Chr(255)
    End If
Loop

For ICtr = 1 To 100
    If IndexW(ICtr) = CHR(255) Then
        Index1(Ictr) = ""
    Else
        Index1(ICtr) = IndexW(ICtr)
    End If
    IndexW(ICtr) = ""
Next

MDone = "No"
WCtr = 1
IndexW(1) = CHR(255)
Do While MDone = "No"
    ICtr = 1
    HCtr = 1
    MDone = "Yes"
    Do While Index2(ICtr) <> ""
        If Index2(ICtr) < IndexW(WCtr) And _
           Index2(ICtr) <= Index2(HCtr) Then
            HCtr = ICtr
            MDone = "No"
        End If
        ICtr = ICtr + 1
    Loop
    If Index2(HCtr) <> CHR(255) Then
        IndexW(WCtr) = Index2(HCtr)
        Index2(HCtr) = CHR(255)
        WCtr = WCtr + 1
       IndexW(WCtr) = Chr(255)
    End If
Loop

For ICtr = 1 To 100
    If IndexW(ICtr) = CHR(255) Then
        Index2(Ictr) = ""
    Else
        Index2(ICtr) = IndexW(ICtr)
    End If
    IndexW(ICtr) = ""
Next

MDone = "No"
WCtr = 1
IndexW(1) = CHR(255)
Do While MDone = "No"
    ICtr = 1
    HCtr = 1
    MDone = "Yes"
    Do While Index3(ICtr) <> ""
        If Index3(ICtr) < IndexW(WCtr) And _
           Index3(ICtr) <= Index3(HCtr) Then
            HCtr = ICtr
            MDone = "No"
        End If
        ICtr = ICtr + 1
    Loop
    If Index3(HCtr) <> CHR(255) Then
        IndexW(WCtr) = Index3(HCtr)
        Index3(HCtr) = CHR(255)
        WCtr = WCtr + 1
        IndexW(WCtr) = Chr(255)
    End If
Loop

For ICtr = 1 To 100
    If IndexW(ICtr) = CHR(255) Then
        Index3(Ictr) = ""
    Else
        Index3(ICtr) = IndexW(ICtr)
    End If
    IndexW(ICtr) = ""
Next
'response.write "f-" & now() & "<br>"

'-- ----------------- --
'-- Print the indexes --
'-- ----------------- --
Response.Write "<center>"
ICtr = 1
Do While Index3(ICtr) <> ""
    Response.Write "<a href='" & ShortScriptName & ".asp?TopicID=" & TopicID
    Response.Write "&MJumpTo=" & Index3(ICtr) & _
                   "&FileDirectory=" & Server.URLEncode(FileDirectory) & "'>"
    Response.Write Index3(ICtr)
    Response.Write "</a> " & vbNewLine
    ICtr = ICtr + 1
Loop
If Index3(1) <> "" Then
    Response.Write "<hr>"
End If

ICtr = 1
Do While Index2(ICtr) <> ""
    Response.Write "<a href='" & ShortScriptName & ".asp?TopicID=" & TopicID
    Response.Write "&MJumpTo=" & Index2(ICtr) & _
                   "&FileDirectory=" & Server.URLEncode(FileDirectory) & "'>"
    Response.Write Index2(ICtr)
    Response.Write "</a> " & vbNewLine
    ICtr = ICtr + 1
Loop
If Index2(1) <> "" Then
    Response.Write "<hr>"
End If

ICtr = 1
Do While Index1(ICtr) <> ""
    Response.Write "<a href='" & ShortScriptName & ".asp?TopicID=" & TopicID
    Response.Write "&MJumpTo=" & Index1(ICtr) & _
                   "&FileDirectory=" & Server.URLEncode(FileDirectory) & "'>"
    Response.Write Index1(ICtr)
    Response.Write "</a> " & vbNewLine
    ICtr = ICtr + 1
Loop
Response.Write "<a href='" & ShortScriptName & ".asp?TopicID=" & TopicID & _
               "&FileDirectory=" & Server.URLEncode(FileDirectory) & "'>All</a> " & vbNewLine
Response.Write "</center>"
'response.write "g-" & now() & "<br>"

'response.write "h-" & now() & "<br>"
Randomize
'-- ------------------------------- --
'-- Show the current page of images --
'-- ------------------------------- --
Response.Write "<center>"
Response.Write "<form action='" & ShortScriptName & ".asp' method='POST'>" & vbNewLine
Response.Write "<input type='hidden' name='TopicID'       value='" & TopicID  & "'>" & vbNewLine
Response.Write "<input type='hidden' name='MPageNo'       value='" & MPageNo  & "'>" & vbNewLine
Response.Write "<input type='hidden' name='MResults'      value='" & MResults & "'>" & vbNewLine
Response.Write "<input type='hidden' name='MJumpTo'       value='" & MemoView(MJumpTo) & "'>" & vbNewLine
Response.Write "<input type='hidden' name='FileDirectory' value='" & MemoView(FileDirectory) & "'>" & vbNewLine
Response.Write "<table border='1'>" & vbNewLine
Response.Write "<tr>" & vbNewLine
Response.Write "   <td colspan='3' align='center' bgcolor='#C0C0C0' style='font-weight: bold; font-size: larger'>" & Replace(FileDirectory,"/","\") & "<br>Files</td>" & vbNewLine
Response.Write "</tr>" & vbNewLine
Response.Write "<tr>" & vbNewLine
Response.Write "  <td align='left' valign='top' bgcolor='#C0C0C0'>File Name</td>" & vbNewLine
Response.Write "  <td align='right' valign='top' bgcolor='#C0C0C0'>Size</td>" & vbNewLine
Response.Write "  <td align='center' valign='top' bgcolor='#C0C0C0'>Delete</td>" & vbNewLine
Response.Write "</tr>" & vbNewLine
If FileDirectory <> "" Then
    '-- ----------------- --
    '-- Back up to parent --
    '-- ----------------- --
    Response.Write "<tr>" & vbNewLine
    Response.Write "<td align='left'  valign='top'>"
    Response.Write "<a href='" & ShortScriptName & ".asp?TopicID=" & TopicID
    Response.Write "&FileDirectory=" & Server.URLEncode(Left(FileDirectory,InStrRev(FileDirectory,"\")-1)) & "'>"
    Response.Write "Up To " & Replace(Left(FileDirectory,InStrRev(FileDirectory,"\")-1),"\","/") & "/</a>" & vbNewLine
    Response.Write "</td>" & vbNewLine
    Response.Write "<td align='center' valign='top'> </td>" & vbNewLine
    Response.Write "<td align='center' valign='top'> </td>" & vbNewLine
    Response.Write "</tr>" & vbNewLine
End If
For PCtr = 1 To 15
    If FileList(PCtr) <> "" Then
        Response.Write "<tr>" & vbNewLine
        Response.Write "<td align='left'  valign='top'>"
        If FileType(PCtr) = "Folder" Then
            Response.Write "<a href='" & ShortScriptName & ".asp?TopicID=" & TopicID
            Response.Write "&FileDirectory=" & Server.URLEncode(FileDirectory & "\" & FileList(PCtr)) & "'>"
            Response.Write "Go To /" & FileList(PCtr) & "</a>" & vbNewLine
        Else
            Response.Write "<a href='Uploads/" & TopicID & MemoView(Replace(FileDirectory,"\","/")) & "/"
            Response.Write MemoView(FileList(PCtr)) & "' target='New" & NumberToString(Rnd() * 1000,4,0) & "'>"
            Response.Write FileList(PCtr) & "</a>" & vbNewLine
        End If
        Response.Write "</td>" & vbNewLine
        Response.Write "<td align='right' valign='top'>" & NumberToString(FileSize(PCtr)/1024,"Float",2) & " k</td>" & vbNewLine
        Response.Write "<td align='center' valign='top'>" & vbNewLine
'response.write "i-" & now() & "<br>"

        If FileType(PCtr) = "Folder" Then
            Response.Write " "
        Else
            Response.Write "<input type='Checkbox' name='Delete" & NumberToString(PCtr,4,0) & "'  value='" & MemoView(FileList(PCtr)) & "'>" & vbNewLine
        End If
        Response.Write "</td>" & vbNewLine
        Response.Write "</tr>" & vbNewLine
    End If
Next
Response.Write "</table>" & vbNewLine
Response.Write "<input type='submit' name='B1' value='Delete' ONCLICK=" & CHR(34) & "return Confirm_Delete()" & CHR(34) & ">" & vbNewLine
Response.Write "</form>" & vbNewLine
'response.write "j-" & now() & "<br>"

'-- --------------------------- --
'-- Now show the paging buttons --
'-- --------------------------- --
Response.Write "<center><br>" & vbNewLine
Response.Write "<table cellspacing='0' border='0' width='100%'>" & vbNewLine
Response.Write "    <tr>" & vbNewLine
If MPageNo > 1 Then
    Response.Write "<td valign='top' align='center'>" & vbNewLine
    Response.Write "<form method='POST' action='" & ShortScriptName & ".asp'>" & vbNewLine
    Response.Write "<input type='hidden' name='TopicID'       value='" & TopicID & "'>" & vbNewLine
    Response.Write "<input type='hidden' name='MResults'      value='" & MResults & "'>" & vbNewLine
    Response.Write "<input type='hidden' name='MPageNo'       value='" & MPageNo - 1 & "'>" & vbNewLine
    Response.Write "<input type='hidden' name='MJumpTo'       value='" & MemoView(MJumpTo) & "'>" & vbNewLine
    Response.Write "<input type='hidden' name='FileDirectory' value='" & MemoView(FileDirectory) & "'>" & vbNewLine
    Response.Write "<input type='submit' name='B3'            value='Previous Page'>" & vbNewLine
    Response.Write "</form>" & vbNewLine
    Response.Write "</td>" & vbNewLine
End If
If MorePages = "Yes" Then
    Response.Write "<td valign='top' align='center'>" & vbNewLine
    Response.Write "<form method='POST' action='" & ShortScriptName & ".asp'>" & vbNewLine
    Response.Write "<input type='hidden' name='TopicID'       value='" & TopicID & "'>" & vbNewLine
    Response.Write "<input type='hidden' name='MResults'      value='" & MResults & "'>" & vbNewLine
    Response.Write "<input type='hidden' name='MPageNo'       value='" & MPageNo + 1 & "'>" & vbNewLine
    Response.Write "<input type='hidden' name='MJumpTo'       value='" & MemoView(MJumpTo) & "'>" & vbNewLine
    Response.Write "<input type='hidden' name='FileDirectory' value='" & MemoView(FileDirectory) & "'>" & vbNewLine
    Response.Write "<input type='submit' name='B3'            value='Next Page'>" & vbNewLine
    Response.Write "</form>" & vbNewLine
    Response.Write "</td>" & vbNewLine
End If
Response.Write "</tr>" & vbNewLine
Response.Write "</table>" & vbNewLine

Response.Write "</center>"
'response.write "k-" & now() & "<br>"

Call SecurityClose()

BBS_Conn.Close
Set BBS_Conn     = Nothing
 %>
<!--#INCLUDE FILE="footer.inc"-->
</body>
</html>

VBScript Code after Obfuscation

This is the actual obfuscated VBScript code. It was obfuscated reserving names required for external API access. Compared to the orginal, notice that VBScript comments are gone, names have been scrambled, standard constants are replaced by their value, and literal constants have had their radix twiddled. The obfuscator uses a special list provided by the user to define names that should be preserved, ensuring that public interfaces and accesses to public libraries remain valid (e.g,. "document", "write").


<!--#INCLUDE FILE="BBSAuth.inc"-->
<HTML>
<HEAD>

<!--#INCLUDE FILE="BBSRoutines.inc"-->
<!--#INCLUDE FILE="CommonRoutines.inc"-->
<!--#INCLUDE FILE="dbConnect_BBS.inc"-->
<!--#INCLUDE FILE="CheckSecurity.inc"-->
<title><%= O3z("Topic Title")&" Topic File Manager" %>
</title>
<!--#INCLUDE FILE="header.inc"-->
</HEAD>
<BODY>
<center><h2><%= O3z.l40("Topic Title") %>
 - File Manager</h2>
<center>
<a href="BBSAdmin.asp?TopicID=<%= O40 %>
">Topic Admin</a>
</center>
<%
On Error GoTo 0
l41 = O41()&"\Uploads\"&O40
If Not isempty(request.form("FileDirectory")) Then
O42 = request.form("FileDirectory")
ElseIf Not isempty(request.l43("FileDirectory")) Then
O42 = request.l43("FileDirectory")
Else
O42 = ""
End If
O42 = O43(O42,".","")
If request.form("B1") = "Delete" Then
Set l44 = O44.createobject("Scripting.FileSystemObject")
For Each l45 In request.form
If ucase(left(l45,6)) = "DELETE" Then
response.write "Deleting "&O43(O42,"\","/")&"/"&request.form(l45)&"<br>"
On Error Resume Next
l44.l46(l41&O42&"\"&request.form(l45))
On Error GoTo 0
End If
Next
Set l44 = Nothing
End If
If Not isempty(request.l43("MPageNo")) Then
O46 = request.l43("MPageNo")
ElseIf Not isempty(request.form("MPageNo")) Then
O46 = request.form("MPageNo")
Else
O46 = 1
End If
If Not isempty(request.l43("MJumpTo")) Then
l47 = request.l43("MJumpTo")
ElseIf Not isempty(request.form("MJumpTo")) Then
l47 = request.form("MJumpTo")
Else
l47 = ""
End If
O47 = &O17
Dim l48(&O145)
Dim O48(&O145)
Dim l49(&O145)
Dim O49(&O145)
For l4a = 1 To &O145
l48(l4a) = ""
O48(l4a) = ""
l49(l4a) = ""
O49(l4a) = ""
Next
Dim O4a(&O17)
Dim l4b(&O17)
Dim O4b(&O17)
For l4a = 1 To &O17
O4a(l4a) = ""
l4b(l4a) = ""
O4b(l4a) = 0
Next
l4c = 0
l4a = 1
O4c = 0
l4d = 0
O4d = 0
l4e = "No"
Set l44 = O44.createobject("Scripting.FileSystemObject")
Set O4e = l44.l4f(l41&"\"&O42)
Set O4f = O4e.l4g
Set O4g = O4e.l4h
For Each O4h In O4f
If left(O4h.name,1) <> "_" Then
If left(ucase(O4h.name),1) <> l48(O4c) Then
l4i = "No"
For O4i = 1 To O4c
If left(ucase(O4h.name),1) = l48(O4i) Then
l4i = "Yes"
End If
Next
If l4i = "No" And O4c <= &O144 Then
O4c = O4c+1
l48(O4c) = left(ucase(O4h.name),1)
End If
End If
If Len(l47) > 0 Then
If left(l47,1) = left(ucase(O4h.name),1) And left(ucase(O4h.name),2) <> O48(l4d) Then
l4i = "No"
For O4i = 1 To l4d
If left(ucase(O4h.name),2) = O48(O4i) Then
l4i = "Yes"
End If
Next
If l4i = "No" And l4d <= &O144 Then
l4d = l4d+1
O48(l4d) = left(ucase(O4h.name),2)
End If
End If
End If
If Len(l47) > 1 Then
If left(l47,2) = left(ucase(O4h.name),2) And left(ucase(O4h.name),3) <> l49(O4d) Then
l4i = "No"
For O4i = 1 To O4d
If left(ucase(O4h.name),3) = l49(O4i) Then
l4i = "Yes"
End If
Next
If l4i = "No" And O4d <= &O144 Then
O4d = O4d+1
l49(O4d) = left(ucase(O4h.name),3)
End If
End If
End If
If l47 <> "" And left(ucase(O4h.name),Len(l47)) <> l47 Then
ElseIf l4c <(O46-1)*O47 Then
l4c = l4c+1
ElseIf l4c >=(O46*O47) Then
l4c = l4c+1
l4e = "Yes"
ElseIf l4c <(O46*O47) Then
O4a(l4a) = O4h.name
l4b(l4a) = "Folder"
O4b(l4a) = O4h.l4j
l4a = l4a+1
l4c = l4c+1
End If
End If
Next
If O42 <> "" Then
For Each O4h In O4g
If left(ucase(O4h.name),1) <> l48(O4c) Then
l4i = "No"
For O4i = 1 To O4c
If left(ucase(O4h.name),1) = l48(O4i) Then
l4i = "Yes"
End If
Next
If l4i = "No" And O4c <= &O144 Then
O4c = O4c+1
l48(O4c) = left(ucase(O4h.name),1)
End If
End If
If Len(l47) > 0 Then
If left(l47,1) = left(ucase(O4h.name),1) And left(ucase(O4h.name),2) <> O48(l4d) Then
l4i = "No"
For O4i = 1 To l4d
If left(ucase(O4h.name),2) = O48(O4i) Then
l4i = "Yes"
End If
Next
If l4i = "No" And l4d <= &O144 Then
l4d = l4d+1
O48(l4d) = left(ucase(O4h.name),2)
End If
End If
End If
If Len(l47) > 1 Then
If left(l47,2) = left(ucase(O4h.name),2) And left(ucase(O4h.name),3) <> l49(O4d) Then
l4i = "No"
For O4i = 1 To O4d
If left(ucase(O4h.name),3) = l49(O4i) Then
l4i = "Yes"
End If
Next
If l4i = "No" And O4d <= &O144 Then
O4d = O4d+1
l49(O4d) = left(ucase(O4h.name),3)
End If
End If
End If
If l47 <> "" And left(ucase(O4h.name),Len(l47)) <> l47 Then
ElseIf l4c <(O46-1)*O47 Then
l4c = l4c+1
ElseIf l4c >=(O46*O47) Then
l4c = l4c+1
l4e = "Yes"
ElseIf l4c <(O46*O47) Then
O4a(l4a) = O4h.name
l4b(l4a) = "File"
O4b(l4a) = O4h.l4j
l4a = l4a+1
l4c = l4c+1
End If
Next
End If
Set O4g = Nothing
Set O4f = Nothing
Set O4e = Nothing
Set l44 = Nothing
O4j = "No"
O4i = 1
O49(1) = chr(&O377)
Do While O4j = "No"
l4a = 1
l4k = 1
O4j = "Yes"
Do While l48(l4a) <> ""
If l48(l4a) < O49(O4i) And l48(l4a) <= l48(l4k) Then
l4k = l4a
O4j = "No"
End If
l4a = l4a+1
Loop
If l48(l4k) <> chr(&O377) Then
O49(O4i) = l48(l4k)
l48(l4k) = chr(&O377)
O4i = O4i+1
O49(O4i) = chr(&O377)
End If
Loop
For l4a = 1 To &O144
If O49(l4a) = chr(&O377) Then
l48(l4a) = ""
Else
l48(l4a) = O49(l4a)
End If
O49(l4a) = ""
Next
O4j = "No"
O4i = 1
O49(1) = chr(&O377)
Do While O4j = "No"
l4a = 1
l4k = 1
O4j = "Yes"
Do While O48(l4a) <> ""
If O48(l4a) < O49(O4i) And O48(l4a) <= O48(l4k) Then
l4k = l4a
O4j = "No"
End If
l4a = l4a+1
Loop
If O48(l4k) <> chr(&O377) Then
O49(O4i) = O48(l4k)
O48(l4k) = chr(&O377)
O4i = O4i+1
O49(O4i) = chr(&O377)
End If
Loop
For l4a = 1 To &O144
If O49(l4a) = chr(&O377) Then
O48(l4a) = ""
Else
O48(l4a) = O49(l4a)
End If
O49(l4a) = ""
Next
O4j = "No"
O4i = 1
O49(1) = chr(&O377)
Do While O4j = "No"
l4a = 1
l4k = 1
O4j = "Yes"
Do While l49(l4a) <> ""
If l49(l4a) < O49(O4i) And l49(l4a) <= l49(l4k) Then
l4k = l4a
O4j = "No"
End If
l4a = l4a+1
Loop
If l49(l4k) <> chr(&O377) Then
O49(O4i) = l49(l4k)
l49(l4k) = chr(&O377)
O4i = O4i+1
O49(O4i) = chr(&O377)
End If
Loop
For l4a = 1 To &O144
If O49(l4a) = chr(&O377) Then
l49(l4a) = ""
Else
l49(l4a) = O49(l4a)
End If
O49(l4a) = ""
Next
response.write "<center>"
l4a = 1
Do While l49(l4a) <> ""
response.write "<a href='"&O4k&".asp?TopicID="&O40
response.write "&MJumpTo="&l49(l4a)&"&FileDirectory="&O44.l4l(O42)&"'>"
response.write l49(l4a)
response.write "</a> "&vbnewline
l4a = l4a+1
Loop
If l49(1) <> "" Then
response.write "<hr>"
End If
l4a = 1
Do While O48(l4a) <> ""
response.write "<a href='"&O4k&".asp?TopicID="&O40
response.write "&MJumpTo="&O48(l4a)&"&FileDirectory="&O44.l4l(O42)&"'>"
response.write O48(l4a)
response.write "</a> "&vbnewline
l4a = l4a+1
Loop
If O48(1) <> "" Then
response.write "<hr>"
End If
l4a = 1
Do While l48(l4a) <> ""
response.write "<a href='"&O4k&".asp?TopicID="&O40
response.write "&MJumpTo="&l48(l4a)&"&FileDirectory="&O44.l4l(O42)&"'>"
response.write l48(l4a)
response.write "</a> "&vbnewline
l4a = l4a+1
Loop
response.write "<a href='"&O4k&".asp?TopicID="&O40&"&FileDirectory="&O44.l4l(O42)&"'>All</a> "&vbnewline
response.write "</center>"
Randomize
response.write "<center>"
response.write "<form action='"&O4k&".asp' method='POST'>"&vbnewline
response.write "<input type='hidden' name='TopicID'       value='"&O40&"'>"&vbnewline
response.write "<input type='hidden' name='MPageNo'       value='"&O46&"'>"&vbnewline
response.write "<input type='hidden' name='MResults'      value='"&O47&"'>"&vbnewline
response.write "<input type='hidden' name='MJumpTo'       value='"&O4l(l47)&"'>"&vbnewline
response.write "<input type='hidden' name='FileDirectory' value='"&O4l(O42)&"'>"&vbnewline
response.write "<table border='1'>"&vbnewline
response.write "<tr>"&vbnewline
response.write "   <td colspan='3' align='center' bgcolor='#C0C0C0' style='font-weight: bold; font-size: larger'>"&O43(O42,"/","\")&"<br>Files</td>"&vbnewline
response.write "</tr>"&vbnewline
response.write "<tr>"&vbnewline
response.write "  <td align='left' valign='top' bgcolor='#C0C0C0'>File Name</td>"&vbnewline
response.write "  <td align='right' valign='top' bgcolor='#C0C0C0'>Size</td>"&vbnewline
response.write "  <td align='center' valign='top' bgcolor='#C0C0C0'>Delete</td>"&vbnewline
response.write "</tr>"&vbnewline
If O42 <> "" Then
response.write "<tr>"&vbnewline
response.write "<td align='left'  valign='top'>"
response.write "<a href='"&O4k&".asp?TopicID="&O40
response.write "&FileDirectory="&O44.l4l(left(O42,instrrev(O42,"\")-1))&"'>"
response.write "Up To "&O43(left(O42,instrrev(O42,"\")-1),"\","/")&"/</a>"&vbnewline
response.write "</td>"&vbnewline
response.write "<td align='center' valign='top'> </td>"&vbnewline
response.write "<td align='center' valign='top'> </td>"&vbnewline
response.write "</tr>"&vbnewline
End If
For l4m = 1 To &O17
If O4a(l4m) <> "" Then
response.write "<tr>"&vbnewline
response.write "<td align='left'  valign='top'>"
If l4b(l4m) = "Folder" Then
response.write "<a href='"&O4k&".asp?TopicID="&O40
response.write "&FileDirectory="&O44.l4l(O42&"\"&O4a(l4m))&"'>"
response.write "Go To /"&O4a(l4m)&"</a>"&vbnewline
Else
response.write "<a href='Uploads/"&O40&O4l(O43(O42,"\","/"))&"/"
response.write O4l(O4a(l4m))&"' target='New"&O4m(Rnd()*&O1750,4,0)&"'>"
response.write O4a(l4m)&"</a>"&vbnewline
End If
response.write "</td>"&vbnewline
response.write "<td align='right' valign='top'>"&O4m(O4b(l4m)/&O2000,"Float",2)&" k</td>"&vbnewline
response.write "<td align='center' valign='top'>"&vbnewline
If l4b(l4m) = "Folder" Then
response.write " "
Else
response.write "<input type='Checkbox' name='Delete"&O4m(l4m,4,0)&"'  value='"&O4l(O4a(l4m))&"'>"&vbnewline
End If
response.write "</td>"&vbnewline
response.write "</tr>"&vbnewline
End If
Next
response.write "</table>"&vbnewline
response.write "<input type='submit' name='B1' value='Delete' ONCLICK="&chr(&O42)&"return Confirm_Delete()"&chr(&O42)&">"&vbnewline
response.write "</form>"&vbnewline
response.write "<center><br>"&vbnewline
response.write "<table cellspacing='0' border='0' width='100%'>"&vbnewline
response.write "    <tr>"&vbnewline
If O46 > 1 Then
response.write "<td valign='top' align='center'>"&vbnewline
response.write "<form method='POST' action='"&O4k&".asp'>"&vbnewline
response.write "<input type='hidden' name='TopicID'       value='"&O40&"'>"&vbnewline
response.write "<input type='hidden' name='MResults'      value='"&O47&"'>"&vbnewline
response.write "<input type='hidden' name='MPageNo'       value='"&O46-1&"'>"&vbnewline
response.write "<input type='hidden' name='MJumpTo'       value='"&O4l(l47)&"'>"&vbnewline
response.write "<input type='hidden' name='FileDirectory' value='"&O4l(O42)&"'>"&vbnewline
response.write "<input type='submit' name='B3'            value='Previous Page'>"&vbnewline
response.write "</form>"&vbnewline
response.write "</td>"&vbnewline
End If
If l4e = "Yes" Then
response.write "<td valign='top' align='center'>"&vbnewline
response.write "<form method='POST' action='"&O4k&".asp'>"&vbnewline
response.write "<input type='hidden' name='TopicID'       value='"&O40&"'>"&vbnewline
response.write "<input type='hidden' name='MResults'      value='"&O47&"'>"&vbnewline
response.write "<input type='hidden' name='MPageNo'       value='"&O46+1&"'>"&vbnewline
response.write "<input type='hidden' name='MJumpTo'       value='"&O4l(l47)&"'>"&vbnewline
response.write "<input type='hidden' name='FileDirectory' value='"&O4l(O42)&"'>"&vbnewline
response.write "<input type='submit' name='B3'            value='Next Page'>"&vbnewline
response.write "</form>"&vbnewline
response.write "</td>"&vbnewline
End If
response.write "</tr>"&vbnewline
response.write "</table>"&vbnewline
response.write "</center>"
Call l4n()
O4n.close
Set O4n = Nothing
%>
<!--#INCLUDE FILE="footer.inc"-->
</body>
</html>

Obfuscated Symbol Cross Reference

The obfuscator produces a cross reference mapping obfuscated symbols to the orginal symbols, so that obfuscated code in the field can still be decoded if necessary. Notice that certain symbols are preserved (we don't show them all) to enable access to the windowing environment in which this script runs. (We provide a complete preserved word list for using with the obfuscator as part of the product). In fact, by reversing this map and running the obfuscator, you can reproduce an equivalent of the starting source file, without, of course, the comments. Of course, you can do that only if you have the map.


appfilepath -> O41
bbs_conn -> O4n
deletefile -> l46
fields -> l40
filedirectory -> O42
filelist -> O4a
files -> l4h
filesize -> O4b
filetype -> l4b
foundit -> l4i
getfolder -> l4f
hctr -> l4k
ictr -> l4a
index1 -> l48
index2 -> O48
index3 -> l49
indexctr1 -> O4c
indexctr2 -> l4d
indexctr3 -> O4d
indexw -> O49
key -> l45
mdone -> O4j
memoview -> O4l
mjumpto -> l47
morepages -> l4e
mpageno -> O46
mresults -> O47
numbertostring -> O4m
pctr -> l4m
querystring -> l43
recno -> l4c
replace -> O43
sec_topics -> O3z
securityclose -> l4n
server -> O44
shortscriptname -> O4k
size -> l4j
subfolders -> l4g
topicid -> O40
topicpath -> l41
urlencode -> l4l
wctr -> O4i
workfilefolder -> O4e
workfilelist -> O4g
workfileobject -> l44
workfolderlist -> O4f
wrkfilename -> O4h
For more information: [email protected]    Follow us at Twitter: @SemanticDesigns

VB Script
Obfuscation Example