A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Finding the name of the hosting domain...?

  1. #1
    Junior Member
    Join Date
    May 2006
    Posts
    14

    RESOLVED: Finding the name of the hosting domain...?

    Hi,

    I'm sure there's an easy way to do this but I can't figure it out...

    What I need to do is find out the domain name of the site that's hosting the file (eg www.catalyststudios.co.uk or uploads.ungrounded.net) and skip a certain frame (or freeze the player if the file's stolen).

    I thought it might have been this.domain(), but it's coming up as 'undefined'.... any ideas?

    EDIT:

    Using Flash 8 btw.
    Last edited by mikeyboy80; 05-28-2006 at 04:35 PM.

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    trace(_root._url);
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    once you have _url you can use a function that sends the stolen file
    to a bad URL or a "stolen" frame (MX6 syntax)
    Code:
    isStolen = function (ourDomainName) {
        var urlString, part1, part2, part3, part4, domain;
        urlString = _url;
        part1 = urlString.indexOf("://") + 3;
        part2 = urlString.indexOf("/", part1);
        domain = urlString.substring(part1, part2);
        part3 = domain.lastIndexOf(".") - 1;
        part4 = domain.lastIndexOf(".", part3) + 1;
        domain = domain.substring(part4, domain.length);
        if (domain != ourDomainName) {
            return (true);
        }
    }
    
    //let movie play only on yourdomain.com
    if (isStolen("yourdomain.com")) { // no www or paths required
        getURL(http://www.angelfire.com/super/badwebs/);
    // or
    // gotoAndStop("stolen");
    }

  4. #4
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    yo dog what i usually do is just this:

    var correctDomain:String = "http://www.mydomain.com";

    if(_url.indexOf(correctDomain) == -1){
    gotoAndStop("stolen");

    }
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    loadsa ways to skin that cat

  6. #6
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    Great TIP guys, I been working on this for AGES - how not to make people hak into your site... I been trying to seal out my website source file for ages

    One other way to stop people get to your files is to make the page with the .swf on it into a PHP file. that way ppl can't see into the source. but then its not as good coz the .swf is still on the server and people can still guess that, but then you can make it really really really hard to guess. (LOL i made one called: XRV1993MainOperation_SWF_MainFile.swf) - oops

    But then can it Actually read into the computer itself - coz maybe they downloaded the whatever onto their own hardDisk and so you have to stop it being OPENED!?
    Well, could that work?
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  7. #7
    Junior Member
    Join Date
    May 2006
    Posts
    14
    Thanks for the help guys - I used the simpler version posted by silentweed in the end. I'll be posting the .swf on Newgrounds, and I just wanted it to play the NG logo if it detected it was hosted there but skip it if not.... I'll also be adding a random copy protection check to the finished movie that allows it to be hosted only on specified sites (mine and NG to begin with) - that way if people want to host it they'll need to ask permission first (my last .swf was 'borrowed' by about 20 different sites without permission - but hey, it's all good exposure and at least they didn't hotlink or remove all the credits...).

  8. #8
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    *Bump* my question *Bump*

    Not meaning to pester but -
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  9. #9
    Junior Member
    Join Date
    May 2006
    Posts
    14
    The way that most people grab the files is from their browser cache... no matter which of the main browsers you use to surf the web, they save every file to your hard disk for quicker execution. It's incredibly easy for someone to sift through their cache and pick out your .swf to run or decompile on their own machine.

    There are ways to protect your files, some better than others:

    1) Use the 'Protect from import' option in the Publish settings menu. Not foolproof and quite easily worked around for the determined hacker, but it can put off some of the less dedicated undesirables.

    2) Make your movies interdependent - that is, have a master function, perhaps hidden away in a small, invisible movie clip that checks where the file is being run and causes the movie to freeze by throwing an infinite Actionscript loop or making the movie jump to a frame saying 'this movie is stolen' or something. You can then place calls to this movie in other movie clips, like a series of checkpoints, and a missing or altered checkpoint will cause a failure as above - a hacker can decompile your movie and remove or alter a checkpoint but chances are they won't find all of them. Make the checks occur at random intervals to keep them guessing.

    3) Load your main movie into a container clip, and give it a really obscure or common name (something like "468x60_site_banner.swf"); that way people looking at the source code will see the name of the container clip and try and steal that...

    4) Using the method described in the thread above, you can cause the movie to freeze or refuse to play at all if it detects that it's being run from a user's desktop ("local") rather than a webpage. Kinda makes it difficult to test the movie though.

    Be aware that there's no way to completely lock your movie away from prying eyes; someone who really wants your source code will always find a way to get it. The best you can do is to make it so hard for their hacked version to work that they give up, thinking it's not worth their time. Adding a tracking code like Mochibot helps you to see who's hosting your file - if you see anyone you don't want on your list, you can always try emailing them and asking them to remove it.

  10. #10
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    If you really wanna protect your swfs from decompilation, u should look into using a obfuscator .. you can download a free one from http://www.kindisoft.com/
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  11. #11
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    Oh Thanks silentweed and mikeyboy80.
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center