00:00
00:00
View Profile nabibrian
They must find it difficult... Those who have taken authority as the truth, rather than TRUTH as the authority.

Male

MO

Joined on 10/9/06

Level:
11
Exp Points:
1,130 / 1,350
Exp Rank:
60,501
Vote Power:
5.28 votes
Rank:
Scout
Global Rank:
38,967
Blams:
12
Saves:
225
B/P Bonus:
4%
Whistle:
Normal

Anti-Theft Techniques

Posted by nabibrian - February 10th, 2008


Here's how you can protect yourself and your files as well as know when your files are being stolen.

The first way to stop a thief is to block their site from using your file. This can be achieved by placing code to detect their site and not allow you movie to play. This code should do the trick:

// URL Checker
checkIt = this._url.substring(8,this._url.indexO f( "/", 8 ) );
// Enforcer
if (checkIt.indexOf( "SiteToBlockHere.com" ) != -1) {
stop();
}

What the code does is check its location and if it matches "SiteToBlockHere.com", then it stops your movie. Place this code in a reoccurring movie clip for maximum effect. That way, the thief can't have your movie start at the frame after the stop code, thus defeating your code. If you are using it in a game, place the code on enemy spawn code or in your character's walking code. If it's in a video, toss it in every 200 frames.

So that's the easy way to block 1 site from using your flash file, but what if you want something a bit better? You could always change the script so that it only allows 1 site so that it works on your site but not on other sites, but maybe you want to give copies to other people and you don't want to edit the code every time you let someone host it. Here's where having a file 'call home' is helpful.

You'll have your file load an XML file from your site to both track a thief and thwart them. First, you need to create the XML file. In a text editor make a new file (you can create an empty action script file in flash) and insert the following:

<?xml version="1.0"?>
<a ntiTheft>
<banned site="someSite.com" />
<banned site="someOtherSite.com" />
</antiTheft>

You can change, add and remove the <banned site="" /> tags as needed. Save the file and call it something like 'banned.xml' and then upload it to your site (upload it anywhere you want, just know where you put it). Then go into the flash video you want to protect. All you need to do is tell your flash file to read that XML file and not run if it's on a banned site.

Here's how you do it:

// URL Checker Setup
checkIt = this._url;
checkIt = checkIt.substring(7, checkIt.indexOf("/", 8));

data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {
if (success) {
var track_xml = data_xml.firstChild.firstChild;
while (track_xml != null) {
// Enforcer
if (checkIt.indexOf(track_xml.attributes.
site) != -1) {
stop();
}
track_xml = track_xml.nextSibling;
}
else {
//server down/file missing
stop();
}
delete data_xml;
};
data_xml.load("http://www.yoursite.com /banned.xml");

Be sure to change the last line to match the path to your ban file!

What the code does is 2 things. First 'checkIt' is set to the site that the flash video is playing from. If you were to put you movie at 'http://www.yoursite.com/videos/movie.
swf
', checkIt would be set to 'www.yoursite.com'. The next thing it does is load your banned.xml from your server and checks if it's on any of the banned sites. If it matches a banned site to its location, it'll halt the movie playback. Also, if it can't connect to your server it won't play.

Having you flash files call home is a nice way to track them. If you look at your server logs (or server stats) you can see who's requesting your banned.xml file, and track down people who have stolen your file(s). This allows you to ban sites as you find out about them and not block all sites which could block legitimate sites. A possible extension to this is adding a 'file' property to each 'banned' tag so that it reads <banned site="someOtherSite.com" file="myVideo" /> and have the videos detect if the ban rule applies to them or not. That way you can have your videos banned on different sites.

The only weakness to this code is that if someone hotlinks your movie, it'll still work as it'll be loading from your server. The only way to prevent that is to implement anti-hotlinking code on your server.

Don't let the thieves make money off your hard work!


Comments

This is great! Thanks for the info.
I've got to do some work on my crap website this week and this is just what I need!
Cheers mate!

Glad to have helped!