There are two techniques I've been using recently to identify automated visitors and nasties.

The first is simply to do a reverse DNS lookup. The legitimate bots (msn, google, yahoo) have registered the IP address of their bots and often include the word "bot" in the name (e.g. google bot). That is the easy way.

Of course, the illegimate spider or reckless wget user is not going to be so obliging. Those annoying visitors will normally have domain names indicating a dynamic IP address, or even no reverse DSN lookup at all! For these, I use a script I wrote that looks for certain behavioral patterns.

Humans and bots are trying to do different things on a site and so they behave differently. Human users who spend a long time on the site tend to visit selected pages and may visit them repeatedly. It takes a certain physical amount of time to move from page to page so the number of hits per minute should be much less than a bot. Human beings also tend to visit content pages and items linked directly to those pages.

An IP address that is hitting your site with requests 100x a minute or is visiting every page on your site just once (or doing both at the same time!) is most likely *not* human. So I look first for IP addresses that have contributed heavily to bursts in traffic. I also look for IP addresses that have visited large numbers of pages or are systemically visiting pages that are supposed to be off limits to robots or of little interest to human visitors.

Knowing that a certain IP address is a bot or spider doesn't necessarily buy you much. If you are trying to improve statistics used for marketing, I suppose you can just eliminate the probable bots from your stats. However, if your goal is security, I'm not sure knowing that an IP is a bot is going to help you much.

Dynamic IP addresses shift around so blocking Mr. Bad Guy today at IP xxx.xxx.xxx.xxx today may block Mr Good Guy to tomorrow. To block such IP addresses you would probably need some type of software that allows you to expire the block based on the length of time since the bad behavior occured.

Best, beth


In reply to Re: User tracking by ELISHEVA
in thread User tracking by gemoroy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.