Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@haileybot/captcha-generator
Advanced tools
An NPM package to generate captcha images that can be used in Discord bots or various other projects
Captcha Generator is a Node library for quickly and easily generating captcha images that can be used through an authorized bot to verify human users on a chat platform such as Slack or Discord.
Use the package manager npm to install Captcha Generator
npm i @haileybot/captcha-generator
// Import the module
const Captcha = require("@haileybot/captcha-generator");
// Create a new Captcha object
// - Optional argument to specify image height (250 to 400px, default 250)
// - Image width is 400px
// - Returned object will contain 4 properties
// - "PNGStream" is a stream object for the image file in PNG format
// - "JPEGStream" is a stream object for the image file in JPEG format
// - "dataURL" is a data URL containing the JPEG image data
// - "value" is the 6 character code the image contains
let captcha = new Captcha();
console.log(captcha.value);
const path = require("path"),
fs = require("fs"),
Captcha = require("@haileybot/captcha-generator");
let captcha = new Captcha();
captcha.PNGStream.pipe(fs.createWriteStream(path.join(__dirname, `${captcha.value}.png`)));
captcha.JPEGStream.pipe(fs.createWriteStream(path.join(__dirname, `${captcha.value}.jpeg`)));
This example assumes you already have the core framework of a Discord Bot set up
const Captcha = require("@haileybot/captcha-generator");
// Use this function for blocking certain commands or features from automated self-bots
function verifyHuman(msg) {
let captcha = new Captcha();
msg.channel.send(
"**Enter the text shown in the image below:**",
new Discord.MessageAttachment(captcha.JPEGStream, "captcha.jpeg")
);
let collector = msg.channel.createMessageCollector(m => m.author.id === msg.author.id);
collector.on("collect", m => {
if (m.content.toUpperCase() === captcha.value) msg.channel.send("Verified Successfully!");
else msg.channel.send("Failed Verification!");
collector.stop();
});
}
This project is licensed under GPL-3.0
FAQs
An NPM package to generate captcha images that can be used in Discord bots or various other projects
We found that @haileybot/captcha-generator 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.