Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
akismet-api
Advanced tools
Nodejs bindings to the Akismet (https://akismet.com) spam detection service
Full Nodejs bindings to the Akismet (https://akismet.com) spam detection service.
Features:
Upgrading to 3.0? You likely don't need to change anything, but check out the changelog.
npm install akismet-api
The blog and key values are required by Akismet. There are a set of other avaliable default options visible in the source, but you likely will not need to change those.
var akismet = require('akismet-api');
var client = akismet.client({
key : 'myKey', // Required!
blog : 'https://myblog.com' // Required!
});
All of the function methods below support both promises and callbacks!
The returned promises use the Bluebird promise library.
The following documentation primarily uses the callback version, but to return a promise simply don't provide a callback.
Here is an example of the promise version of the verifyKey()
function:
client.verifyKey()
.then(function(valid) {
if (valid) console.log('Valid key!');
else console.log('Invalid key!');
})
.catch(function(err) {
console.log('Check failed: ' + err.message);
}):
It's a good idea to verify your key before use. If your key returns as invalid, the error field will contain the debug help message returned by Akismet.
client.verifyKey(function(err, valid) {
if (err) console.log('Error:', err.message);
if (valid) console.log('Valid key!');
else console.log('Invalid key!');
});
The user_ip, user_agent, and referrer are required options. All other options are optional, but will provide you with better spam detection accuracy.
client.checkSpam({
user_ip : '123.123.123.123', // Required!
user_agent : 'MyUserAgent 1.0 Webkit', // Required!
referrer : 'https://google.com', // Required!
permalink : 'https://myblog.com/myPost',
comment_type : 'comment',
comment_author : 'John Smith',
comment_author_email : 'john.smith@gmail.com',
comment_author_url : 'https://johnsblog.com',
comment_content : 'Very nice blog! Check out mine!',
is_test : true // Default value is false
}, function(err, spam) {
if (err) console.log ('Error!');
if (spam) {
console.log('OMG Spam!');
} else {
console.log('Totally not spam');
}
});
If Akismet reports something as not-spam, but it turns out to be spam anyways, we can report this to Akismet via this API call.
client.submitSpam({
user_ip : '123.123.123.123', // Required!
user_agent : 'MyUserAgent 1.0 Webkit', // Required!
referrer : 'https://google.com', // Required!
permalink : 'https://myblog.com/myPost',
comment_type : 'comment',
comment_author : 'John Smith',
comment_author_email : 'john.smith@gmail.com',
comment_author_url : 'https://johnsblog.com',
comment_content : 'Very nice blog! Check out mine!',
is_test : true // Default value is false
}, function(err) {
if (!err) {
console.log('Spam reported!');
}
});
If Akismet reports something as spam, but it turns out to not be spam anyways, we can report this to Akismet via this API call.
client.submitHam({
user_ip : '123.123.123.123', // Required!
user_agent : 'MyUserAgent 1.0 Webkit', // Required!
referrer : 'https://google.com', // Required!
permalink : 'https://myblog.com/myPost',
comment_type : 'comment',
comment_author : 'John Smith',
comment_author_email : 'john.smith@gmail.com',
comment_author_url : 'https://johnsblog.com',
comment_content : 'Very nice blog! Check out mine!',
is_test : true // Default value is false
}, function(err) {
if (!err) {
console.log('Non-spam reported!');
}
});
cd node_modules/akismet-api
npm test
Author and maintainer is Chris Foster. Development was sponsored by Two Story Robot.
Released under the MIT license.
See LICENSE.txt for more information.
FAQs
Nodejs bindings to the Akismet (https://akismet.com) spam detection service
We found that akismet-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.