We help IT Professionals succeed at work.

How can i encode my files and then decode the files again

want2learn
want2learn asked
on
2,501 Views
Last Modified: 2007-12-19
Hi.

I want to know how i can encode my files so if an user is taking my files he vil se somrthing like this in the files.
____________________

<%@ LANGUAGE = VBScript.Encode %>
<%#@~^QwAAAA==@#@&r2DkKxPA6ask1kO@#@&IndaWxknR~E06n.P{P:D;+@#@&"+dwKU/R/slD@#@&jxMAAA==^#~@%>
<!--#INCLUDE FILE="shared.asp"-->
<%#@~^AwgBAA==@#@&ZG      /DP6ZP{~JDWC/DJ@#@&Gk:,aFBP6yS~62~,6*~~al~~681c@#@&9rsP6*T@#@&(0,HKY~D/Df+(ET\W9+~K4+U~}xPA.DKDP"ndEs+,1n6O@#@&6*vy@#@&&0~3MDRH;s4nD,@!@*PT,K4+x,6F~2MD 1!:8nM~PA.Dcf+k^.kaYbWU~~3MD ?K;D1+S~rJ@#@&aR@#@&6WT,'~"+aVl1+vacZ~~J@!"RRCC+m[+MeO @*E~,6W c?n.7+.RtCwhlO4vY/Oj0kU/hCDtb,[,J-rPL~6yP'Pr-4nmN+M tD:Vrbb@#@&6W!~'~]wsl1n`XcTS,J@!ZR eoWKODM O@*J~,6W+`U+.\D \mwnmOtvY/DjVk      /hlOtb~LPE-r~[,6+~LPJwWKWO+M 4Yh^J*#@#@&YkOA0GDfrdaVlHKlT+PX*T@#@&q6P(xjOM`acZSPr@!ZR eCnC9+.e R@*Jb,@*,!P:tU@#@&6*!,'~]wVm^+v6cZS~J@!" OMCnC9+.e R@*r~~aW `jnM\nDc\mwKmY4`YkYUVk      /KlDtb~LPJ'EPLP6y~'Pr-4+CNn.ctO:^E#*@#@&aW!Px~"+2Vm^`aW!BPJ@!" RewWGYDMR @*JB~6W `Un.\DcHCwKCDtcYkO?0kUdhlY4b,[~J'E,[~X ,[Pr-6GWD+.R4Yhsr##@#@&2      NP&W@#@&XcZPxPa*+&c6WT#@#@&]nkwWUdR      DbOPaW!@#@&?!4,ac+ c#@#@&]nkwW      d+c26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6O`JD/DsxTqU\mVr[hr?:GDV2Krb@#@&A6bY~?;8@#@&3x9~?Vn^D@#@&/Ck+~JsG9kWHJ@#@&6lP{~I;;+kYcEkE4rb@#@&q0,aXP{PrJ~K4n      Pa*,xPr/4GSJ@#@&jVnmD~;ldPX*@#@&Zmd+,JdtKhE@#@&6cF0@#@&Zlkn~JkE(:rYE@#@&qWP"n;!


____________________

and how can i then decode my files so i again can do changes in my files again. !??

I user Macromedia Dreamweaver MX 2003 if that has something to do whit it !??
Comment
Watch Question

Commented:
@prasannap:

> I tried it using LoadXML instead of load and it worked.

Doh!  I should've reloaded the question before responding... Glad you got it figured out.  As for you other question, if whatever you load with LoadXML isn't valid XML, then there won't be a documentElement to assign.  Try it like this:
     If ( IsObject(XMLDoc.documentElement) ) Then
          Set rootNode = XMLDoc.documentElement
          If rootNode.hasChildNodes() Then
               For each element in rootNode.childNodes
                    Response.Write( Server.HTMLEncode(element.text) )
               Next
          End if
     End If

Dex*

Commented:
Sorry, wrong question...  I'll be back in a sec to try and answer yours.

Author

Commented:
OK Dexstar !!

Commented:
@want2learn:

> I want to know how i can encode my files so if an user is taking my files he
> vil se somrthing like this in the files.

Windows comes with a utility called "screnc.exe".  That utility will encode (not really encrypt) your scripts to make them difficult to read.  You will only keep "basic" users out, though, because you can always just use this script to decode them again:
     http://www.interclasse.com/scripts/decovbe.php

Dex*

Author

Commented:
isent there a freeware program that can do it or !??

I cant see how screnc.exe works !??

Commented:
@want2learn:

> I cant see how screnc.exe works !??

Oops.  I thought it came with Windows, but I guess you have to download it.  The page will let you download it, and has links to pages that tell you how to use it:
     http://www.microsoft.com/downloads/details.aspx?FamilyId=E7877F67-C447-4873-B1B0-21F0626A6329&displaylang=en

Dex*

Author

Commented:
okay do i run screnc.exe in dos mode or in windows.

and do my server have to have the program on it or will the files work on the server/iis i'm running the script on !??

Commented:
It is a command line utility.  You should use a command prompt (DOS Window) to run it.

You should have a copy of the .ASP file that you want to encode on your computer, and then you can upload the output to the IIS computer.

So, say you have a file called "C:\Temp\Code.asp" that you want to encode.  Use this command line:
     srcenc /xl C:\Temp\Code.asp C:\Temp\SecretCode.asp

You will now have a file called "SecretCode.asp", the contains the encoded version of "Code.asp".  Put "SecretCode.asp" on your server, and there you go.  For more info, see this:
     http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/seconscriptencodersyntax.asp

Dex*

Author

Commented:
okay but how 2 decode the site again !??

And isent there a better solution/program out there or is screnc the best U know !??

Commented:
@want2learn:

SCRENC is the only tool I know of, unless you want to make your own.  You are not SUPPOSED to be able to to decode the site again.  However, you CAN anyway using this script:
     http://www.interclasse.com/scripts/decovbe.php

Go to that site, and follow the instructions there.

Dex*
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
okay If my Decode.vbs is in C:\Inetpub\wwwroot\ASP_3.0\ENCODER\   and the file i want to decode is in C:\Inetpub\wwwroot\ASP_3.0\test\default.asp

when i then use RUN in windows start menu and write CMD so i get this window:

Microsoft Windows XP [version 5.1.2600]
<c> Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\TJ>

and do so i get this:

Microsoft Windows XP [version 5.1.2600]
<c> Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\TJ>cd..

C:\Documents and Settings\>cd..

C:\>


How du i then encode the file i want to encode and how do i start the encoding !??

just whit

C:\> csript Decode.vbs <C:\Inetpub\wwwroot\ASP_3.0\test\default.asp>  or just csript Decode.vbs <C:\Inetpub\wwwroot\ASP_3.0\test\default.asp>

or something else !??

Commented:
NOE: This is for DECODING not encoding.  For ENCODING, use ScrEnc according to the instructions I posted earlier.

Do Start -> Run, and then enter these commands at the "C:\Documents and Settings\TJ>" prompt:
1) cd \Inetpub\wwwroot\ASP_3.0\ENCODER\
2) cscript Decode.vbs C:\Inetpub\wwwroot\ASP_3.0\test\default.asp

The DECODED version of the file will be saved as:
     C:\Inetpub\wwwroot\ASP_3.0\test\default-fixed.asp

Dex*

Author

Commented:
HEY THANKS MAN' it works !!

HAPPY NEWYEAR !!!

Author

Commented:
one question

If i want to encode all files in a path the i shut write the <PATH>\ "and no filname" then it will encode all files in the path.

Can i do the same thing whit the Decoder like this:
1) cd \Inetpub\wwwroot\ASP_3.0\ENCODER\
2) cscript Decode.vbs C:\Inetpub\wwwroot\ASP_3.0\test\

and then it will decode all files in test !??

Author

Commented:
I can't get SCRENC to work !!

I have installet the program in here: C:\Inetpub\Windows Script Encoder\

"as a test"
and the file i want to encode in here: C:\Inetpub\wwwroot\ASP_3.0\nyhedscript\news.asp

and if i then go to run cmd

Microsoft Windows XP [version 5.1.2600]
<c> Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\TJ>cd..

C:\Documents and Settings\>cd..

C:\>cd Inetpub\wwwroot\ASP_3.0\nyhedscript\

C:\Inetpub\wwwroot\ASP_3.0\nyhedscript\>SCRENC news.asp encodenews.asp


I have also trying this

C:\Inetpub\wwwroot\ASP_3.0\nyhedscript\>SRCENC news.asp encodenews.asp

but i get this after i have hit ENTER
C:\Inetpub\wwwroot\ASP_3.0\nyhedscript\>SCRENC news.asp encodenews.asp
'SCRENC' was not recognize as an internal or an external command,
a program or a batchfil.

and the same error if i do it whit this line
C:\Inetpub\wwwroot\ASP_3.0\nyhedscript\>SRCENC news.asp encodenews.asp

how do i use the encode program !??


Commented:
1) Thanks for the grade.
2) No, you can't use the decode script on a directory.  Just individual files.
3) To use SrcEnc, open a command prompt, and enter these:

   a) cd \Inetpub\Windows Script Encoder\
   b) srcenc /xl C:\Inetpub\wwwroot\ASP_3.0\nyhedscript\News.asp C:\Inetpub\wwwroot\ASP_3.0\nyhedscript\encodenews.asp

Author

Commented:
I get the same error !!

Author

Commented:
I got it but cant open the fil it has to be:

screnc.exe /xl C:\Inetpub\wwwroot\ASP_3.0\nyhedscript\News.asp C:\Inetpub\wwwroot\ASP_3.0\nyhedscript\encodenews.asp

but then i run scripting.encoder but can not open the file for writing, and the fil is writabel in options  but the scripting.encoder get the failed.

what is wrong !??

Commented:
Try this:
screnc.exe /xl C:\Inetpub\wwwroot\ASP_3.0\nyhedscript\News.asp C:\encodenews.asp

Then the file will be in you C: root directory.  Then move it where you want.

Author

Commented:
okay now it works but now i get errors when i run the script !!

Errortype:
there arise a Microsoft VBScript-compilerings error (0x800A0400)
A claus was waited
/ASP_3.0/nyhedscript/encodenews.asp, line 3
#@~^ugEAAA==@#@&kW,I;E/D ?D-+M.C.bl4^n/vJIA}i2UK|H3Ku6GJbP{~JhrjPrPY4n @#@&P,r6P];!+/DRwGDs`ED/nOr#P{~JM+/OEPDtx@#@&~~,P[lDGP{PEE@#@&P~~,xnhkOHwn,',JJ@#@&,~P,W.N,'~Er@#@&,~+^/+@#@&~P,P9lOW~x,In;!n/DRoGM:`E[mYGJ*@#@&P~,P +hkYH2+,'~I;;nkYRwGDs`J nA/DXa+E#@#@&,P~PK.N,'~];EndDRoWMhvJGMNr#@#@&P,nx9Pr0@#@&nsk+@#@&~P9lYK~xP"+$En/O 5EnDHjYMkULvJNCOKJb@#@&~,xnS/DXwP{~I;;+kY }!+DHjYMkxTcExhkYzwnE*@#@&P,GD9Px~"+;;nkY p!nMXjDDbxovJK.Nr#@#@&x[~b0@#@&FXsAAA==^#~@

Commented:
Make sure you have "<%@ LANGUAGE = VBScript.Encode %>
<%

"

at the top of your file like the sample that you posted in your original question, so that ASP knows it is encoded.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions