Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including honeypot with all npm packages installed. Try it out:

var honeypot = require("honeypot")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

honeypot v0.0.2

Node.js implementation of the Project Honeypot (Http:BL) API. Because we all hate spam.

honeypot

Node.js implementation of the Project Honeypot (Http:BL) API. Because we all hate spam.

  • Utilizes Http:BL from known and loved https://www.projecthoneypot.org/
  • Uses built-in node dns.resolve4 to get response from the DNS API
  • No Unicorns were harmed during development

Installation

npm install honeypot

Usage

var honeypot = require('honeypot');

var pot = new honeypot('your_api_key');

pot.query('127.0.0.1', function(err, response){
    if (!response) {
        console.log("IP not found in honeypot, we're all good!");
    } else {
        console.log("Oh no, it's a spammer mate! Kil it with fire!");
        console.log(response.getFormattedResponse());
        // Suspiious, Comment Spammer
        // Threat Rating: 58 / 255
        // Recency: 1 / 255
    }
});

Example within Express

var honeypot = require('honeypot');

var pot = new honeypot('your_api_key');

// example route for POST /comment/
create: function(req, res) {
    
    pot.query(req.ip, function(err, response){
      if (!response) {
        console.log("IP not found in honeypot, we're all good!");
        // do some commentary magic
        res.send({ msg: 'we hate spam!' });
      } else {
        console.log("Die!");
        res.send(null);
      }
    });
}

Kudos

Based on this sweet PHP gist https://gist.github.com/smithweb/7773373.

License

MIT

Free Software, Hell Yeah!

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free