| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Member Join Date: Aug 2003 Location: Ontario, Canada
Posts: 98
![]() | Best Way to Keep Source Hidden Ok, here is what you do for the best possible defense against annoying source stealers - First, add this to the page you want to protect or link your files to an external JS file: <SCRIPT LANGUAGE="JavaScript"> <!-- document.oncontextmenu = function(){return false} if(document.layers) { window.captureEvents(Event.MOUSEDOWN); window.onmousedown = function(e){ if(e.target==document)return false; } } else { document.onmousedown = function(){return false} } if (self.location == top.location) { top.location.replace("index.htm"); } //--> </SCRIPT> After you have that, put your pages in a frames page (if you are worried people won't support frams then you are outta luck), and that will stop basic stealers. There are still ways to view the source so, to stop that - 2 more steps. To stop newbs put this at the top of every page or write it in with a server side script: <!---------------------------------> <!---------------------------------> <!-- Information Secure --> <!---------------------------------> <!---------------------------------> [ Add 2600 Enter Keys here] ????: NamePros.com http://www.namepros.com/code/15099-best-way-to-keep-source-hidden.html Most people will close the window at first glance because on any resolution, the scrollbar is the smallest it goes. And, for the final precaution, submit the sensitive part of your source code to the form in the following page. http://www.angelfire.com/ny5/consigliere/encrypter.html Happy Programming! P.S this way is not foolproof, since data is stored on the clients computer in the temporary internet files folder, there is no true way to save your source code.
__________________ Yeah... I knew that. What? |
| |
| | #3 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | It's not possible to hide the source code that displays the html output to the browser. You can attempt to make it harder to get, but I think it's all really a waste of time because if someone really wants it they will get it. The only thing you can really do is make your entire webpage an application that doesn't rely on a browser like an applet or something if you don't want anyone to be able to access any of your source code. |
| |
| | THREAD STARTER #4 (permalink) | ||||
| NamePros Member Join Date: Aug 2003 Location: Ontario, Canada
Posts: 98
![]() | Re: Best Way to Keep Source Hidden
__________________ Yeah... I knew that. What? | ||||
| |
| | #6 (permalink) |
| NamePros Member Join Date: Jun 2003
Posts: 103
![]() | kinda off topic, but can you see the php code in the temp folder or wherever that stuff is stored?
__________________ http://www.falloutweb.com |
| |
| | #9 (permalink) |
| NamePros Member Join Date: Jan 2003
Posts: 117
![]() | back to the source code hiding, i feel, personally, that that is dirty. afterall, me, you, and your best friend barry all learned from source, and there's nothing really all that important in the source itself. you can grab the html, javascript, css, and photos and little more. of any of these, the only one that i can find even a remote reason to want to keep out of other people's hands is the photos. if you're that worried about them, put a watermark on them, your url in a noticeable place, and a copyright. (even if you use a script to cover up your photos, there's always that pesky prnt scrn button.) in closing, my icons still rock the casbah: :crabby: :angry: :confused2 :webdev: |
| |
| | #10 (permalink) |
| NamePros Member Join Date: Oct 2003
Posts: 134
![]() | I accually encourage people to veiw my source code. It makes a good tutorial. All my source code is free to the public. I don't know. I was born and raised to the tune of the gnu or whatever freesource linux has. I hold that to everything I do. Not sure why. But yea if someone does take my layout I might be a lil pissed. But if they use the graphis that's where I draw the line. Hotlinks are delt with by law, that's right, law. And then people who upload the images to their server should watch out. I'm working with a friend to build a program to seach for data that matches the data you want. oh yes... It will be ultimate. ????: NamePros.com http://www.namepros.com/showthread.php?t=15099 (so far the data search is in the lab being built, having trouble with making into a server app that anyone can run)
__________________ Can you tell ADD has OOO pretty butterfly! |
| |
| | #12 (permalink) |
| New Member Join Date: Dec 2003
Posts: 20
![]() | Yeah, I sure can. Here's a quick tip.... clear your browser cache. Reload a page, open the browser cache, and open the file you want to look at. Takes about 30 seconds. There is no way to "protect your html/javascript sourcecode" aside from irritating people. ????: NamePros.com http://www.namepros.com/showthread.php?t=15099 And from a usability standpoint, you should never try to block the right click of a browser. That has got to be the biggest waste of time. I right click for a number of things on different webpages and when I see that stupid little popup that says "Copyrighted" or whatever, that usually only makes me want to take it even though I originally just right clicked to print an article, or open a new window or something. Just my 2 cents. |
| |
| | #13 (permalink) | ||||
| NamePros Admin ![]() ![]() ![]() Join Date: Feb 2003
Posts: 12,919
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
What about these programs that claim to encrypt your html or javascript?
__________________ Reach me at rj at namepros dot com | ||||
| |
| | #14 (permalink) |
| New Member Join Date: Dec 2003
Posts: 20
![]() | None of them REALLY encrypt anything because they include the encryption key in plain view for anyone with more than a fundamental knowledge of how a webpage works. On another note, "encrypting" a webpage is dangerous because from what I've seen, it all relies on the uneccessary use of Javascript, which as you know, is disabled in 10-15% of all internet browsers. Prevent 1 out of 10 from being able to view your page so that you can prevent 1 out of 50 visitors from viewing your source code? Doesn't make any sense to me. ![]() ????: NamePros.com http://www.namepros.com/showthread.php?t=15099 If you've got something that private, or valuable, the internet (in general) is not the right medium to publish it in the first place. |
| |
| | #15 (permalink) | ||||
| Senior Member Join Date: Jun 2003 Location: Naperville Illinois
Posts: 1,786
![]() ![]() ![]() ![]() | If you don't want people to steal: Make a flash website!
__________________
| ||||
| |
| | #16 (permalink) | ||||
| NamePros Admin ![]() ![]() ![]() Join Date: Feb 2003
Posts: 12,919
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
http://www.webdesigntalk.net/showthr...threadid=15801
__________________ Reach me at rj at namepros dot com | ||||
| |
| | #19 (permalink) |
| NamePros Regular Join Date: Dec 2003 Location: The Beach
Posts: 584
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | there are many flash rippers/decoders out there already, some you can even get off sourceforge with ease. Best way is to just obfuscate your code to give whoever's reading a hard time ![]() But it'd probably be best to just let the source code be. As mentioned above, it may not really be a bad thing at all for people to see your source code. And if you really needed to hide it, the above methods would be good enough; although if you're dealing with more savvy users, there's no point in going through the trouble. Maybe just swallow hard and share it.
__________________ Newsback.com -- Commentary and backstories of the news ----------------------------------------------- |
| |
| | #20 (permalink) |
| NamePros Regular Join Date: Feb 2004 Location: Meadville
Posts: 640
![]() ![]() ![]() | My favorite method du jour is to telnet to port 80 Code: <!--
Congratulations, you've found the source code
!
Your mind is sharp. Your virtual limbs are strong. You've
attained a measure of
wisdom to be able to solve this puzzle,
my friend. You are now ready to hear wha
t I have to tell you.
You must tread the path of foolishness to become wise. The
foolishness of hiding source code teaches a lesson of
futility. To gleefully fl
ail against the inevitable, to put
aside the fact that File>Save Page As... defe
ats even the
most cunning design with a simple stroke of the digital
blade, is t
o face a a brick wall and pretend to beat your
head against it, and when you're
done, to have learned all
the same lessons that you would have learned if you re
ally
had beat your head against it, but without the discomfort and
embarassment
of it all.
Some tips for the road:
1. To go directly to the source code of any w
eb URL,
type the URL preceded by view-source: For example
view-source:
http://www.drpeterjones.com/
2. To discourage viewing of your JavaScript, place
it in an external .js file and load it into the
page with the <script s
rc=""> method.
3. One way for artists or photographers to discourage
their
copyrighted images from being saved is to
embed the images in Flash. Remem
ber, it will only
discourage, not prevent.
4. As mentioned above, File > Sa
ve Page As... will
Grab the source and any associated files of a web
pa
ge and save the files to disk for easy viewing.
-->
<html><head><title></title>
<!-
- it redirects if you turn off JavaScript -->
<noscript><meta http-equiv="refresh
" content="0;url=p.html"></noscript>
<!-- you can't look at just this page. it al
ways jumps to frameset -->
<script language="javascript"><!--
if (top.frames.lengt
h == 0) top.location = "hidden.html";
//--></script>
<style type="text/css"><!--
/*
'glass' is an image that layers over top of the doc,
giving the wrong context m
enu in some browsers. */
#glass{position:absolute;left:0;top:0;}
.big{font-size:70
pt;font-weight:bold;}
body{font-size:17pt;}
--></style></head><body bgcolor=
"#000000" text="#ffffff" link="#0000FF" alink="#FFFF00" vlink="#999999" topmargi
n="10" leftmargin="10" marginheight="10" marginwidth="10">
<script language="java
script"><!--
// no explanation needed
function disable_right_click(e) {
var browser
= navigator.appName.substring (0,9);
var event_number = 0;
if (browser=="Microsof
t") event_number = event.button;
else if (browser=="Netscape")
event_number = e.wh
ich;
if ( event_number==2 || event_number==3 )
{ alert ("Please..."); return (fals
e); }
return (true);
}
// sniffs for key that activates context menus
function check
_mousekey() {
var mouse_key = 93;
var keycode = event.keyCode;
if ( keycode == mous
e_key )
alert ( "Well, well... looks like somebody did their homework." );
}
// sel
f explanatory
function trap_page_mouse_key_events() {
var browser = navigator.appN
ame.substring ( 0, 9 );
document.onmousedown = disable_right_click;
if ( browser =
= "Microsoft" )
document.onkeydown = check_mousekey;
else if ( browser == "Netscap
e" )
document.captureEvents( Event.MOUSEDOWN );
}
// self explanatory
window.onload
= trap_page_mouse_key_events;
// resizes glass.gif to cover entire screen
if (docu
ment.body.clientWidth) {
var xxx = document.body.clientWidth;
var yyy = document.b
ody.clientHeight;
}
else if (window.innerWidth) {
var xxx = window.innerWidth;
var y
yy = window.innerHeight;
}
else {
var xxx = 2000;
var yyy = 2000;
}
if (xxx < 481) xxx
= 481;
if (xxx < 292) xxx = 292;
document.write("<div id='glass'><img src='glass.
gif' width='" + xxx + "' height='" + yyy + "'></div>");
function relode() { locat
ion.reload(); }
window.onresize = relode;
// yet another event handler
document.onc
ontextmenu = function() { return false; }
//--></script>
<!-- actual page content
-->
<font color="#ffffff">
<br><br><br>
<div align="center">
<div class="big">Try to
get it!</div>
<br><br><b>
Snag that pesky source code.
</b>
</div>
</font>
</body>
</h
tml> |
| |
| | #21 (permalink) |
| NamePros Expert Join Date: Dec 2003 Location: NYC
Posts: 9,132
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Well, at least I learned something from this thread -- that view-source:http://www.whatever.com/ thing is useful in IE! |
| |
| | #23 (permalink) |
| NamePros Regular Join Date: Sep 2004 Location: Poland
Posts: 245
![]() | The view-source: trick works in Netscape as well... Wow!!!
__________________ Dropcatcher.de - .de domain dropcatching! |
| |