Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to Hide your Source Code!  (Read 9083 times)

0 Members and 1 Guest are viewing this topic.

zahid

    Topic Starter


    Starter

    How to Hide your Source Code!
    « on: November 30, 2008, 06:02:30 AM »
    Hello,

            Friends i want to hide my source so can it possible ?????


    Thanks & Regards,
    Zahid From Pakistan

    ChrisXPPro



      Adviser

    • Forever Learning
    • Thanked: 4
      • ACB Systems
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows XP
    Re: How to Hide your Source Code!
    « Reply #1 on: November 30, 2008, 10:35:16 AM »
    Most right click protect routines are not bullet proof ... particularly these days with all the browser add ons available.

    I have a  very old script shown below which I had tucked away - maybe play with that.

    Code: [Select]
    <html>
    <head>
    <title>No-Right-Click-Script without Ugly Alert-Box</title>

    <meta NAME="keywords" CONTENT="DHTML, JavaScript, right, click, code, Dynamic HTML, download, free, samples, applet">

    <meta NAME="description" CONTENT="This little script prevents people from stealing your HTML-code or your
    images by clicking on the right mousebutton. This script will NOT open an ugly alert-box! In fact it does nothing
    at all besides displaying a little message on the status bar. Try right clicking anywhere inside this document in
    order to test the script. No configuration needed. Pure copy-and-paste. Crossbrowser.">

    <script>
    <!--
    // CREDITS:
    // No Right Click Script without Ugly Alert-Box
    // by Urs Dudli and Peter Gehrig
    // Copyright (c) 2000 Peter Gehrig and Urs Dudli. All rights reserved.
    // Permission given to use the script provided that this notice remains as is.
    // Additional scripts can be found at http://www.24fun.com/fast/index.html
    // [email protected]
    // 10/12/2000

    // IMPORTANT:
    // If you add this script to a script-library or a script-archive
    // you have to insert a link to http://www.24fun.com/fast/index.html
    // right into the webpage where the script will be displayed.

    // CONFIGURATION:
    // Go to http://www.24fun.com/fast/index.html, open category 'utility' and
    // download the script-file with step-by-step instructions for easy configuration

    function right(e) {
    if (document.layers && (e.which==3 || e.which==2))  {
    window.status="NO RIGHT CLICK ALLOWED!"
    return false;
    }
    else if (document.all && (event.button==2 || event.button==3)) {
    window.status="NO RIGHT CLICK ALLOWED!"
    openclosewindow()
    return false;
    }
    }

    function openclosewindow() {
    var windownews=window.open("", "", "status=no,location=no,toolbar=no,menubar=no,resizable=no,scrollbars=no,width=50,
    height=50,
    top=20000,left=200");
    windownews.close()
    }
    if (document.all) {
    document.onmouseup=right;
    window.onmouseup=right;
    }
    if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=right;
    }
    //-->
    </script>

    </head>

    <body>
    <form>
    <font size=1 face=Verdana color=000000><ul><b>No Right Click Script without Ugly Alert-Box</b><br><br>
    This little script prevents your visitors from stealing your HTML-code or your images by clicking on the right mouse
    button. This script will NOT open an ugly alert-box. In fact it does nothing at all besides displaying a little message
     on the status bar. Try right clicking anywhere inside this document in order to test the script. Crossbrowser.
    No configuration needed. Pure copy-and-paste.<br><br><br>

    <script src="http://www.24fun.com/affiliates/textinfospacemany.js"></script><br><br>

    <b>Configuration:</b><br><br>
    Add the following code between <b>&lt;head&gt;</b> and <b>&lt;/head&gt;</b> of your webpage:<br>
    <input type=button onClick="this.form.code1.focus();this.form.code1.select()" value="select all" style="font-size:8pt"><br>
    <textarea name="code1" cols="70" rows="10" style="font-size:8pt">
    <script>
    <!--
    // CREDITS:
    // No Right Click Script without Ugly Alert-Box
    // by Urs Dudli and Peter Gehrig
    // Copyright (c) 2000 Peter Gehrig and Urs Dudli. All rights reserved.
    // Permission given to use the script provided that this notice remains as is.
    // Additional scripts can be found at http://www.24fun.com/fast/index.html
    // [email protected]
    // 10/12/2000

    // IMPORTANT:
    // If you add this script to a script-library or a script-archive
    // you have to insert a link to http://www.24fun.com/fast/index.html
    // right into the webpage where the script will be displayed.

    // CONFIGURATION:
    // Go to http://www.24fun.com/fast/index.html, open category 'utility' and
    // download the script-file with step-by-step instructions for easy configuration

    function right(e) {
    if (document.layers && (e.which==3 || e.which==2))  {
    window.status="NO RIGHT CLICK ALLOWED!"
    return false;
    }
    else if (document.all && (event.button==2 || event.button==3)) {
    window.status="NO RIGHT CLICK ALLOWED!"
    openclosewindow()
    return false;
    }
    }

    function openclosewindow() {
    var windownews=window.open("", "", "status=no,location=no,toolbar=no,menubar=no,resizable=no,scrollbars=no,width=50,
    height=50,
    top=20000,left=200");
    windownews.close()
    }
    if (document.all) {
    document.onmouseup=right;
    window.onmouseup=right;
    }
    if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=right;
    }
    //-->
    </script>
    </textarea>

    <br><br>

    <a href="http://www.24fun.com/fast/index.html" target="_blank">>>> Download 100's of free funscripts</a>
    </form>
    </body>
    </html>
    « Last Edit: December 31, 2008, 08:39:41 AM by ChrisXPPro »
    Ain't technology great - until it goes wrong!

    fffreak



      Adviser

    • That's right I am a final fantasy freak.
    • Thanked: 3
      • Yes
      • JSPCRepair
    • Certifications: List
    • Experience: Guru
    • OS: Windows 7
    Re: How to Hide your Source Code!
    « Reply #2 on: December 29, 2008, 03:07:10 PM »
    You can always use encryption/encoding, course it's not totally cracker proof but it will sustain the normal mundane user from stealing your source code. The No-Right-Click function is mostly used to stop people from right clicking on images and stealing them, people can still access your source code by going through the Navigation bar of most browsers((IE):View->Source). Of course that method of trying to block people from stealing images is not fully cracker proof either, for anyone that can read a little HTML code. But look into encryption/encoding, I made my own sort of encryption with a combination of Ascii and my own method in Javascript, of course I'm not going to show you that source code ;). But Ascii encryption is the most common method and will prevent the normal mundane user from stealing your code, just do a google search of "Ascii Encryption HTML", or something along the lines of that. That should help!
    Computers are the future, not us. Learn everything you can about them while you still can, soon they will be learning about us... Every bit of advice that I give you is best guess, it is your choice whether or not you listen to it.

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: How to Hide your Source Code!
    « Reply #3 on: December 29, 2008, 04:23:37 PM »
    encryption is NOT obfuscation. converting text to the equivalent HTML character code (&#65; etc...) is obfuscation. The same method used to create the ASCII equivalents can be used to reverse the process quite easily.


    security by obfuscation is not security; it's just foolishness.
    I was trying to dereference Null Pointers before it was cool.

    fffreak



      Adviser

    • That's right I am a final fantasy freak.
    • Thanked: 3
      • Yes
      • JSPCRepair
    • Certifications: List
    • Experience: Guru
    • OS: Windows 7
    Re: How to Hide your Source Code!
    « Reply #4 on: December 29, 2008, 04:33:31 PM »
    encryption is NOT obfuscation. converting text to the equivalent HTML character code (&#65; etc...) is obfuscation. The same method used to create the ASCII equivalents can be used to reverse the process quite easily.


    security by obfuscation is not security; it's just foolishness.

    Like I said, it is not cracker proof meaning anybody who knows how to convert Ascii back to the original HTML code that we as users can read, can easily steal and use the source code, There is no actual way to hide the source code of an HTML document. So if you have a better method of making the source code of an HTML document more read proof, because you obviously cannot hide it, than have at it. And believe it or not it's not foolishness, it does prevent the everyday web designer who has basic web designing skills from reading through the Ascii code and taking what they may want, plus there is a lot of people who out of pure laziness, don't even want to go through the process of converting Ascii back to HTML text. Like I said, I also use my own method of encryption through a combination of Javascript and Ascii. There is no fool-proof way to hide the source code though, so if you think you have a better solution than please do tell ;).
    Computers are the future, not us. Learn everything you can about them while you still can, soon they will be learning about us... Every bit of advice that I give you is best guess, it is your choice whether or not you listen to it.

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: How to Hide your Source Code!
    « Reply #5 on: December 29, 2008, 10:29:50 PM »

    I've seen it used effectively. It could easily be applied at most sites with no worries.

    Another method is to place most Source code within separate JS and VBS files, placed in a separate folder. (or anywhere, really). while the browser downloads the
     scripts along with all the rest of it, it can be more difficult to search through a cache
    for a temporary file when you only know the extension.

    I wasn't saying anything against your methods; I was merely saying that, as you said, there isn't a built-in way to do encryption up to and including page interpretation; the best we can do is make it difficult, which is usually enough. the question inevitably comes up as to wether it's worth it, and that depends wholly on the code being obfuscated.

    Another wholly different route would be to try to place all code possible on the server-side; permissions can be set to completely disallow access to the code
    I was trying to dereference Null Pointers before it was cool.

    fffreak



      Adviser

    • That's right I am a final fantasy freak.
    • Thanked: 3
      • Yes
      • JSPCRepair
    • Certifications: List
    • Experience: Guru
    • OS: Windows 7
    Re: How to Hide your Source Code!
    « Reply #6 on: December 30, 2008, 08:59:27 PM »

    I've seen it used effectively. It could easily be applied at most sites with no worries.

    Another method is to place most Source code within separate JS and VBS files, placed in a separate folder. (or anywhere, really). while the browser downloads the
     scripts along with all the rest of it, it can be more difficult to search through a cache
    for a temporary file when you only know the extension.

    I wasn't saying anything against your methods; I was merely saying that, as you said, there isn't a built-in way to do encryption up to and including page interpretation; the best we can do is make it difficult, which is usually enough. the question inevitably comes up as to wether it's worth it, and that depends wholly on the code being obfuscated.

    Another wholly different route would be to try to place all code possible on the server-side; permissions can be set to completely disallow access to the code

    Yes you are right about that, but don't forget that's not fool proof either, someone can easily read through the source code, find out what the names of the script files used on the web page, and open up their temporary internet files and view the source of the scripts that way as well. Plus you cannot encrypt the source code of the scripts when you save them seperately as their own file. I don't really think the poster wants to totally disallow access to the files using permissions on their web server, I'm pretty sure they want the files visible to a user when they pull up their site, I think that's why they asked if there was a way to hide the source code. But I still believe best way to do so, is to encrypt the source that way it makes it difficult for a web designer to pull what they want from the source code of the HTML document. That's just my opinion of course though ;).
    Computers are the future, not us. Learn everything you can about them while you still can, soon they will be learning about us... Every bit of advice that I give you is best guess, it is your choice whether or not you listen to it.

    soybean



      Genius
    • The first soybean ever to learn the computer.
    • Thanked: 469
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 10
    Re: How to Hide your Source Code!
    « Reply #7 on: December 30, 2008, 09:06:33 PM »
    ChrisXPPro, can you edit your first post and split up those long lines that are causing a need for massive horizontal scrolling to read the posts in this thread?

    ChrisXPPro



      Adviser

    • Forever Learning
    • Thanked: 4
      • ACB Systems
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows XP
    Re: How to Hide your Source Code!
    « Reply #8 on: December 31, 2008, 08:40:43 AM »
    Wow - sorry about that - I guess I hadn't checked that out when I posted!  I hate the horizontal scroll too - fixed it now.
    Ain't technology great - until it goes wrong!

    michaewlewis



      Intermediate
    • Thanked: 26
      • Yes
      • Yes
    • Experience: Expert
    • OS: Unknown
    Re: How to Hide your Source Code!
    « Reply #9 on: December 31, 2008, 03:47:32 PM »
    You could encrypt your sourcecode.........
    http://www.dynamicdrive.com/dynamicindex9/encrypter.htm

    kpac

    • Web moderator
    • Moderator


    • Hacker

    • kpac®
    • Thanked: 184
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: How to Hide your Source Code!
    « Reply #10 on: January 01, 2009, 06:38:36 AM »
    But it can be decrypted again...

    Let's face it, there is no actual way to hide the source code.

    Quote
    You can't. The browser needs the HTML to render the page and there is no way to disable the view source item in the menu. And no-right-click scripts are dishonest, show arrogance, and are worthless because a view source item is usually in the Edit menu, which does not need to be right-clicked.

    http://www.webdeveloper.com/forum/showthread.php?t=89947
    http://www.programmingtalk.com/showthread.php?t=21985

    michaewlewis



      Intermediate
    • Thanked: 26
      • Yes
      • Yes
    • Experience: Expert
    • OS: Unknown
    Re: How to Hide your Source Code!
    « Reply #11 on: January 02, 2009, 11:04:11 AM »
    sure, it can be decrypted, but when someone looks at the source, they'll just close it and move on. Personally, I don't see why anyone would really want to hide their html source..... It's just a waste of time and it isn't even real programming. If you're doing something in your code that requires everything to be hidden, use server side scripting like php or aspx instead.

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: How to Hide your Source Code!
    « Reply #12 on: January 02, 2009, 11:07:06 AM »
    and it isn't even real programming.

    This is an important point.

    HTML is not a Programming language. It's a markup language.
    I was trying to dereference Null Pointers before it was cool.