by Luis Mariscal (11 Submissions)
Category: Encryption
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 20th December 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Demostrates how to encrypt a HTML page for your site...
directorio="c:\disco\pagina.html"
pagi2 = ""
Set fconn = CreateObject("scripting.FilesystemObject")
Set file = fconn.OpenTextFile(directorio.Text, 1, False)
Do While Not file.atEndOfStream
linea = file.readline
Cr = Chr(10)
linea = Replace(linea, " ", "")
If linea <> "" Then
cagada = cagada & linea
End If
Loop
Set file = Nothing
Set fconn = Nothing
Text1 = cagada
End Sub
Private Sub Label6_Click()
Text1 = ""
Text2 = ""
pagi2 = ""
cagada = ""
Set fconn = CreateObject("scripting.FilesystemObject")
Set file = fconn.OpenTextFile(directorio, 1, False)
Do While Not file.atEndOfStream
linea = file.readline
pagi2 = pagi2 & linea & Chr(10)
Loop
Set file = Nothing
Set fconn = Nothing
pos1 = InStr(pagi2, "(""")
pos2 = InStr(pagi2, """));")
For i = pos1 + 2 To pos2 - 3 Step 3
df = Mid$(pagi2, i + 1, 2)
'Text1 = Text1 & df
cagada = cagada & Chr(Val("&h" & df))
Next
Text1 = cagada
End Sub
' Boton encriptador
Private Sub command2_Click()
If archivo <> "" Then
Form1.Height = 405
Form1.Width = 2370
titulo = Form1.Caption
Form1.Caption = "Procesando..."
Else
cagada = Text1 & footer
End If
uno = 1
cero = "0"
' don´t touch this code
Cr = Chr(10)
header = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & Cr
header = header & "<HTML><HEAD>" & Cr
header = header & "<META http-equiv=Content-Type content=""text/html; charset=windows-1252"">" & Cr
header = header & "<SCRIPT language=JavaScript><!-- " & Cr & "eval(unescape('%68%70%5F%6F%6B%3D%74%72%75%65%3B%66%75%6E%63%74%69%6F%6E%20%68%70%5F%64%30%30%28%73%29%7B%69%66%28%21%68%70%5F%6F%6B%29%72%65%74%75%72%6E%3B%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%73%29%7D'));" & Cr & "//--></SCRIPT>" & Cr
header = header & "<NOSCRIPT>" & Cr
header = header & "<META content=""MSHTML 6.00.2743.600"" name=GENERATOR></HEAD>" & Cr
header = header & "<BODY>To display this page you need a browser with JavaScript support.</NOSCRIPT>" & Cr
'--------------------------------------
For i = uno To Len(cagada)
df = Mid$(cagada, i, uno)
result = Hex(Asc(df))
If Len(result) = uno Then
result = cero & result
End If
code = code & "%" & result
Next
inicio = Cr & "<SCRIPT language=JavaScript><!-- " & Cr & " hp_d00(unescape("""
final = """)); " & Cr & "//--></SCRIPT>" & Cr & "</BODY></HTML>"
pagina = header & Cr & inicio & code & final
dsalvar = Replace(directorio, archivo, "")
If archivo <> "" Then
Open dsalvar & "js_" & archivo For Output As #1
Print #1, pagina
Close
MsgBox "Archivo generado :" & vbCrLf & vbCrLf & dsalvar & "js_" & archivo & vbCrLf & vbCrLf & " Copyright 2004 - Mariscal Desarrollos Web " & vbCrLf & vbCrLf & " http://comin.s8s.com.ar"
Else
CommonDialog1.Filter = "Todos los archivos (*.htm)|*.htm"
Form1.CommonDialog1.ShowSave
file$ = Form1.CommonDialog1.FileName
If file$ = "" Then GoTo hj
Open file$ For Output As #2
Print #2, pagina
Close #2
hj:
End If
Text2 = code
End Sub