My basic cloaking script

Discussion in 'Black Hat SEO Tools' started by Asprin, Oct 16, 2007.

  1. Asprin

    Asprin Newbie

    Joined:
    Oct 15, 2007
    Messages:
    15
    Likes Received:
    0
    I just learned about cloaking today so I decided to write a quick script that tries to filter out Google's spider via an ACL and the user-agent.

    I know it's very basic and only works for Google's spider. Maybe you can give me some ideas so I can incorporate them into the script.
    I'll definitely be updating this and I'll make an update in this thread when I do.

    Anyways, I thought maybe somebody would have a use for it. If you have any questions, just ask.

    PHP:
    <?php

    $bip    
    = new ArrayObject();
    $bhn    = new ArrayObject();


    /*
     *    Set these variables to the location of the file that holds the black listed IP/hostnames
     */

    //$ipblacklist    = "ipblacklist.txt";
    //$hnblacklist    = "hnblacklist.txt";

    if(isset($ipblacklist))
    {
        
    $file    fopen($ipblacklist"r");
        
        while(!
    feof($file))
        {
            
    $bannedip    fgets($file1024);
            
    $bip->append();
        }
    }
    if(isset(
    $hnblacklist))
    {
        
    $file    fopen($hnblacklist"r");
        
        while(!
    feof($file))
        {
            
    $bannedhn    fgets($file1024);
            
    $bhn->append();
        }
    }

    $hostname    gethostbyaddr($_SERVER['REMOTE_ADDR']);

    if(
    in_array($_SERVER['REMOTE_ADDR'], (array)$bip) || in_array($hostname, (array)$bhn))
    {
        include(
    "spider_content.html");
    } else if(
    stristr($_SERVER['HTTP_USER_AGENT'], "Mediapartners-Google") || stristr($_SERVER['HTTP_USER_AGENT'], "Googlebot")) {
        include(
    "spider_content.html");
    } else {
        include(
    "human_content.html");
    }


    ?>
     
  2. america-lottery

    america-lottery Newbie

    Joined:
    Sep 3, 2007
    Messages:
    24
    Likes Received:
    3
    good start, keep going!
     
  3. frivvy89

    frivvy89 Regular Member

    Joined:
    Oct 14, 2007
    Messages:
    258
    Likes Received:
    150
    How does the script actually work?
     
  4. Asprin

    Asprin Newbie

    Joined:
    Oct 15, 2007
    Messages:
    15
    Likes Received:
    0
    I'll update this later when I have time.

    P.S. Is there a way to edit posts?
     
  5. brittany46

    brittany46 Junior Member

    Joined:
    Oct 16, 2006
    Messages:
    145
    Likes Received:
    25
    Yes. If you are logged in, there should be an 'edit' button on the bottom by the quote and post reply.
     
  6. Asprin

    Asprin Newbie

    Joined:
    Oct 15, 2007
    Messages:
    15
    Likes Received:
    0
    I only see the edit button on new posts, but goes away after a while.
    Maybe I need a certain number of posts before I can edit?

    I'll be making an update on this soon.
     
  7. hiruma

    hiruma Newbie

    Joined:
    Oct 24, 2007
    Messages:
    21
    Likes Received:
    0
    thank a lot
     
  8. crowrock

    crowrock Newbie

    Joined:
    Nov 3, 2007
    Messages:
    16
    Likes Received:
    0
    Looks good so far..keep on writing scripts :)
     
  9. red2004

    red2004 Junior Member

    Joined:
    Aug 17, 2007
    Messages:
    129
    Likes Received:
    28
    Thanks for sharing. I will definitely try this
     
  10. paranoid1288

    paranoid1288 Junior Member

    Joined:
    Nov 4, 2007
    Messages:
    104
    Likes Received:
    4
    nice starting try, we will wait for your updates
     
  11. Kaylum

    Kaylum Newbie

    Joined:
    Mar 24, 2007
    Messages:
    12
    Likes Received:
    1
    hey there Asprin

    thanks for sharing this code.. it's very cool to see an example.

    as for handling multiple user-agents, try creating another hash containing the complete list and then check against that in a conditional.

    i.e. if user-agent in array, then process..

    peace
     
  12. rogerbizz

    rogerbizz Newbie

    Joined:
    Sep 20, 2015
    Messages:
    2
    Likes Received:
    0
    Any updates on the script?
    I had something similiar, but don't know how to move from there.
     
  13. lethbridge

    lethbridge Junior Member

    Joined:
    Sep 20, 2010
    Messages:
    138
    Likes Received:
    42
    Occupation:
    Mad Hatter
    Location:
    lethbridge alberta canada
    interesting idea. welcome to BHW
     
  14. h1zone

    h1zone Newbie

    Joined:
    Sep 30, 2015
    Messages:
    13
    Likes Received:
    0
    Where to get black IP lists ? do you know ?