npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

botex

v1.0.0

Published

Obfuscate email addresses and other personal data, so bots can't scrape them

Downloads

6

Readme

botex

npm package npm bundle size NPM GitHub last commit Code Style Prettier Test Status

Obfuscate email addresses and other personal data, so bots can't scrape them.

Some personal information like email addresses or phone numbers, should never appear in plain text in your website's source code, so bots can't scrape them. Otherwise your contact information is in danger of being the target of spam mails or sms. This is where botex comes in. Using its CLI, the botex webapp, or using the library server side, you can hide your personal contact info from bots. Usually, this is done by base64 encoding the email or tel strings and only decoding them when a user clicks on a mailto link for example. But scraping bots have improved and can nowadays automatically decipher base64 or other simple ciphers, such as cesar ciphers. botex obfuscates personal information by using a key - that can be any string - to scramble the input. Doing that, it makes it much harder for bots to deobfuscate the data, as they'd first need to find out that you're using botex and then not only find the encoded information, but also the key for it. Specialized bots would first have to be developed to do this, which is hopefully to much of a hassle for hackers to be done.

botex tries to be a compromise between being secure (it's not securely encrypting anything, but hopefully annoying bots enough to give up) and being simple (the functions are straight forward and the lib much smaller than 1kb). Just be aware, that you're not perfectly protected just because your using botex, but you're certainly better off than using base64.

Now you might ask, how to put your email address on your webpage for everyone to see, without actually having it in your source code... For that I recommend creating an SVG image from your email address with a tool, such as Google Font to Svg Path. When that SVG is clicked you can open a mailto link, that you decrypt using botex. Some people encode email addresses as HTML entities or put them on the page in reverse character order and flip them again using CSS, but I suspect that bots have by now gotten the hang of that, too.

One note on the opening of mailto links on click though... I don't know about you, but I hate when a page is doing that... I much prefer having two icons either next to the email, or appearing as a popup on hover or on click, that let you select to either open the mailto link or to copy the mail to the clipboard. Checkout this example for selectively copying the mail or opening it.

Usage

import { scramble, unscramble } from "botex";

const key = "abc123xyz";
const mail = "[email protected]";
const obfuscatedMail = scramble(mail, key);
// -> some gibberish bots hopefully can't read...

// ...

const key = "abc123xyz";
const scrambledMail = "Aasd123Bsdf..."; // Some gibberish...
const mailtoLink = document.querySelector("#mail-link");

mailtoLink.onclick = () => {
	// Get back the original data
	const originalMail = unscramble(scrambledMail, key);
	location.href = `mailto:${originalMail}`;
};

CLI

botex comes with a cli that helps you to obfuscate information and to create keys, so you can just copy them into your project.

$ botex --help

Usage: botex [options] [command]

Options:
  -v, --version                 output the version number
  -h, --help                    display help for command

Commands:
  scramble [options] <input>    Obfuscate the input string, so that bots (hopefully) can't read it (default command)
  unscramble [options] <input>  Deobfuscate a scrambled string to retrieve the original data
  help [command]                display help for command
$ botex scramble --help

Usage: botex scramble [options] <input>

Obfuscate the input string, so that bots (hopefully) can't read it (default command)

Options:
  -k, --key <key>            The key used to obfuscate the input. This can be any string
  -a, --auto-key             If present, botex will auto generate a key for you (default: false)
  -b, --alphabet <alphabet>  The set of characters botex should use to generate a key (default:
                             "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
  -l, --key-length <length>  The length of the generated key (default: "16")
  -s, --code-snippet         Print a JS code snippet using the created values (default: false)
  -h, --help                 display help for command
$ botex unscramble --help

Usage: botex unscramble [options] <input>

Deobfuscate a scrambled string to retrieve the original data

Options:
  -k, --key <key>  The key used to obfuscate the input
  -h, --help       display help for command

License

MIT