Search code examples
phpactionscript-3flashcopy-protection

How to Bind SWFs to a Host?


I'm working on a major Flash project that is going to be the core content of a site.

As most of you well know, almost any site can be entirely copied by copying the cached files and the hierarchy (files and folders structure), and it would run without problems on an Apache server with PHP enabled, if used.

What I would like to know is: How to bind SWF files to run on a specific host?

The SWFs will be encrypted, so outsiders won't have access to the methods used to stop the SWF from running on a different host, question is: what method to use?

I think the solution could be hardcoding the host IP inside the SWF, so if the SWF is looking for 123.123.123.123, only a host with that IP would allow the SWF to run further.

The issue is that AS3 alone can't discover the host IP or could it if it's trying to load a resource file? Anyway, that's why I need your help.

EDIT: Ok, seems someone asked for something similar earlier: Can you secure your swf so it checks if it is running on a recognized environment? I'll try that and see how it works, but the question is still open in case anyone has different suggestions.


Solution

  • I use this method to determine if I am on dev or production in my config files.

    var lc:LocalConnection = new LocalConnection();
    switch ( lc.domain ){
      case "myDomain.com":
      case "":// local file reference  for dev
      case "localhost":// local file reference  for dev
      case "dev.mydomain.com":// local file reference for dev
        break;
      default:
        // unknown domain do crash the app here
    }