Nice programing

통계를 위해 인간 방문자와 구분하여 봇에게 알려주시겠습니까?

nicepro 2020. 12. 28. 22:34
반응형

통계를 위해 인간 방문자와 구분하여 봇에게 알려주시겠습니까?


내 자신의 간단한 웹 통계 스크립트를 롤링하려고합니다.

내가 볼 수있는 한 도로의 유일한 주요 장애물은 인간 방문자에게 봇과 구별되는 것입니다. 정기적으로 유지 관리 할 필요가없는 솔루션을 갖고 싶습니다 (예 : 봇 관련 사용자 에이전트로 텍스트 파일을 업데이트하고 싶지 않음).

Akismet이 스팸을 처리하는 것과 같은 공개 서비스가 있습니까? 아니면 스파이더와 봇을 인식하고 빈번한 업데이트를 제공하는 PHP 프로젝트가 있습니까?

명확히하기 위해 : 저는 봇을 차단하려고하지 않습니다. 100 % 방수 결과는 필요하지 않습니다 . 통계에서 최대한 많이 제외하고 싶습니다. user-Agent를 구문 분석하는 것은 옵션이지만 구문 분석 할 패턴을 유지하는 것은 많은 작업입니다. 제 질문은 이미 그렇게하는 프로젝트 나 서비스가 있는지 여부입니다.

현상금 : 주제에 대한 참고 질문으로 이것을 밀어 붙일 것이라고 생각했습니다. 최고 / 가장 독창적 / 가장 기술적으로 실행 가능한 기여는 현상금 금액을 받게됩니다.


인간과 봇은 비슷한 일을하지만 봇은 인간이하지 않는 일을합니다. 그런 것들을 확인하려고 노력합시다. 동작을보기 전에 RayQuang의 의견을 유용하다고 받아 들여 봅시다 . 방문자가 봇의 사용자 에이전트 문자열을 가지고 있다면 아마도 봇일 것입니다. "Google 크롤러"(또는 이와 유사한 것)를 UA로 가지고 돌아 다니는 사람이 무언가를 깨뜨리는 작업을하지 않는 한 상상할 수 없습니다. 목록을 수동으로 업데이트하고 싶지는 않지만 목록을 자동으로 가져 오면 좋으며 향후 10 년 동안 오래된 상태로 유지 되더라도 도움이 될 것입니다.

일부는 이미 자바 스크립트와 이미지 로딩을 언급했지만 Google은 둘 다 할 것입니다. 이제 두 가지를 모두 수행하는 봇이 여러 개 있다고 가정해야하므로 더 이상 인간 지표가 아닙니다. 그러나 봇이 여전히 고유하게 수행하는 작업은 "보이지 않는"링크를 따르는 것입니다. 사용자로 볼 수없는 매우 교활한 방식으로 페이지에 연결합니다. 그게 뒤 따르면 봇이 있습니다.

봇은 항상은 아니지만 종종 robots.txt를 존중합니다. 사용자는 robots.txt에 관심이 없으며 robots.txt를 검색하는 사람은 누구나 봇이라고 가정 할 수 있습니다. 하지만 한 단계 더 나아가 더미 CSS 페이지를 robots.txt에 의해 제외 된 페이지에 연결할 수 있습니다. 일반 CSS가로드되었지만 더미 CSS가로드되지 않은 경우 확실히 봇입니다. IP별로로드 테이블 (아마도 인 메모리)을 작성하고 매치에 포함되지 않은 작업을 수행해야하지만 이는 정말 확실한 정보입니다.

따라서이 모든 것을 사용하려면 타임 스탬프 제한이있는 IP 주소별로 봇의 데이터베이스 테이블을 유지해야합니다. 보이지 않는 링크를 따르는 모든 것을 추가하고 "실제"CSS를로드하지만 robots.txt CSS를 무시하는 모든 것을 추가합니다. 아마도 모든 robots.txt 다운로더를 추가 할 수도 있습니다. 사용자 에이전트 문자열을 마지막 단계로 필터링하고이를 사용하여 빠른 통계 분석을 수행하고 이러한 방법이 우리가 알고있는 봇을 식별하는 데 얼마나 강력하게 작동하는지 확인하십시오.


가장 쉬운 방법은 사용자 에이전트에 'bot'또는 'spider'가 포함되어 있는지 확인하는 것입니다. 대부분은 .


수정 (10 년 후) : Lukas가 주석 상자에서 말했듯이 오늘날 거의 모든 크롤러가 자바 스크립트를 지원하므로 사이트가 JS 기반이라면 대부분의 봇이 자동으로 제거된다는 단락을 제거했습니다.

봇 목록을 팔로우하고 필터링 목록에 사용자 에이전트를 추가 할 수 있습니다.

이 봇 목록을 살펴보십시오.

사용자 에이전트 목록 도 꽤 좋습니다. 그냥 모든 B의 빼내야 하고있는 거 세트를.

편집 : eSniff수행 한 놀라운 작업 에는 위의 목록이 여기에 있습니다. " 쉽게 쿼리하고 구문 분석 할 수있는 형식입니다. robotstxt.org/db/all.txt 각각의 새로운 봇은 robot-id : XXX로 정의됩니다. 일주일에 한 번 다운로드하고 스크립트에서 사용할 수있는 "" 로 구문 분석합니다 .

도움이 되었기를 바랍니다.


CSS 배경 이미지로 위장 된 PHP 통계 스크립트를 고려하십시오 (적어도 콘텐츠 유형 및 캐시 제어를 포함하는 올바른 응답 헤더를 제공하되 빈 이미지를 작성하십시오).

일부 봇은 JS를 구문 분석하지만 확실히 아무도 CSS 이미지를로드하지 않습니다. JS와 마찬가지로 한 가지 함정은 텍스트 기반 브라우저를 제외한다는 것입니다.하지만 이는 월드 와이드 웹 인구의 1 % 미만입니다. 또한 JS 비활성화 클라이언트 (모바일!)보다 CSS 비활성화 클라이언트가 확실히 적습니다.

고급 봇 (Google, Yahoo 등)이 향후 크롤링 할 수있는 (예외적이지 않은) 경우를 더 견고하게 만들려면 CSS 이미지 경로를 허용하지 마십시오 robots.txt(더 나은 봇은 어쨌든 존중할 것입니다).


내 통계 / 카운터 앱에 다음을 사용합니다.

<?php
    function is_bot($user_agent) {
        return preg_match('/(abot|dbot|ebot|hbot|kbot|lbot|mbot|nbot|obot|pbot|rbot|sbot|tbot|vbot|ybot|zbot|bot\.|bot\/|_bot|\.bot|\/bot|\-bot|\:bot|\(bot|crawl|slurp|spider|seek|accoona|acoon|adressendeutschland|ah\-ha\.com|ahoy|altavista|ananzi|anthill|appie|arachnophilia|arale|araneo|aranha|architext|aretha|arks|asterias|atlocal|atn|atomz|augurfind|backrub|bannana_bot|baypup|bdfetch|big brother|biglotron|bjaaland|blackwidow|blaiz|blog|blo\.|bloodhound|boitho|booch|bradley|butterfly|calif|cassandra|ccubee|cfetch|charlotte|churl|cienciaficcion|cmc|collective|comagent|combine|computingsite|csci|curl|cusco|daumoa|deepindex|delorie|depspid|deweb|die blinde kuh|digger|ditto|dmoz|docomo|download express|dtaagent|dwcp|ebiness|ebingbong|e\-collector|ejupiter|emacs\-w3 search engine|esther|evliya celebi|ezresult|falcon|felix ide|ferret|fetchrover|fido|findlinks|fireball|fish search|fouineur|funnelweb|gazz|gcreep|genieknows|getterroboplus|geturl|glx|goforit|golem|grabber|grapnel|gralon|griffon|gromit|grub|gulliver|hamahakki|harvest|havindex|helix|heritrix|hku www octopus|homerweb|htdig|html index|html_analyzer|htmlgobble|hubater|hyper\-decontextualizer|ia_archiver|ibm_planetwide|ichiro|iconsurf|iltrovatore|image\.kapsi\.net|imagelock|incywincy|indexer|infobee|informant|ingrid|inktomisearch\.com|inspector web|intelliagent|internet shinchakubin|ip3000|iron33|israeli\-search|ivia|jack|jakarta|javabee|jetbot|jumpstation|katipo|kdd\-explorer|kilroy|knowledge|kototoi|kretrieve|labelgrabber|lachesis|larbin|legs|libwww|linkalarm|link validator|linkscan|lockon|lwp|lycos|magpie|mantraagent|mapoftheinternet|marvin\/|mattie|mediafox|mediapartners|mercator|merzscope|microsoft url control|minirank|miva|mj12|mnogosearch|moget|monster|moose|motor|multitext|muncher|muscatferret|mwd\.search|myweb|najdi|nameprotect|nationaldirectory|nazilla|ncsa beta|nec\-meshexplorer|nederland\.zoek|netcarta webmap engine|netmechanic|netresearchserver|netscoop|newscan\-online|nhse|nokia6682\/|nomad|noyona|nutch|nzexplorer|objectssearch|occam|omni|open text|openfind|openintelligencedata|orb search|osis\-project|pack rat|pageboy|pagebull|page_verifier|panscient|parasite|partnersite|patric|pear\.|pegasus|peregrinator|pgp key agent|phantom|phpdig|picosearch|piltdownman|pimptrain|pinpoint|pioneer|piranha|plumtreewebaccessor|pogodak|poirot|pompos|poppelsdorf|poppi|popular iconoclast|psycheclone|publisher|python|rambler|raven search|roach|road runner|roadhouse|robbie|robofox|robozilla|rules|salty|sbider|scooter|scoutjet|scrubby|search\.|searchprocess|semanticdiscovery|senrigan|sg\-scout|shai\'hulud|shark|shopwiki|sidewinder|sift|silk|simmany|site searcher|site valet|sitetech\-rover|skymob\.com|sleek|smartwit|sna\-|snappy|snooper|sohu|speedfind|sphere|sphider|spinner|spyder|steeler\/|suke|suntek|supersnooper|surfnomore|sven|sygol|szukacz|tach black widow|tarantula|templeton|\/teoma|t\-h\-u\-n\-d\-e\-r\-s\-t\-o\-n\-e|theophrastus|titan|titin|tkwww|toutatis|t\-rex|tutorgig|twiceler|twisted|ucsd|udmsearch|url check|updated|vagabondo|valkyrie|verticrawl|victoria|vision\-search|volcano|voyager\/|voyager\-hc|w3c_validator|w3m2|w3mir|walker|wallpaper|wanderer|wauuu|wavefire|web core|web hopper|web wombat|webbandit|webcatcher|webcopy|webfoot|weblayers|weblinker|weblog monitor|webmirror|webmonkey|webquest|webreaper|websitepulse|websnarf|webstolperer|webvac|webwalk|webwatch|webwombat|webzinger|wget|whizbang|whowhere|wild ferret|worldlight|wwwc|wwwster|xenu|xget|xift|xirq|yandex|yanga|yeti|yodao|zao\/|zippp|zyborg|\.\.\.\.)/i', $user_agent);
    }

    //example usage
    if (! is_bot($_SERVER["HTTP_USER_AGENT"])) echo "it's a human hit!";
?>

이제 음식 앱으로 리디렉션되기 때문에 원래 코드 소스에 대한 링크를 제거했습니다.


저는 현재 AWstats와 Webalizer를 사용하여 Apasce2에 대한 내 로그 파일을 모니터링하고 있으며 지금까지 꽤 잘하고 있습니다. 원하는 경우 오픈 소스 프로젝트이므로 소스 코드를 볼 수 있습니다.

http://awstats.sourceforge.net 에서 소스를 얻 거나 FAQ http://awstats.sourceforge.net/docs/awstats_faq.html 에서 확인할 수 있습니다.

도움이되는 희망, RayQuang


사용자 에이전트를 확인하면 스팸 발송자가 아닌 정직한 봇에게 경고가 표시됩니다.

부정직 한 봇이 어떤 요청을했는지 알기 위해 가장 좋은 방법은 ( 이 사람의 흥미로운 연구를 기반으로 ) 자바 스크립트 포커스 이벤트포착하는 것 입니다.

포커스 이벤트가 발생하면 페이지는 거의 확실히 사람이로드 한 것입니다.


엄청나게 긴 스파이더 사용자 에이전트 목록을 유지하려고하기보다는 인간의 행동을 암시하는 것을 찾습니다. 이 원칙의 원칙은 세션 수를 단일 페이지 세션 수와 다중 페이지 세션 수라는 두 가지 숫자로 나눈 것입니다. 세션 쿠키를 삭제하고이를 사용하여 다중 페이지 세션을 결정합니다. 또한 영구 "머신 ID"쿠키를 삭제합니다. 재 방문 사용자 (Machine ID 쿠키 발견)는 해당 세션에서 한 페이지 만 보더라도 다중 페이지 세션으로 처리됩니다. "인간"방문자를 암시하는 다른 특성이있을 수 있습니다. 예를 들어 리퍼러는 Google입니다. MS Search 봇은 사이트가 다른 콘텐츠를 표시하지 않는지 확인하기 위해 현실적인 키워드를 참조한 표준 UserAgent로 위장한다고 생각하지만 [ 봇에게 주어진 것],

물론 이것은 틀림 없으며, 특히 많은 사람들이 도착하여 "클릭"하는 경우 좋은 통계가되지 않거나 쿠키가 꺼진 사람들이 우세한 경우 (우리의 경우에는 세션 쿠키를 활성화하지 않으면 [장바구니] 사이트를 사용할 수 없습니다.)

고객 중 한 명으로부터 데이터를 가져 와서 일일 단일 세션 수가 모든 곳에서 발생한다는 사실을 발견했습니다. 그러나 하루에 다중 페이지 세션에서 1,000을 빼면 주문 당 4 개의 다중 페이지 세션 / 바구니 당 2 개의 세션이라는 엄청나게 선형에 가까운 비율을 갖게됩니다. 나는 하루에 다른 1,000 개의 다중 페이지 세션이 무엇인지 전혀 모른다!


자바 스크립트를 사용하여 마우스 움직임과 스크롤을 기록합니다. 기록 된 데이터를 통해 사람인지 봇인지 알 수 있습니다. 봇이 정말 정교하고 인간의 마우스 움직임을 모방하지 않는 한.


전제 조건 -리퍼러가 설정 됨

아파치 수준 :

LogFormat "%U %{Referer}i %{%Y-%m-%d %H:%M:%S}t" human_log
RewriteRule ^/human/(.*)   /b.gif [L]
SetEnv human_session 0

# using referrer
SetEnvIf Referer "^http://yoursite.com/" human_log_session=1

SetEnvIf Request_URI "^/human/(.*).gif$" human_dolog=1
SetEnvIf human_log_session 0 !human_dolog
CustomLog logs/human-access_log human_log env=human_dolog

웹 페이지에서 /human/$hashkey_of_current_url.gif.
봇인 경우 리퍼러가 설정되어있을 가능성이 낮습니다 (회색 영역).
브라우저 주소 표시 줄을 사용하여 직접 치면 포함되지 않습니다.

하루가 끝나면 /human-access_log실제로 사람의 페이지 뷰 인 모든 리퍼러를 포함해야합니다.

안전하게 플레이하려면 아파치 로그의 리퍼러 해시가 이미지 이름과 함께 집계되어야합니다.


이제 모든 종류의 헤드리스 브라우저가 있습니다. Chrome, Firefox 또는 기타 사이트에있는 모든 JS를 실행합니다. 따라서 JS 기반 탐지는 작동하지 않습니다.

I think the most confident way would be to track behavior on site. If I would write a bot and would like to by-pass checks, I would mimic scroll, mouse move, hover, browser history etc. events just with headless chrome. To turn it to the next level, even if headless chrome adds some hints about "headless" mode into the request, I could fork chrome repo, make changes and build my own binaries that will leave no track.

I think this may be the closest answer to real detection if it's human or not by no action from the visitor:

https://developers.google.com/recaptcha/docs/invisible

I'm not sure techniques behind this but I believe Google did a good job by analyzing billions of requests with their ML algorithms to detect if the behavior is human-ish or bot-ish.

while it's an extra HTTP request, it would not detect quickly bounced visitor so that's something to keep in mind.


Have a 1x1 gif in your pages that you keep track of. If loaded then its likely to be a browser. If it's not loaded it's likely to be a script.


=? Sorry, misunderstood. You may try another option I have set up at my site: create a non-linked webpage with a hard/strange name and log apart visits to this page. Most if not all of the visitor to this page will be bots, that way you'll be able to create your bot list dynamically.

Original answer follows (getting negative ratings!)

The only reliable way to tell bots from humans are [CAPTCHAS][1]. You can use [reCAPTCHA][2] if it suits you.

[1]: http://en.wikipedia.org/wiki/Captcha
[2]: http://recaptcha.net/


You could exclude all requests that come from a User Agent that also requests robots.txt. All well behaved bots will make such a request, but the bad bots will escape detection.

You'd also have problems with false positives - as a human, it's not very often that I read a robots.txt in my browser, but I certainly can. To avoid these incorrectly showing up as bots, you could whitelist some common browser User Agents, and consider them to always be human. But this would just turn into maintaining a list of User Agents for browsers instead of one for bots.

So, this did-they-request-robots.txt approach certainly won't give 100% watertight results, but it may provide some heuristics to feed into a complete solution.


I'm surprised no one has recommended implementing a Turing test. Just have a chat box with human on the other end.

A programatic solution just won't do: See what happens when PARRY Encounters the DOCTOR

These two 'characters' are both "chatter" bots that were written in the course of AI research in the '70: to see how long they could fool a real person into thinking they were also a person. The PARRY character was modeled as a paranoid schizophrenic and THE DOCTOR as a stereotypical psychotherapist.

Here's some more background

ReferenceURL : https://stackoverflow.com/questions/1717049/tell-bots-apart-from-human-visitors-for-stats

반응형