intelliproject logo

Location: Web development - PHP    License: The Common Public License Version 1.0 (CPL)

Intergrating Project Honeypot into your Website

Posted by xsist10

Use Project Honeypot to prevent spammers from accessing your website

Skill: Intermediate

Posted: 09/12/2008

Views: 648

Rating: 4.00 /5

Popularity: 0.00

Sign Up to vote for this article

Introduction

The Honeypot Project is a "distributed system for identifying spammers and the spambots they use to scrape addresses from your website" . It's a powerful tool for protecting your site from malicious visitors.

Getting Started

First things first, you will need to register on the new account on the website to get an API key to use the service. You will find your API key on the Black List configuration page.

Understanding the Black List API

The API uses a DNS IP lookup system to return data about the visitors IP address. To do the lookup you'll need to send a request to one of the projects DNS servers. The request looks something like this:

YourAPIKey.VisitorsIPAddressReversed.dnsbl.httpbl.org

So for example if our visitors IP address was 192.168.0.1 and our API key was abcdefghijk our request would look like this

abcdefghijk.1.0.168.192.dnsbl.httpbl.org

The request will then return a result that looks like an IP address. Each octet of the IP address will provide us with information about our visitor. The result can look like this:

127.5.10.1

Octet 1: If the request was successful then 127 will be returned. If 127 is not returned then there was an error.

Octet 2: This indicates when the visitors IP address was last logged in the Black List database (ranges from 0-255 days) and indicates how "stale" the data is.

Octet 3: This indicates the threat of the visitor (ranges from 0-255). 10 is not a high threat rating.

Octet 4: This indicates (in bitwise) what activity the visitor has been tagged with.

Value Meaning
0 Search Engine
1 Suspicious
2 Harvester
4 Comment Spammer

For instance a value of 6 indicates that the visitor is both a Harvestor and a Comment Spammer (2 + 4 = 6).

For a more detailed look at the API please visit the Black List API page.

Using the code

The code is broken up into 3 distinct parts.

Part 1 is a fairly comprehensive method of getting the visitors IP address.

Part 2 is the request and response from the Black List DNS server.

Part 3 is dealing with blocking certain visitors.

Points of Interest

The major problems with a remote service is time taken to preform a request and get the result back and the possibility of the remote service being down for maintanence or major congestions. To counter this you could store recent visits in a database and check in your database first instead of checking the Black List DNS server each page load.

You can also create a honey pot page and add it to the start your robot.txt file to catch inconsiderate crawlers before they land on any relevant pages.

Conclusion

Enjoy and remember that the honey pot service also has a number of other services that can help you secure your website.

References

http://www.projecthoneypot.org/about_us.php

Update history

09/12/2008 getIP() function was changed

License

This article, along with any associated source code and files, is licensed under The Common Public License Version 1.0 (CPL)

About the author

xsist10

Location: South Africa

Posted by Frank at 09/12/2008 08:18
Very useful, I think I try this. :)

Sign up to post message on the article message board!