Solved

Javascript Encription - is it possible ??

Posted on 2004-03-23
7
733 Views
Last Modified: 2009-12-16
Hi All,

Is it possible to encript javascript but still it works in Internet Explorer and Netscape?
0
Comment
Question by:meet_zorrer
7 Comments
 
LVL 25

Expert Comment

by:devic
Comment Utility
no,
if you find something, do not forget to test it ;)
look in my profile a tester :)
0
 
LVL 4

Author Comment

by:meet_zorrer
Comment Utility
if you are tester then you should test your mind first :D
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 168 total points
Comment Utility
Hello meet_zorrer,

the initial question is: why do you want to encrypt your JavaScript?
If you want to prevent modification or prevent removing of some license enforcement, then it can not be absolutely done, but to some degree you can encode your script by algorithm which are difficult to follow and backtrack.
If you want only to make it difficult to be read by humans, then a regular scrambler and space remover will do it too.

But at the end I can prove you that any encoded script can be decoded, when the effort is worth of doing it.
Also for the Microsoft IE script compiler are decompiler out there (for demo purposes :)

0
 
LVL 10

Assisted Solution

by:Nushi
Nushi earned 166 total points
Comment Utility
hi there.

you can only encrypt the js from IE.
you can find a small took called srcenc which will encode the script and you will not be able to see it.

BUT you can use the same tool for decone and encode so someone whi knows what to do will be able to "see" the code.
under NS you will not be able to run it.
0
 
LVL 16

Assisted Solution

by:jaysolomon
jaysolomon earned 166 total points
Comment Utility
Here are a number of very effective methods of keeping unscrupulous surfers from stealing your HTML source:

Use the <INVISIBLE> </INVISIBLE> tags around the entire document.
Use the DONTSTEAL attribute in the <BODY> tag.
Ftp to your server, select all files and directories, hit "Delete".
Put every existing copy of every file on floppies, place them in a shoebox and bury them in the backyard. There is another version of this method which involves placing the floppies in a plastic bag and hiding them in a different sort of hole. Both are equally effective.
Password protect your entire site and make sure no one has the password, not even you.
Employ a small but fanatically loyal and well-armed band of mercenaries to guard your site.
Start>Run>format C:\
Attack dogs, preferably rabid.
Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.)
Don't put your pages on the web.
See also the alt.html micro-faq: http://hyweljenkins.com/support/mfaq.htm #1, #2, #6, #19, #20, #22 & #36.

Ok, that was a bit of fun. Here's the real lowdown on hiding your source code:

It can't be done.
The only truly effective method in the list above is #10.

While it is possible to make it difficult for people to view your source code, you cannot stop someone who really wants it. It has been suggested that using javascript to disable right-click or encrypting the HTML may be effective. It is far more likely that employing these easily circumvented techniques will only encourage people to "steal" your code. In all probability, they don't want it until you tell them they can't have it.

For example: Here is page- http://prestigiousdames.com/char/57_chevy -where the author is laboring under the misapprehension that employing all manner of legitimate-user-infuriating scripting tricks will prevent their page from being copied/edited/distributed. They have attempted to encrypt the source, intercept right-clicks, left-clicks and various keyboard commands and have, of course, most conspicuously failed. The only thing this author has succeeded in doing is to create a page that presents serious obstacles to legitimate users and one that will crash many commonly used browsers. A simple snippet of javascript defeats all of this foolishness in under two seconds:

javascript:(function(){ function htmlEscape(s){s=s.replace(/&/g,'&');s=s.replace(/>/g,'></g,'<');return s;} x=window.open(); x.document.write('>');s=s.replace(/pre>' + htmlEscape('\n' + document.documentElement.innerHTML + '\n')); x.document.close(); })();

To use this javascript simply right-click the following link and select "add to favorites": Reveal Generated Source (Use IE5.0 or greater)

Now point your browser at http://prestigiousdames.com/char/57_chevy and once the page is displayed, go to the bookmark you just made. All of the encryption is stripped out leaving a clean copy of the HTML source to do with as you see fit. Images from the page may be saved by dragging them from the page into a local folder, or by going directly to their individual URLs.

The point of this little demonstration is that there are a number of ways to protect your works from unauthorized distribution. Creating crippled pages with easily defeated script-kiddie hacks is not one of them.

Beware, there are individuals and companies that sell HTML "protection" to the naive. These are nothing more than scams; don't get taken for a ride.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now