Ideando

febrero 13, 2007

Archivos JSE, codificar y decodificar archivos con javascript

Filed under: JavaScript, programacion — mrodriguez @ 4:42 pm

Ayer un compañero de trabajo me preguntaba que era un archivo con extensión JSE y como decodificarlo, después de buscar un poco en internet, me encontré un script vb, con el que se puede codificar y descodificar un archivo js o jse, dependiendo el caso.

Dejo aquí la referencia a la página para futuras ocasiones: http://gogogadgetscott.info/computers/scripts/scriptdencoder

También anexo el código que en esta página ponen, para evitar perderlo.

‘==============================================
‘NAME: ScriptDEcoder.vbs

‘AUTHOR: Scott Greenberg
‘COMPANY: SG Technology
‘WEBSITE: http://gogogadgetscott.info
‘Date : 4/23/2004
‘VERSION: 1.0

‘COMMENT:
‘Recognized file extensions:
‘vbs vbe js jse htm html asa asp cdx
‘Decode procces derived from VBE decoder
‘by: Jean-Luc Antoine
http://www.interclasse.com/scripts/decovbe.php

‘Copyright� 2004. SG Technology. All rights reserved.
‘==============================================
Const TagInit = “#@~^”
Const TagFin = “==^#~@”
‘Get And check command arguments
Set oArgs = WScript.Arguments
If oArgs.Count = 0 Then
DisplayHelp “”
WScript.Quit
End If
‘Check If user requests help
For Each Arg In oArgs
If InStr (Arg, “?”) > 0 Then
DisplayHelp “”
WScript.Quit
End If
Next
Set oFSO = CreateObject (“Scripting.FileSystemObject”)
‘Create encoder object
Set oEncoder = CreateObject (“Scripting.Encoder”)
For Each Arg In oArgs
‘Check If argument contains path To a valid file
If oFSO.FileExists(Arg) Then
sFileExt = oFSO.GetExtensionName(Arg)
ValidExts = Array (“vbs”, “js”, “jse”, “vbe”, “htm”, “html”, “asa”, “asp”, “cdx”)
For Each Ext In ValidExts
If Ext = sFileExt Then
DisplayHelp Process(Arg)
Exit For
End If
Next
Else
DisplayHelp “Argument Is Not a valid file.”
End If
Next
DisplayHelp “Process Is complete”
‘Clean up
Set oEncoder = Nothing
Set oFSO = Nothing
Set oArgs = Nothing
‘Process file
Function Process(sFileIn)
‘Get In file extension
sSourceExt = “.” & oFSO.GetExtensionName(sFileIn)
sSourceFile = oFSO.GetBaseName(sFileIn)
‘Read file into buffer
Set fIn = oFSO.OpenTextFile(sFileIn)
sSource = fIn.ReadAll
fIn.Close : Set fIn = Nothing
‘Run process
If InStr (sSource, TagInit) = 0 Then
Decoded = True
End If
If Decoded = True Then
sOut = Encode(sSource, sSourceExt)
Select Case sSourceExt
Case “.vbs”
sOutExt = “.vbe”
Case “.js”
sOutExt = “.jse”
Case Else
sOutExt = sSourceExt
End Select
Process = “File “&sSourceFile&sSourceExt&” encoded And saved As “&sSourceFile&sOutExt&”.”
Else
sOut = Decode(sSource, sSourceExt)
Select Case sSourceExt
Case “.vbe”
sOutExt = “.vbs”
Case “.jse”
sOutExt = “.js”
Case Else
sOutExt = sSourceExt
End Select
Process = “File “&sSourceFile&sSourceExt&” decoded And saved As “&sSourceFile&sOutExt&”.”
End If
‘Write New file
sFileOut = oFSO.GetParentFolderName(sFileIn) & “\” & _
sSourceFile & sOutExt
‘* Fix To overwrite file
Set fOut = oFSO.OpenTextFile(sFileOut, 2, True )
fOut.Write sOut
fOut.close : Set fOut = Nothing
End Function
‘Encode buffer
Function Encode(sSource, sSourceExt)
‘Encode source
Encode = oEncoder.EncodeScriptFile(sSourceExt, sSource, 0, 0)
Set oEncoder = Nothing
End Function
‘Decode helper
Function Decode(sSource, sSourceExt)
Do
FinCode = 0
‘Find the start positon of encoded data
StartCode = InStr (sSource, TagInit)
If StartCode > 0 Then
‘If “==” the marker follows
If (InStr (StartCode, sSource, “==”) – StartCode) = 10 Then
‘Find the End positon of encoded data
FinCode = InStr (StartCode, sSource, TagFin)
If FinCode > 0 Then
‘Decode encoded data
sSource = Left (sSource, StartCode – 1) & _
DecodeH(Mid (sSource, StartCode + 12, FinCode – StartCode – 12 – 6)) & _
Mid (sSource, FinCode + 6)
End If
End If
End If
Loop Until FinCode = 0
If Asc (Right (sSource, 1)) = 0 Then sSource = Left (sSource, Len (sSource) – 1)
sSource = Replace (sSource,”.Encode”,””)
Decode = sSource
End Function
‘Decode buffer
Function DecodeH(Chain)
Dim tDecode(127)
Const Combination = “1231232332321323132311233213233211323231311231321323112331123132”
For i = 9 To 127
tDecode(i) = “JLA”
Next
For i = 9 To 127
ChainsTemp = Mid (oEncoder.EncodeScriptFile(“.vbs”, String (3, i), 0, “”), 13, 3)
For j = 1 To 3
c = Asc (Mid (ChainsTemp, j, 1))
If Not ((c = 42) And (i = 62)) Then
tDecode(c) = Left (tDecode(c), j – 1) & Chr (i) & Mid (tDecode(c), j + 1)
End If
Next
Next
Chain = Replace (Replace (Chain, “@&”, Chr (10)), “@#”, Chr (13))
Chain = Replace (Replace (Chain,”@*”,”>”), “@!”, “<“)
Chain = Replace (Chain,”@$”,”@”)
index = -1
For i = 1 To Len (Chain)
c = Asc (Mid (Chain, i, 1))
If c < 128 Then index = index + 1
If (c = 9) Or ((c > 31) And (c < 128)) Then
If (c <> 60) And (c <> 62) And (c <> 64) Then
Chain = Left (Chain,i – 1) & _
Mid (tDecode(c), Mid (Combination, (index Mod 64) + 1, 1), 1) & _
Mid (Chain,i + 1)
End If
End If
Next
DecodeH = Chain
End Function
‘Sub To display help message And any exceptions
Sub DisplayHelp(msg)
CRLF = Chr (13) + Chr (10)
If msg = “” Then msg = msg & ” — About this script —” & CRLF & _
“Recognized file extensions: ” & CRLF & _
” vbs vbe js jse htm html asa asp cdx” & CRLF & CRLF & _
“<file(s) To encode/decode>” & CRLF & _
“? <help>”
MsgBox msg, vbInformation , “ScriptDEcoder”
End Sub

Mas información útil en: http://www.insesys.com.mx

Anuncios

12 comentarios »

  1. me puedes desifrar este codigo ªsN=íÄgúïÅïɺ®¼².ƒïNܽ“Ö»‹ gracias

    Comentario por Ignacio — noviembre 10, 2007 @ 11:00 pm

  2. el codigo entero es el siguente:
    ANUNCIOS_EXP__(750, 1100, 2, ”);

    Comentario por kuli — julio 10, 2009 @ 10:30 pm

  3. What’s up, after reading this remarkable article i am also delighted to share my knowledge here with mates.

    Comentario por pet supplies plus stores|online pet store — octubre 9, 2012 @ 8:51 pm

  4. hello there and thank you for your information – I’ve certainly picked up something new from right here. I did however expertise several technical issues using this web site, since I experienced to reload the site a lot of times previous to I could get it to load properly. I had been wondering if your hosting is OK? Not that I am complaining, but slow loading instances times will often affect your placement in google and can damage your high-quality score if ads and marketing with Adwords. Well I am adding this RSS to my email and can look out for much more of your respective exciting content. Make sure you update this again very soon.

    Comentario por Niamh — febrero 16, 2013 @ 11:37 pm

  5. Great blog here! Also your site loads up fast! What host are you using?
    Can I get your affiliate link to your host? I wish my site loaded up
    as quickly as yours lol

    Comentario por Anyoption — marzo 3, 2013 @ 4:16 am

  6. Do you mind if I quote a couple of your posts as long as I provide credit and sources back
    to your website? My blog is in the very same niche as yours and my visitors would really benefit from a lot of the
    information you provide here. Please let me know if this alright with you.
    Thanks a lot!

    Comentario por christian louboutin black pumps — marzo 9, 2013 @ 10:53 am

  7. I blog frequently and I truly thank you
    for your information. Your article has truly peaked my interest.

    I am going to book mark your website and keep checking for new details about once per week.
    I opted in for your Feed as well.

    Comentario por Caroline — marzo 22, 2013 @ 9:31 am

  8. We are a group of volunteers and opening a brand new
    scheme in our community. Your web site offered us with useful info to work on.
    You’ve performed an impressive job and our whole group will probably be thankful to you.

    Comentario por weight loss calculator — abril 10, 2013 @ 4:13 am

  9. Buying fresh, local produce in season became the big push.

    Books are available about natural treatment of almost all common ailments.
    First, let’s get one thing straight; health food amp vitamins, though they do improve your physical performance, are not steroids.

    Comentario por Star — abril 13, 2013 @ 1:38 am

  10. Magnificent goods from you, man. I’ve take into accout your stuff prior to and you’re simply extremely magnificent.
    I actually like what you’ve received here, certainly like what you are stating and the best way wherein you are saying it. You make it enjoyable and you still take care of to stay it wise. I can’t
    wait to read far more from you. This is actually a terrific
    site.

    Comentario por make money fast — abril 25, 2013 @ 11:19 am

  11. Thanks for sharing such a good thinking, paragraph is nice, thats why i have read it fullyMy weblog :: WEight Lifting Fvs Cardio For Weight Loss (Dorie)

    Comentario por Dorie — septiembre 8, 2013 @ 2:45 pm


RSS feed for comments on this post. TrackBack URI

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

Blog de WordPress.com.

A %d blogueros les gusta esto: