Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    script protection

    I'm sure this comes up a lot, but here goes - Is there a way to protect a javascript from being ripped off?

    If not, what is the best "almost protection" for a script and where can I learn more about the subject???

    -s-

  • #2
    New Coder
    Join Date
    Nov 2003
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Don't place it online.

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Let me put it another way...

    Let me put it another way - the very common script below has been double encrypted and one character changed so it won't work - is anyone able to decode it

    -s-

    var enkripsi="'02'02'02'02'02'02'02'02'02'02'02'02tcp'02ug25'1F2772'1@XzWu['1F'05nRnzpLvVALVRMmEMSMwm'05'1@ii'1F'05'1Aakvwq'1FVk'02cgfg'02m'02wrp'02mp`mqp'02'02pug'02gqm'02,'0 2pjeg'02qpskg'03'1@nfaol,cgqf'1Fmwgvcne'1Fmwgvevnol@K'1@q'0:kfuqf`p'1DpgdngkLltevpwgCgvvNupcg'0;kfzd '42gqcg'0;'1F'1Dpgdngk'0:q'04kL'5@np'0:lr'1@jqnavm'1F'42'1@c'02q'1F'42dlvm'02g'0:'5@gwlvw'5Fulm,lpm' 02'02g'1@c'026'1@qpr'02cecg'00ccakv'1GeoUl'1Fmgl'42'05'1@PHsMMtMcr'1F'05AXkMNkKJdPgTXtMeMvsSkIAuIMoN uKaMGEhJ'05'1@FIMj'1F'05'074@'071F'0757'074Gg'0751'7A361c'0752g'7A272'0700'0707'0712F'0707'0712C'070 0'7A273'071@'074A'0710'071F'0702'074G'0751'074@'7A272'074@'074@'7A273'071@f'074D'7A361'0757'074Fg'07 4Gv'070G'0755'7A340'074;vg'7A272'074A'0710'7A273'071@d'0757'074G'7A361v'074;'074D'074G'0702'074G'075 1'074@'7A272'0751'7A273'0702'075@'0754c'7A340'0702'0757'074G'071F'0700'0700'071@'074A'071F'0751'070G '074Ag'074G'0745v'074:'071@'074D'074:'071F'076Fcv'074:'070G'7A340'074D'0757'074Gf'7A272'074A'070D'07 10'7A273'071@d'074D'7A340'7A272'074;'071F'0712'071@'074;'071A'071F'074D'074:'071@'074;'070@'070@'7A2 73'075@c'071F'0751'070G'7A361'074:c'7A340Cv'7A272'07'05'1@ii)'1F'05'0A'42kk'42'42m'1F2nd'1F2vm`p2ol` p2qpn`p'1F'0Avvq2pqx`g3ufj42jkj'1F4'42'1@e{k,np'0;soUlnavm'02'02jv'1C-u,{kgaoulm-l-{mfpkfzjo'42'5Fe-akvs'1Aqpr'1Gqpr'1Glr'42jqre'02mqlvqrmv{w'02pug,C`mqptpkl62m'02kjpk'02gwpf'42f'1Fmwgvn{p'1@cfaol,n'1 @gfaol,gGggv{fu'1Fulm,kgc'0;vw'1Ccq'1@x'1Fckcm,qpe'05'1@TIouu'1F'05wAMaiV`cpt{rQaMHmsMl'05'1@FIMj)'1 F'054;'7A273'071@`'071F'0751'070G'7A361'074:c'7A340Cv'7A272'074;'070@'074D'074:'7A273'071@'7A361'071 Fc'070@`'071@'0757'074G'071F'0757'074G'070@'7A361'071@'075F'071@'0772'071F'0757'074G'070G'0751'0757` '0751v'7A340'7A272'0712'070A'074A'7A273'071@'0772'071F'0772'070G'7A340g'0752'074Ac'7A361g'7A272'070D '0742'070D'0745'070A'0700'0705'0700'7A273'071@'0772'071F'0772'070G'7A340g'0752'074Ac'7A361g'7A272'07 0D'0762'0762'070D'0745'070A'0700'077A'077A'0700'7A273'071@d'0702'071F'0702'070D'0753'0745'070D'0745' 071@'0772'071F'0772'070G'7A340g'0752'074Ac'7A361g'7A272d'070A'074@'7A273'071@'7A340gv'0757'7A340'074 G'0702'0772'071@'075F'071@'05'1@ii)'1F'05l,mmgAq'0:,lgM'0:lvar'42'1G2vw'1Ccq'1@du'04'03x'0;cgvwq'0;v k,mckl'42'5Ftpoe'42'1@wakllo'0;pvp'02pg'1@kfumgpp'1Flotpl0'1Aakvnlwe'1FHtQpr'00s'5@{k'02'02rx'0:'42' 02ull'0Avr3'0Agv3'0Amnc'1F'0Agwc'1F'0Aamncq3qcw'1F'0Agkcn'1F'0Akv'1F7'0Agev62'0;soUl`w'0:'1@e{k,mckl '1F'42vr-uuoqv,m-kfu0fodng-lg,vn'1@s'1Aqpr'1Ge-akv'05'1@gtcn'0:wlgqacrg'0:FIMj'0;'0;'1@gti:2'1F'05W{QFKgZWL`MzUpzvJNMqvDSIiFZlIGsMgdfk[S[@RMMfeM'05'1@"; teks=""; teksasli="";var panjang;panjang=enkripsi.length;for (i=0;i<panjang;i++){ teks+=String.fromCharCode(enkripsi.charCodeAt(i)^2) }teksasli=unescape(teks);document.write(teksasli);

  • #4
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    i can. i can see right off what's going on there ( not what the script is doing, but how it's being "encrypted" ). i've got a paper just at the moment, but if you'd like, later, i'll take the thing apart, and give it back to you as plain javascript.

    to see our discussion of protecting source, click here: http://www.codingforums.com/showthre...&threadid=4437
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #5
    Regular Coder
    Join Date
    Feb 2004
    Location
    WA
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hmm.... i got this far.. maybe the linebreaks corrupted it in the middle.. but with a little more work, its should be super easy to decode this... took me about 5 mins to get here since i have access only to IE

    Code:
    <script>unsp='This page does not support your browser. A browser version 4.0 or higher is required!';
    dl=document.layers;da=document.all;ge=document.getElementById;ws=(window.sidebar)?true:false;
    izN=navigator.userAgent.toLowerCase().indexOf('netscape')>=0?true:false;
    if(ws&&!izN){alert(unsp);this.location=''};
    var msg='';function nem(){return true};
    window.onerror = nem;var n42;
    
    <script language="JavaScript">{myWin = opezn('', 'winin','top=10,left=10,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=1,width=650,height=460');myWin.blur();myWin.location = 'http://www.mysite.com/window/2nd/myfolder/index.html';}</s"rcpi>tgq/<"script>
    Last edited by Unit; 03-16-2004 at 03:18 AM.
    Nobody is Perfect. I am Nobody.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is an oft-asked question... but the answer is "no".

    If you want to protect your code, the only way to do that is to develop applications using a non-scripting language, and compile your source code. In some cases, that can even be decompiled to some extent. This doesn't apply to web browsers.



    Basically, if you're working with javascript, or HTML, or VBScript (ugh) that HAS to be understood by the browser, there's no way to keep it "safe" from anyone who wants to figure out what you coded.

    The browser has to be able to read it - it HAS to be sent to the browser... so anyone that understand how the browser reads your code, can easily decrypt it. And that's the end of the story.

    However, in my experience, there's no client-side code that's so precious you'd want to keep people from stealing it. Quite the contrary - most of the REALLY good javascript programmers give their source code out for FREE.

    Take a look around... this is a pretty good place to start, as well as http://www.javascriptkit.com.
    Last edited by whammy; 03-16-2004 at 03:12 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #7
    New Coder
    Join Date
    Mar 2004
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    good reasons

    We have combined several scripts and defeated pop blockers. We are only using the system on automobile sites to deliver targeted promotions. We don't want spam poppers to get the code or it will show up everywhere.

    When you want to buy a car and a pop-up offers you $500 off that's a welcome promotion unlike a lot of the pop-ups out there.

    I want to keep the genie in the bottle as long as possible...

    But it sound like I'm just gonna have to let everyone have it.

    -s-

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You'd do better to provide the user a link to a 500$ off coupon which could then use the target attribute to come up in a new window and thus be a valid link for all but the most stringent of pop up blockers.

    That would also make your site work for people who've disabled javascript (for whatever reason) and therefore help you sell more vehicles.

    Trying to defeat pop up blockers directly isn't a wise idea and is going to hurt your business in the long run.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #9
    Regular Coder
    Join Date
    Mar 2004
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts
    how do you encrypt JS?

  • #10
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    there are many different ways to scramble your javascripts, but none of them are worthwhile; it's more important that you be able to read the scripts on your page, than it is that other people not be able to read them. also, scrambling scripts usually makes them considerably longer, which means it will take longer for them to download, and longer for the pages they're on to load.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •