|
|
 |
| Javascript How-To Ask your "How do I do this with Javascript?" questions here. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript How-To section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

June 29th, 2005, 03:15 AM
|
|
Authorized User
|
|
Join Date: Jul 2003
Location: , , .
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How to encrypt Javascript?
I put a Javascript into a JS file,and refered it in a HTML file.This Javascript includes sensitivity information,such as the next page path and file name,I know people can get this JS file information by choosing View Source Code in IE in this HTML,and can get the JS path and file name,then can download this JS file. How to protect the JS file?
Any idea will be appreciated!
|

June 29th, 2005, 09:16 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,697
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Use a packer.
http://dean.edwards.name/packer/
It'll collapse the whitespace, and minimize the file size. As an added bonus it also obfuscates the code.
For example:
var file = '/my/sensitive/path';
Will still be there, albeit much more difficult to find or make sense of. In fact here is the output of that line using Dean Edward's packer:
Code:
eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[(function(e){return d[e]})];e=(function(){return'\\w+'});c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('4 2=\'/0/1/3\';',5,5,'my|sensitive|file|path|var'.split('|'),0,{}))
There is a minimal amount of output that this will generate, so it works better for large, more complex scripts, as far as the packing goes.
HTH!
Regards,
Rich
--
[ http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
|

June 29th, 2005, 11:13 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 2,922
Thanks: 0
Thanked 13 Times in 12 Posts
|
|
Remember that you can't hide it from a determined user. If it's that sensitive you'll have to find a better technique. At the end of the day anything that is rendered by a browser is accessible to the user.
--
Joe ( Microsoft MVP - XML)
|

October 4th, 2006, 11:59 PM
|
|
Registered User
|
|
Join Date: Oct 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
What about ufmxgrlm()
Quote:
|
quote:eval('(ufmxgrlm(){ezi W,K,FZ=mzertzgli.fhviZtvmg,rh_tvxpl=/tvxpl/r.gvhg(FZ)...
|
|

October 24th, 2006, 08:11 AM
|
|
Authorized User
|
|
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
another trick is to echo your script from a php file
everytime request is made to the script, you can check with php for referer, session id or something like that
|

July 21st, 2008, 09:57 AM
|
|
Registered User
|
|
Join Date: Jul 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Try with this utility: http://utenti.lycos.it/ascii2hex
It's really hard to disassemble the code, and it works only in the page you specify during encryption. :)
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Encrypt Data |
Brendan Bartley |
Access |
2 |
April 29th, 2008 09:30 AM |
| encrypt and decrypt |
fuadlutfi85 |
Pro JSP |
0 |
July 5th, 2007 10:00 PM |
| encrypt database |
skajani |
ASP.NET 1.0 and 1.1 Professional |
1 |
August 7th, 2006 03:48 PM |
| About Column Encrypt |
jabby |
SQL Server 2000 |
2 |
November 30th, 2004 11:57 AM |
| Encrypt data |
Ned |
SQL Server 2000 |
1 |
February 4th, 2004 12:08 AM |
|
 |