program tip

'스텔스'웹 크롤러 감지

radiobox 2020. 8. 8. 12:15
반응형

'스텔스'웹 크롤러 감지


탐지를 원하지 않는 웹 크롤러를 탐지하기 위해 어떤 옵션이 있습니까?

(목록 탐지 기술을 사용하면 스마트 스텔스 크롤러 프로그래머가 더 나은 스파이더를 만들 수 있다는 것을 알고 있지만 어쨌든 스마트 스텔스 크롤러를 차단할 수는 없을 것입니다.

googlebot 및 Yahoo!와 같은 멋진 크롤러에 대해 말하는 것이 아닙니다. 슬러 프. 다음과 같은 경우 봇이 좋다고 생각합니다.

  1. 사용자 에이전트 문자열에서 자신을 봇으로 식별합니다.
  2. robots.txt를 읽고 준수합니다.

나는 나쁜 크롤러 에 대해 이야기하고 있고 , 일반적인 사용자 에이전트 뒤에 숨어 있고, 내 대역폭을 사용하고, 대가로 아무것도주지 않습니다.

업데이트 된 목록을 구성 할 수있는 몇 가지 트랩 도어가 있습니다 (Chris, gs에게 감사합니다) .

  1. robots.txt에 나열된 (허용되지 않음으로 표시됨) 디렉토리 추가,
  2. 보이지 않는 링크 추가 (아마도 rel = "nofollow"?로 표시됨),
    • style = "디스플레이 : 없음;" 링크 또는 상위 컨테이너
    • Z- 색인이 더 높은 다른 요소 아래에 배치
  3. CaPiTaLiSaTioN을 이해하지 못하는 사람을 감지합니다.
  4. 누가 답글을 게시하려고하지만 항상 보안 문자가 실패하는지 감지합니다.
  5. POST 전용 리소스에 대한 GET 요청 감지
  6. 요청 간 간격 감지
  7. 요청 된 페이지 순서 감지
  8. http를 통해 https 리소스를 (일관되게) 요청하는 사람 감지
  9. 이미지 파일을 요청하지 않는 사람 감지 (알려진 이미지 지원 브라우저의 사용자 에이전트 목록과 결합하면 놀랍도록 훌륭하게 작동합니다)

일부 트랩은 '좋은'봇과 '나쁜'봇 모두에 의해 트리거됩니다. 이를 화이트리스트와 결합 할 수 있습니다.

  1. 함정을 유발합니다.
  2. 요청 robots.txt?
  3. 순종했기 때문에 다른 함정을 트리거하지 않습니다. robots.txt

여기에서 또 다른 중요한 사항은 다음과 같습니다.
시각 장애인이 스크린 리더를 사용하는 것을 고려하십시오. 사람들에게 연락 할 수있는 방법을 제공하거나 (이미지가 아닌) 보안 문자를 해결하여 계속 탐색하십시오.

정상적인 인간 방문자로 위장하려는 웹 크롤러를 자동으로 감지하는 방법은 무엇입니까?

업데이트
문제는 아닙니다. 모든 크롤러를 어떻게 잡아야합니까? 문제는 크롤러를 감지 할 가능성을 극대화 할 수있는 방법입니다.

일부 거미는 정말 훌륭하고 실제로 html, xhtml, css javascript, VB 스크립트 등을 구문 분석하고 이해합니다
. 나는 환상이 없습니다. 나는 그들을 이길 수 없을 것입니다.

그러나 일부 크롤러가 얼마나 어리석은 지 놀랄 것입니다. 어리 석음의 가장 좋은 예는 (내 의견으로는) 요청하기 전에 모든 URL을 소문자로 변환하는 것입니다.

그리고 다양한 함 정문을 피하기에 '충분하지 않은'크롤러가 많이 있습니다.


얼마 전에 저는 작은 호스팅 회사와 협력하여 이에 대한 솔루션을 구현하도록 돕습니다. 내가 개발 한 시스템은 주어진 IP 주소에서 과도한 활동이 있는지 웹 서버 로그를 조사하고 위반자를 차단하는 방화벽 규칙을 발행했습니다. 여기에는 http://www.iplists.com/을 기반으로 한 IP 주소 / 범위의 화이트리스트가 포함되어 있으며, 요청 된 사용자 에이전트 문자열을 확인하고 클라이언트가 합법적 인 스파이더라고 주장하는 경우 필요에 따라 자동으로 업데이트되었습니다. 허용 목록에서 DNS / 역 DNS 조회를 수행하여 소스 IP 주소가 봇의 요청 된 소유자와 일치하는지 확인했습니다. 안전 장치로서 이러한 조치는 잘못된 평가의 경우 주소를 블랙 / 화이트리스트에 추가하는 링크와 함께 이메일로 관리자에게보고되었습니다.

나는 6 개월 정도 동안 그 고객과 이야기하지 않았지만, 마지막으로 들었을 때 시스템이 매우 효과적으로 작동하고 있었다.

사이드 포인트 : 적중률 제한을 기반으로하는 유사한 감지 시스템을 수행하려는 경우 최소 1 분 (가급적 최소 5 분) 합계를 사용해야합니다. 나는 (이미지는 집계에서 제외되지 않는 한) 이미지가 많은 페이지에 오탐 (false positive)을 생성 할 수 있으며, 두 번째에서 5 ~ 10 안타를 꼭대기 블록 누구로 할 계획 이러한 종류의 이야기 많은 사람들이 볼 거짓 생성을 나와 같은 사람이 모든 것을 읽고 싶은 흥미로운 사이트를 발견하면 첫 번째를 읽는 동안 탭의 모든 링크를 열어 백그라운드에서로드 할 수 있습니다.


See Project Honeypot - they're setting up bot traps on large scale (and have DNSRBL with their IPs).

Use tricky URLs and HTML:

<a href="//example.com/"> = http://example.com/ on http pages.
<a href="page&amp;&#x23;hash"> = page& + #hash

In HTML you can use plenty of tricks with comments, CDATA elements, entities, etc:

<a href="foo<!--bar-->"> (comment should not be removed)
<script>var haha = '<a href="bot">'</script>
<script>// <!-- </script> <!--><a href="bot"> <!-->

An easy solution is to create a link and make it invisible

<a href="iamabot.script" style="display:none;">Don't click me!</a>

Of course you should expect that some people who look at the source code follow that link just to see where it leads. But you could present those users with a captcha...

Valid crawlers would, of course, also follow the link. But you should not implement a rel=nofollow, but look for the sign of a valid crawler. (like the user agent)


One thing you didn't list, that are used commonly to detect bad crawlers.

Hit speed, good web crawlers will break their hits up so they don't deluge a site with requests. Bad ones will do one of three things:

  1. hit sequential links one after the other
  2. hit sequential links in some paralell sequence (2 or more at a time.)
  3. hit sequential links at a fixed interval

Also, some offline browsing programs will slurp up a number of pages, I'm not sure what kind of threshold you'd want to use, to start blocking by IP address.

This method will also catch mirroring programs like fmirror or wget.

If the bot randomizes the time interval, you could check to see if the links are traversed in a sequential or depth-first manner, or you can see if the bot is traversing a huge amount of text (as in words to read) in a too-short period of time. Some sites limit the number of requests per hour, also.

실제로 어딘가에서 아이디어를 들었습니다. 사용자가 킬로바이트 단위로 너무 많은 데이터를 가져 오면 봇이 아님을 증명하라는 보안 문자가 표시 될 수 있다는 생각이 들지 않습니다. 그래도 구현 된 것을 본 적이 없습니다.

링크 숨기기에 대한 업데이트

링크를 숨기는 한, CSS (그리기 순서에서 먼저 배치)를 사용하여 div를 다른 아래에 배치하고 z 순서를 설정할 수 있습니다. 봇은 메뉴인지 확인하기 위해 모든 자바 스크립트를 구문 분석하지 않고는이를 무시할 수 없습니다. 어느 정도까지는 보이지 않는 DIV 요소 내부의 링크도 봇이 모든 자바 스크립트를 구문 분석하지 않고는 무시할 수 없습니다.

그 아이디어를 완성하면 숨겨진 요소를 잠재적으로 보여줄 수있는 javascript가 자바 스크립트 구문 분석 봇의 하위 집합을 속일 수 있습니다. 그리고 구현할 작업이 많지 않습니다.


One simple bot detection method I've heard of for forms is the hidden input technique. If you are trying to secure a form put a input in the form with an id that looks completely legit. Then use css in an external file to hide it. Or if you are really paranoid, setup something like jquery to hide the input box on page load. If you do this right I imagine it would be very hard for a bot to figure out. You know those bots have it in there nature to fill out everything on a page especially if you give your hidden input an id of something like id="fname", etc.


Untested, but here is a nice list of user-agents you could make a regular expression out of. Could get you most of the way there:

ADSARobot|ah-ha|almaden|aktuelles|Anarchie|amzn_assoc|ASPSeek|ASSORT|ATHENS|Atomz|attach|attache|autoemailspider|BackWeb|Bandit|BatchFTP|bdfetch|big.brother|BlackWidow|bmclient|Boston\ Project|BravoBrian\ SpiderEngine\ MarcoPolo|Bot\ mailto:craftbot@yahoo.com|Buddy|Bullseye|bumblebee|capture|CherryPicker|ChinaClaw|CICC|clipping|Collector|Copier|Crescent|Crescent\ Internet\ ToolPak|Custo|cyberalert|DA$|Deweb|diagem|Digger|Digimarc|DIIbot|DISCo|DISCo\ Pump|DISCoFinder|Download\ Demon|Download\ Wonder|Downloader|Drip|DSurf15a|DTS.Agent|EasyDL|eCatch|ecollector|efp@gmx\.net|Email\ Extractor|EirGrabber|email|EmailCollector|EmailSiphon|EmailWolf|Express\ WebPictures|ExtractorPro|EyeNetIE|FavOrg|fastlwspider|Favorites\ Sweeper|Fetch|FEZhead|FileHound|FlashGet\ WebWasher|FlickBot|fluffy|FrontPage|GalaxyBot|Generic|Getleft|GetRight|GetSmart|GetWeb!|GetWebPage|gigabaz|Girafabot|Go\!Zilla|Go!Zilla|Go-Ahead-Got-It|GornKer|gotit|Grabber|GrabNet|Grafula|Green\ Research|grub-client|Harvest|hhjhj@yahoo|hloader|HMView|HomePageSearch|http\ generic|HTTrack|httpdown|httrack|ia_archiver|IBM_Planetwide|Image\ Stripper|Image\ Sucker|imagefetch|IncyWincy|Indy*Library|Indy\ Library|informant|Ingelin|InterGET|Internet\ Ninja|InternetLinkagent|Internet\ Ninja|InternetSeer\.com|Iria|Irvine|JBH*agent|JetCar|JOC|JOC\ Web\ Spider|JustView|KWebGet|Lachesis|larbin|LeechFTP|LexiBot|lftp|libwww|likse|Link|Link*Sleuth|LINKS\ ARoMATIZED|LinkWalker|LWP|lwp-trivial|Mag-Net|Magnet|Mac\ Finder|Mag-Net|Mass\ Downloader|MCspider|Memo|Microsoft.URL|MIDown\ tool|Mirror|Missigua\ Locator|Mister\ PiX|MMMtoCrawl\/UrlDispatcherLLL|^Mozilla$|Mozilla.*Indy|Mozilla.*NEWT|Mozilla*MSIECrawler|MS\ FrontPage*|MSFrontPage|MSIECrawler|MSProxy|multithreaddb|nationaldirectory|Navroad|NearSite|NetAnts|NetCarta|NetMechanic|netprospector|NetResearchServer|NetSpider|Net\ Vampire|NetZIP|NetZip\ Downloader|NetZippy|NEWT|NICErsPRO|Ninja|NPBot|Octopus|Offline\ Explorer|Offline\ Navigator|OpaL|Openfind|OpenTextSiteCrawler|OrangeBot|PageGrabber|Papa\ Foto|PackRat|pavuk|pcBrowser|PersonaPilot|Ping|PingALink|Pockey|Proxy|psbot|PSurf|puf|Pump|PushSite|QRVA|RealDownload|Reaper|Recorder|ReGet|replacer|RepoMonkey|Robozilla|Rover|RPT-HTTPClient|Rsync|Scooter|SearchExpress|searchhippo|searchterms\.it|Second\ Street\ Research|Seeker|Shai|Siphon|sitecheck|sitecheck.internetseer.com|SiteSnagger|SlySearch|SmartDownload|snagger|Snake|SpaceBison|Spegla|SpiderBot|sproose|SqWorm|Stripper|Sucker|SuperBot|SuperHTTP|Surfbot|SurfWalker|Szukacz|tAkeOut|tarspider|Teleport\ Pro|Templeton|TrueRobot|TV33_Mercator|UIowaCrawler|UtilMind|URLSpiderPro|URL_Spider_Pro|Vacuum|vagabondo|vayala|visibilitygap|VoidEYE|vspider|Web\ Downloader|w3mir|Web\ Data\ Extractor|Web\ Image\ Collector|Web\ Sucker|Wweb|WebAuto|WebBandit|web\.by\.mail|Webclipping|webcollage|webcollector|WebCopier|webcraft@bea|webdevil|webdownloader|Webdup|WebEMailExtrac|WebFetch|WebGo\ IS|WebHook|Webinator|WebLeacher|WEBMASTERS|WebMiner|WebMirror|webmole|WebReaper|WebSauger|Website|Website\ eXtractor|Website\ Quester|WebSnake|Webster|WebStripper|websucker|webvac|webwalk|webweasel|WebWhacker|WebZIP|Wget|Whacker|whizbang|WhosTalking|Widow|WISEbot|WWWOFFLE|x-Tractor|^Xaldon\ WebSpider|WUMPUS|Xenu|XGET|Zeus.*Webster|Zeus [NC]

Taken from: http://perishablepress.com/press/2007/10/15/ultimate-htaccess-blacklist-2-compressed-version/


It's not actually that easy to keep up with the good user agent strings. Browser versions come and go. Making a statistic about user agent strings by different behaviors can reveal interesting things.

I don't know how far this could be automated, but at least it is one differentiating thing.


You can also check referrals. No referral could raise bot suspition. Bad referral means certainly it is not browser.

Adding invisible links (possibly marked as rel="nofollow"?),

* style="display: none;" on link or parent container
* placed underneath another element with higher z-index

I would'nt do that. You can end up blacklisted by google for black hat SEO :)


I currently work for a company that scans web sites in order to classify them. We also check sites for malware.

In my experience the number one blockers of our web crawler (which of course uses a IE or Firefox UA and does not obey robots.txt. Duh.) are sites intentionally hosting malware. It's a pain because the site then falls back to a human who has to manually load the site, classify it and check it for malware.

I'm just saying, by blocking web crawlers you're putting yourself in some bad company.

Of course, if they are horribly rude and suck up tons of your bandwidth it's a different story because then you've got a good reason.


People keep addressing broad crawlers but not crawlers that are specialized for your website.

I write stealth crawlers and if they are individually built no amount of honey pots or hidden links will have any effect whatsoever - the only real way to detect specialised crawlers is by inspecting connection patterns.

The best systems use AI (e.g. Linkedin) use AI to address this.
The easiest solution is write log parsers that analyze IP connections and simply blacklist those IPs or serve captcha, at least temporary.

e.g.
if IP X is seen every 2 seconds connecting to foo.com/cars/*.html but not any other pages - it's most likely a bot or a hungry power user.

Alternatively there are various javascript challenges that act as protection (e.g. Cloudflare's anti-bot system), but those are easily solvable, you can write something custom and that might be enough deterrent to make it not worth the effort for the crawler.

However you must ask a question are you willing to false-positive legit users and introduce inconvenience for them to prevent bot traffic. Protecting public data is an impossible paradox.


short answer: if a mid level programmer knows what he's doing you won't be able to detect a crawler without affecting the real user. Having your information publicly you won't be able to defend it against a crawler... it's like the 1st amendment right :)

참고URL : https://stackoverflow.com/questions/233192/detecting-stealth-web-crawlers

반응형