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

@noscrape/noscrape

v2.1.1

Published

protect your content from scraping

Downloads

144

Readme

GitHub release License issues - noscrape Known Vulnerabilities

Concept

The primary mechanism behind noscrape is the utilization of any true-type font. From this, noscrape generates a new version with shuffled unicodes, ensuring that it's impossible to reverse-calculate them. This means that both strings and integers are obfuscated and can only be deciphered using the generated obfuscation-font.

While the glyph-paths inside the font cannot be entirely removed, they are obfuscated by randomly shifting them slightly. This makes it challenging to reverse-calculate them, but it's not entirely impossible, especially for machine learning algorithms. The developers are open to suggestions for improving this aspect.

Use-Cases

In an era where artificial intelligence is becoming increasingly integral to our daily lives, it's important to remember that AI thrives on data, and your data is a valuable commodity that shouldn't be given away lightly.

  1. Anti-Scraping Measures for Websites: Implement noscrape on your website to protect against web scrapers. This can be particularly useful for content that is unique to your site, so you wish to prevent it from being copied or used without permission.
    • sport results
    • betting results
    • prices (e-commerce)
    • geo-information
    • ...
  2. Protecting Sensitive Data Use noscrape to obfuscate sensitive information such as personal identifiers, financial details, or confidential text in a way that is visually accessible but protected against scraping and automated data extraction tools.
  3. Reduce Bot interactions Once your data is protected by noscrape it makes no sense to scrape them and one can reduce the number of bot interactions and so to lower costs at the end.
  4. Secure Applications In applications where data security is paramount, such as in banking or healthcare apps, noscrape can be used to display information in a secure manner.
    • PIN/TAN numbers
    • Bot protection (captcha)

Example code

Live demo

Installation

To install the @noscrape/noscrape package, simply run the following command in your project directory:

npm install @noscrape/noscrape

Basic Usage

Server-side
const { Noscrape } = require('@noscrape/noscrape');

// create noscrape instance
const noscrape = new Noscrape('path/to/font.ttf', { options })

// obfuscate data
const number = noscrape.obfuscate(123);
const string = noscrape.obfuscate("noscrape");
const object = noscrape.obfuscate({ title: "noscrape", text: "obfuscation" });

// generate obfuscation font buffer after all obfuscation is done
const font = noscrape.getFont();

then provide font and data to the client/frontend

Client-side
<style> 
    @font-face {        
        font-family: 'noscrape-obfuscated';        
        src: url('data:font/truetype;charset=utf-8;base64,${font.toString("base64")}');    
    }
</style>

The font is delivered in a buffer format. To utilize it in our web pages, we convert it into a base64 URL and embed it within a custom @font-face declaration. Once this is done, we can display the obfuscated data using the specified font-family in our styles.

<span style="font-family: noscrape-obfuscated">
    <div>{ object.title }</div>
    <div>{ object.text }</div>
</span>

IMPORTANT NOTE

Bots might not be able to process obfuscated text, which can lead to unpredictable analytics results. Therefore, it's advised not to use this technology on content that's essential for indexed pages. The obfuscation process takes some time (around 50-60ms on standard machines). For API requests, it's recommended to put the obfuscation logic into a scheduled task and reuse the results, rather than recalculating everything for every request.

Options

  • Strength (obfuscation strength multiplier) Default is 1. Values below 0.1 are not recommended as paths can be easily reverse-calculated. Values over 10 might not look visually appealing.
  • Character Range This defines the character range used for encryption. Options include:
    • PRIVATE_USE_AREA (default)
    • LATIN
    • GREEK
    • CYRILLIC
    • HIRAGANA
    • KATAKANA
  • Low Memory This option is for situations with limited memory where noscrape cannot load the provided font file. Default is false.

Contributions

The developers welcome contributions, issues, and feature requests. If you've used this package and fixed a bug, they encourage you to submit a PR.

License

The package is licensed under the MIT License by Bernhard Schönberger.