Advertisement
aknath

Bot Detection

Nov 4th, 2013
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.36 KB | None | 0 0
  1. add_action('the_content', 'make_open_for_bot');
  2. function make_open_for_bot($content) {
  3.     if (is_bot())
  4.         $content = preg_replace('/\[[^\]]*]/', '', $content);
  5.     return $content;
  6. }
  7.  
  8.  
  9. function is_bot() {
  10.     $spiders = array(
  11.         "abot",
  12.         "dbot",
  13.         "ebot",
  14.         "hbot",
  15.         "kbot",
  16.         "lbot",
  17.         "mbot",
  18.         "nbot",
  19.         "obot",
  20.         "pbot",
  21.         "rbot",
  22.         "sbot",
  23.         "tbot",
  24.         "vbot",
  25.         "ybot",
  26.         "zbot",
  27.         "bot.",
  28.         "bot/",
  29.         "_bot",
  30.         ".bot",
  31.         "/bot",
  32.         "-bot",
  33.         ":bot",
  34.         "(bot",
  35.         "crawl",
  36.         "slurp",
  37.         "spider",
  38.         "seek",
  39.         "accoona",
  40.         "acoon",
  41.         "adressendeutschland",
  42.         "ah-ha.com",
  43.         "ahoy",
  44.         "altavista",
  45.         "ananzi",
  46.         "anthill",
  47.         "appie",
  48.         "arachnophilia",
  49.         "arale",
  50.         "araneo",
  51.         "aranha",
  52.         "architext",
  53.         "aretha",
  54.         "arks",
  55.         "asterias",
  56.         "atlocal",
  57.         "atn",
  58.         "atomz",
  59.         "augurfind",
  60.         "backrub",
  61.         "bannana_bot",
  62.         "baypup",
  63.         "bdfetch",
  64.         "big brother",
  65.         "biglotron",
  66.         "bjaaland",
  67.         "blackwidow",
  68.         "blaiz",
  69.         "blog",
  70.         "blo.",
  71.         "bloodhound",
  72.         "boitho",
  73.         "booch",
  74.         "bradley",
  75.         "butterfly",
  76.         "calif",
  77.         "cassandra",
  78.         "ccubee",
  79.         "cfetch",
  80.         "charlotte",
  81.         "churl",
  82.         "cienciaficcion",
  83.         "cmc",
  84.         "collective",
  85.         "comagent",
  86.         "combine",
  87.         "computingsite",
  88.         "csci",
  89.         "curl",
  90.         "cusco",
  91.         "daumoa",
  92.         "deepindex",
  93.         "delorie",
  94.         "depspid",
  95.         "deweb",
  96.         "die blinde kuh",
  97.         "digger",
  98.         "ditto",
  99.         "dmoz",
  100.         "docomo",
  101.         "download express",
  102.         "dtaagent",
  103.         "dwcp",
  104.         "ebiness",
  105.         "ebingbong",
  106.         "e-collector",
  107.         "ejupiter",
  108.         "emacs-w3 search engine",
  109.         "esther",
  110.         "evliya celebi",
  111.         "ezresult",
  112.         "falcon",
  113.         "felix ide",
  114.         "ferret",
  115.         "fetchrover",
  116.         "fido",
  117.         "findlinks",
  118.         "fireball",
  119.         "fish search",
  120.         "fouineur",
  121.         "funnelweb",
  122.         "gazz",
  123.         "gcreep",
  124.         "genieknows",
  125.         "getterroboplus",
  126.         "geturl",
  127.         "glx",
  128.         "goforit",
  129.         "golem",
  130.         "grabber",
  131.         "grapnel",
  132.         "gralon",
  133.         "griffon",
  134.         "gromit",
  135.         "grub",
  136.         "gulliver",
  137.         "hamahakki",
  138.         "harvest",
  139.         "havindex",
  140.         "helix",
  141.         "heritrix",
  142.         "hku www octopus",
  143.         "homerweb",
  144.         "htdig",
  145.         "html index",
  146.         "html_analyzer",
  147.         "htmlgobble",
  148.         "hubater",
  149.         "hyper-decontextualizer",
  150.         "ia_archiver",
  151.         "ibm_planetwide",
  152.         "ichiro",
  153.         "iconsurf",
  154.         "iltrovatore",
  155.         "image.kapsi.net",
  156.         "imagelock",
  157.         "incywincy",
  158.         "indexer",
  159.         "infobee",
  160.         "informant",
  161.         "ingrid",
  162.         "inktomisearch.com",
  163.         "inspector web",
  164.         "intelliagent",
  165.         "internet shinchakubin",
  166.         "ip3000",
  167.         "iron33",
  168.         "israeli-search",
  169.         "ivia",
  170.         "jack",
  171.         "jakarta",
  172.         "javabee",
  173.         "jetbot",
  174.         "jumpstation",
  175.         "katipo",
  176.         "kdd-explorer",
  177.         "kilroy",
  178.         "knowledge",
  179.         "kototoi",
  180.         "kretrieve",
  181.         "labelgrabber",
  182.         "lachesis",
  183.         "larbin",
  184.         "legs",
  185.         "libwww",
  186.         "linkalarm",
  187.         "link validator",
  188.         "linkscan",
  189.         "lockon",
  190.         "lwp",
  191.         "lycos",
  192.         "magpie",
  193.         "mantraagent",
  194.         "mapoftheinternet",
  195.         "marvin/",
  196.         "mattie",
  197.         "mediafox",
  198.         "mediapartners",
  199.         "mercator",
  200.         "merzscope",
  201.         "microsoft url control",
  202.         "minirank",
  203.         "miva",
  204.         "mj12",
  205.         "mnogosearch",
  206.         "moget",
  207.         "monster",
  208.         "moose",
  209.         "motor",
  210.         "multitext",
  211.         "muncher",
  212.         "muscatferret",
  213.         "mwd.search",
  214.         "myweb",
  215.         "najdi",
  216.         "nameprotect",
  217.         "nationaldirectory",
  218.         "nazilla",
  219.         "ncsa beta",
  220.         "nec-meshexplorer",
  221.         "nederland.zoek",
  222.         "netcarta webmap engine",
  223.         "netmechanic",
  224.         "netresearchserver",
  225.         "netscoop",
  226.         "newscan-online",
  227.         "nhse",
  228.         "nokia6682/",
  229.         "nomad",
  230.         "noyona",
  231.         "nutch",
  232.         "nzexplorer",
  233.         "objectssearch",
  234.         "occam",
  235.         "omni",
  236.         "open text",
  237.         "openfind",
  238.         "openintelligencedata",
  239.         "orb search",
  240.         "osis-project",
  241.         "pack rat",
  242.         "pageboy",
  243.         "pagebull",
  244.         "page_verifier",
  245.         "panscient",
  246.         "parasite",
  247.         "partnersite",
  248.         "patric",
  249.         "pear.",
  250.         "pegasus",
  251.         "peregrinator",
  252.         "pgp key agent",
  253.         "phantom",
  254.         "phpdig",
  255.         "picosearch",
  256.         "piltdownman",
  257.         "pimptrain",
  258.         "pinpoint",
  259.         "pioneer",
  260.         "piranha",
  261.         "plumtreewebaccessor",
  262.         "pogodak",
  263.         "poirot",
  264.         "pompos",
  265.         "poppelsdorf",
  266.         "poppi",
  267.         "popular iconoclast",
  268.         "psycheclone",
  269.         "publisher",
  270.         "python",
  271.         "rambler",
  272.         "raven search",
  273.         "roach",
  274.         "road runner",
  275.         "roadhouse",
  276.         "robbie",
  277.         "robofox",
  278.         "robozilla",
  279.         "rules",
  280.         "salty",
  281.         "sbider",
  282.         "scooter",
  283.         "scoutjet",
  284.         "scrubby",
  285.         "search.",
  286.         "searchprocess",
  287.         "semanticdiscovery",
  288.         "senrigan",
  289.         "sg-scout",
  290.         "shai'hulud",
  291.         "shark",
  292.         "shopwiki",
  293.         "sidewinder",
  294.         "sift",
  295.         "silk",
  296.         "simmany",
  297.         "site searcher",
  298.         "site valet",
  299.         "sitetech-rover",
  300.         "skymob.com",
  301.         "sleek",
  302.         "smartwit",
  303.         "sna-",
  304.         "snappy",
  305.         "snooper",
  306.         "sohu",
  307.         "speedfind",
  308.         "sphere",
  309.         "sphider",
  310.         "spinner",
  311.         "spyder",
  312.         "steeler/",
  313.         "suke",
  314.         "suntek",
  315.         "supersnooper",
  316.         "surfnomore",
  317.         "sven",
  318.         "sygol",
  319.         "szukacz",
  320.         "tach black widow",
  321.         "tarantula",
  322.         "templeton",
  323.         "/teoma",
  324.         "t-h-u-n-d-e-r-s-t-o-n-e",
  325.         "theophrastus",
  326.         "titan",
  327.         "titin",
  328.         "tkwww",
  329.         "toutatis",
  330.         "t-rex",
  331.         "tutorgig",
  332.         "twiceler",
  333.         "twisted",
  334.         "ucsd",
  335.         "udmsearch",
  336.         "url check",
  337.         "updated",
  338.         "vagabondo",
  339.         "valkyrie",
  340.         "verticrawl",
  341.         "victoria",
  342.         "vision-search",
  343.         "volcano",
  344.         "voyager/",
  345.         "voyager-hc",
  346.         "w3c_validator",
  347.         "w3m2",
  348.         "w3mir",
  349.         "walker",
  350.         "wallpaper",
  351.         "wanderer",
  352.         "wauuu",
  353.         "wavefire",
  354.         "web core",
  355.         "web hopper",
  356.         "web wombat",
  357.         "webbandit",
  358.         "webcatcher",
  359.         "webcopy",
  360.         "webfoot",
  361.         "weblayers",
  362.         "weblinker",
  363.         "weblog monitor",
  364.         "webmirror",
  365.         "webmonkey",
  366.         "webquest",
  367.         "webreaper",
  368.         "websitepulse",
  369.         "websnarf",
  370.         "webstolperer",
  371.         "webvac",
  372.         "webwalk",
  373.         "webwatch",
  374.         "webwombat",
  375.         "webzinger",
  376.         "wget",
  377.         "whizbang",
  378.         "whowhere",
  379.         "wild ferret",
  380.         "worldlight",
  381.         "wwwc",
  382.         "wwwster",
  383.         "xenu",
  384.         "xget",
  385.         "xift",
  386.         "xirq",
  387.         "yandex",
  388.         "yanga",
  389.         "yeti",
  390.         "yodao",
  391.         "zao/",
  392.         "zippp",
  393.         "zyborg",
  394.     );
  395.  
  396.     foreach($spiders as $spider) {
  397.         //If the spider text is found in the current user agent, then return true
  398.         if ( stripos($_SERVER['HTTP_USER_AGENT'], $spider) !== false ) return true;
  399.     }
  400.     //If it gets this far then no bot was found!
  401.     return false;
  402.  
  403. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement