The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Invoke(UFicle): Hiding 'code' from website. . . by Sieldan2007-05-09 10:50:26
  I'm pretty sure you can't. by bwkaz 2007-05-09 11:00:46
If it's javascript, it's open for the world to see, period. If it wasn't, then the browsers wouldn't be able to execute it.

Of course, you can use any of several thousand "obfuscation" routines, where you take your JS code and encode it into a long string (which then looks like "AB54377dgfxbGADS" or whatever, just longer). Then you'd pass that string to a decoding function and either evaluate the result, or just write it to the document. But then you're still using JS to decode it, and it's easy to figure out what the "plain" code is if you want it. If someone's looking to duplicate this functionality, your code is wide open to them no matter how you encode it -- or even if you encrypt it.

(Because you have to decrypt it to run it. And it's easy enough to modify the HTML and add <textarea> tags around the decoding code to get the decoded version out.)

(This kind of encoding-the-script stuff is used by script kiddies all the time. It's their way of getting around virus scanners, because even if the decoded JS is the same, the encoded version is probably different for each kiddie -- and AFAIK most browsers don't write the decoded version out to disk. But it's still really easy to decode most of them, if you want to see what their code is really doing.)

No, the only way to completely prevent people from getting their hands on the code is to run it on the server.
[ Reply ]

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)