00:00
00:00
Newgrounds Background Image Theme

SourJovis just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

AS: Copy Protection

13,444 Views | 15 Replies
New Topic Respond to this Topic

AS: Copy Protection 2005-09-06 05:01:16


AS: Main

This should explain how to make your movies so they can't be stolen easily by others across the web. It basicly finds the url of the site the movie is hosted on and if it doesn't match the movie shoots to a stolen frame. On that frame you can put a demo of your movie or game... or a hatefull message to the people who stole your movie. Your choice.

I use the "_url" property to find the domain name of the site the movie is on. The _url property returns a string that contains the URL of the site that the movie is hosted by. Quite useful but it returns the WHOLE PATH OF THE MOVIE! Not useful for uploading to newgrounds really... so we need to clip the URL to just the domain name.

I KNOW THIS IS LONG BUT I EXPLAIN HOW IT WORKS... I DON'T JUST GIVE THE CODE WITH NO EXPLAINATION. IT'S REALLY SIMPLE TO READ.

Start off by going to the main timeline and making two labels...
on the 2nd frame of the movie the label should be "start"
on a new frame at the end of the movie that has the stolen message, the label should be "stolen"

Create a new layer. Call this layer "Protect" or something like that.

On the layer you just made write some text saying "protect" and convert it into a MOVIE CLIP symbol.

Go to the actions for this movie clip...

Make a new onClipEvent.

What we need to do first is get everything between the "://" and the next "/" to be in the url.

We will use the "indexOf("substring", "startIndex")" method. What this does is it finds a portion of text in a string and returns a number (counting left to right) for where that piece of text starts for the first time...

The "startIndex" is optional... it is a number or variable that gives the position for the indexOf method to start from...

so...

-------------------------------

onClipEvent (enterFrame){

urlStart = _url.indexOf ("://")+3;
// this will get the beginning of the url "www.yourwebsite.com"
//this returns a value of 6... the first character in a string is aways 0.
// the first 7 spaces of a url are usually... "http://" if it's different it will be a differnet number.

urlEnd = _url.indexOf("/", urlstart);
//this will get the end of the url "www.yourwebsite.com"
//The indexOf method starts looking for "/" from the character right after "://"
//and returns the position of the NEXT "/" thus you know that the domain name is inbetween.

-------------------------------

Now we have the positon of the domain name's beginning and the postion of the end.

Basicly we just got the points where the brackets are in this link...
http://[www.yourwebsite.com]/folder/anothe
rfolder/movie.swf

so to get the domain out of there so we can use it we have to create a new string with it... lets call it domain...

----------------

//this gets all the characters between the urlStart and the urlEnd... thus the domain.
domain = _url.substring( urlStart , urlEnd );

---------------

The substring method makes a new string out of a portion of another one.
"substring( startnumber, endnumber )"

at this point we have gotten the domain name.

domain = "www.yourwebsite.com"

You COULD check that against a variable that you have set up on your website if you KNOW that the site will always start with "www." but alot of portals and sites don't work that way...

Like newgrounds... SWF files are played from "uploads.ungrounded.net"

It is a pain to go to every site you want to post your movie on and figure out what the prefix is for the portal... so fix it with this.

-----------------------

//find the last period in the domain... just in case there isn't another period in there.
LastDot = domain.lastIndexOf( "." ) -1;

//find the period before that one. if none is found this will return a -1 so we add +1.
pfixEnd = domain.lastIndexOf( "." , lastdot )+1;

//this makes the prefix drop off... and changes domain to just "yourwebsite.com"
domain = _domain.substring( pfixend , domain.length);

-----------------------

I used a new method there... "lastIndexOf("substring", "startIndex")"

Don't worry it is EXACTLY the same as "indexOf" except it reads the string RIGHT to LEFT...

Ok so now...
domain = "yourwebsite.com"

we are happy at this point... cause we are almost done...

------------------

//tell the movie what to do...
if (domain != "yourwebsite.com") {
tellTarget (_root) {
gotoAndStop ("stolen");
}
} else {
if (_root._currentframe <= 1){
tellTarget (_root) {
gotoAndPlay ("start");
}
}
}

------------

Sigh... that will work I think... remember tellTarget IS DEPRICIATED if you have MX. which most of you do... I am just an old school hold out for Flash 5.

I hope this helps you all... took me a while to write it. I know it's long but it's REALLY SIMPLE.
Thanks for reading this.

WHOLE CODE:
--------------------------

onClipEvent (enterFrame) {

// get everything between the "://" and the next "/"
urlStart = _url.indexOf( "://" )+3;
urlEnd = _url.indexOf( "/", urlStart );
domain = _url.substring( urlStart, urlEnd );

// get rid of any prefixes before the second to last "."
LastDot = domain.lastIndexOf( "." ) -1;
pfixEnd = domain.lastIndexOf( "." , LastDot ) +1;
domain = domain.substring( pfixEnd , domain.length);

//tell the movie what to do...
if (domain != "yourwebsite.com") {
tellTarget (_root) {
gotoAndStop ("stolen");
}
} else {
if (_root._currentframe <= 1){
tellTarget (_root) {
gotoAndPlay ("start");
}
}
}
}
---------------------


Visit JackSmack.com and submit your Flash Games!

BBS Signature

Response to AS: Copy Protection 2005-09-06 05:05:53


Dammit, I bookmarked the other thread moments before it was deleted. Ah well, it's still helpful. Good job, I'll be sure to use it if I ever make something worth copy protecting.

Here's hoping...

BBS Signature

Response to AS: Copy Protection 2005-09-06 05:08:35


At 9/6/05 05:05 AM, Ssilver7 wrote: Dammit, I bookmarked the other thread moments before it was deleted. Ah well, it's still helpful. Good job, I'll be sure to use it if I ever make something worth copy protecting.

Here's hoping...

Thanks... took me a while to write this... I'm not an actionscript 2.0 guru or anything so if someone wants to replace the tellTarget code with the current version please do so. thanks.


Visit JackSmack.com and submit your Flash Games!

BBS Signature

Response to AS: Copy Protection 2005-09-06 05:16:13


Yeah, I played with this quite a while ago, even made a Flash explaining how to do it.

If you're planning on submitting to several sites, you probably want to consider using an array to hold multiple 'good' URLs. This code is copy/pasted from liljim's post in this thread, so all credit goes to him.

this_url = _root._url;

// list of allowed urls.
allowed_urls = new Array("uploads.ungrounded.net", "uploads.newgrounds.com", "www.yoursite.com", "yoursite.com", "yoursite.mirror.com");

// Take out the http://, and get the domain
// Life would be so much easier if Flash supported regular expressions
// as a standard.
this_url = this_url.substr(7, this_url.length);
this_url = this_url.substr(0, this_url.indexOf("/"));

var found_good_url = 0;
for(var i=0; i<allowed_urls.length; i++)
{
if(this_url == allowed_urls[i])
{
found_good_url = 1;
break;
}
}

if(found_good_url == 1)
{
gotoAndStop("goodurl");
} else
{
gotoAndStop("badurl");
}


- - Flash - Music - Images - -

BBS Signature

Response to AS: Copy Protection 2005-09-06 05:31:07


At 9/6/05 05:16 AM, Denvish wrote: Yeah, I played with this quite a while ago, even made a Flash explaining how to do it.

If you're planning on submitting to several sites, you probably want to consider using an array to hold multiple 'good' URLs.
// list of allowed urls.
allowed_urls = new Array("uploads.ungrounded.net", "uploads.newgrounds.com", "www.yoursite.com", "yoursite.com", "yoursite.mirror.com");

So newgrounds uses "uploads.newgrounds.com" as well... that might be a problem in my code I guess... I thought it stuck to just one.


Visit JackSmack.com and submit your Flash Games!

BBS Signature

Response to AS: Copy Protection 2005-09-06 05:37:19


At 9/6/05 05:31 AM, JackSmack wrote: I thought it stuck to just one.

I think it does, for Flash submissions.


- - Flash - Music - Images - -

BBS Signature

Response to AS: Copy Protection 2005-09-06 06:28:41


another thing you could do that I find useful is load an external swf , domain check that, and in that swf domain check the swf file itself AND put some of the actionscript it uses, naturally cypher the functions a bit and use a lot of annoying comments ... that usually tricks most people looking to decompile it

Response to AS: Copy Protection 2005-09-06 06:41:55


also, I highly recommand mochibot as an additional tool, it allows authors to monitor who is watching their flash, it's not bulletproof, but it's worth a shot

http://www.mochibot.com

Response to AS: Copy Protection 2005-09-06 18:57:14


At 9/6/05 05:16 AM, Denvish wrote: Yeah, I played with this quite a while ago, even made a Flash explaining how to do it.

If you're planning on submitting to several sites, you probably want to consider using an array to hold multiple 'good' URLs.

I was just notified by Tom that there is a chance that in the future the portal might swap back and forth between "newgrounds.com" and "ungrounded.net" Switching to ungrounded.net was a security thing... but if the security problem can be fixed it might switch back and be hosted on newgrounds.com thus making your movies not work.

So if you host on Newgrounds remember to check for BOTH "ungrounded.net" AND "newgrounds.com" since they will both be good.


Visit JackSmack.com and submit your Flash Games!

BBS Signature

Response to AS: Copy Protection 2005-09-06 19:23:41


Not really worth the time. Most of my flash aren't worth stealing anyway. Besides, as long as they can't alter the actual flash itself and my name is still presented where I put it, it's not too big a deal. I'd be a little pissed, but I don't want to write 1,000 lines of code to protect from something that probably won't happen.

Response to AS: Copy Protection 2005-09-06 19:31:42


cool code..

my fav is the ini file..but ppl can get aroudn that also.

i liek a hidden tracker my self.
you can stop ppl from stealing it, but you can see where it goes


Drawing without thinking is just doodling, the brain and pen is connected.

PSN: SeoulSnake

BBS Signature

Response to AS: Copy Protection 2005-09-07 18:22:09


OK, here's a way you can protect your game files from decompiling (swf>fla). I found this when I searched for ways to protect my API games (very easy to decompile - no symbols, and all Actions on one frame). It doesn't do a great deal, but if you use functions and a lot of variables, it should make your swf reasonably safe from the casual decompiler
http://www.genable.com/aso.html
Edit the T1.xml file to the name of your swf, open it on running ASO, encode, and save.

There are also a couple of other swf encrypters available, but I haven't tried either yet. Swf Encrypt was cracked easily by the same guy who made the ASO program, but its review was pretty good. Again, it should put off all but the most determined decompilers.
SWF Encrypt 3.0

Then there's secureSWF. This is quite new, and I haven't seen any reviews of it, but it's probably worth a go. SecureSWF

Let's hope that this is the start of a trend - swf encrypters being ahead of the decompilers. It's actually unbelievable that Macromedia themselves haven't offered this as an inbuilt function in Flash - but then again, if it was official, the people who write decompiling programs find someone to crack the protection as a matter of priority. Third party programs will probably get less attention.


- - Flash - Music - Images - -

BBS Signature

Response to AS: Copy Protection 2005-11-17 08:24:14


Some more discussion of getURL protection in this thread, for anybody who is interested. authorblues' version of the code in there is pretty good.


- - Flash - Music - Images - -

BBS Signature

Response to AS: Copy Protection 2007-10-30 19:10:36


Worth noting is that Newgrounds registered a 3rd domain, ngfiles.com, you might have seen it for the audio portal or other places.


Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.

Response to AS: Copy Protection 2007-10-30 19:16:40


And the files load from ungrounded or something like that...
(yes,I am aware this is bumped,but since we are kind of giving new info I think it's OK.The rules say it's OK to bump topics if you give NEW INFO)


i deserve death

dont click the link this account is shit and fuck me

BBS Signature

Response to AS: Copy Protection 2007-10-30 19:23:02


At 10/30/07 07:10 PM, henke37 wrote: Worth noting is that Newgrounds registered a 3rd domain, ngfiles.com, you might have seen it for the audio portal or other places.

The last post was in 2005, so nice bump there, buddy.


hello