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

sscrpted

v1.0.7

Published

Sscrpted uses AES-256 and scrypt to generate static password protected HTML pages with assets such as scripts, images and stylesheets used

Downloads

35

Readme

Sscrpted

Sscrpted uses AES-256 and scrypt to generate static password protected HTML pages with assets such as scripts, images and stylesheets used.

Example

Install

npm install sscrpted

Usage

Usage:
  sccrpted <page> <login> <password> <output> [options]

  <page>:     path to html page to encrypt
  <login>:    path to html page for user login
  <password>: password to encrypt with
  <output>:   path to output '.html' page

Options:
  -s <salt>:  use custom salt (default is 'abc123!@#')

Example

sscrpted index.html login.html abc123 out/index.html

Page

All text contents of the HTML file will be encrypted.

You can mark external content to be encrypted by formatting it as such: {{{$encrypt:file_name.ext}}}

Example

<html>
  <head>
    <title>My Encrypted Website</title>
    <link href="{{{$encrypt:style.css}}}" rel="stylesheet"></link>
  </head>
  <body>
    Hello, World!
    <img src="{{{$encrypt:image.png}}}"></img>
  </body>
</html>

Login Page

You can write a custom login page which is shown when logging into your encrypted site.

This is done by embedding {{{$script}}} into your login page and using the page_login(password) function.

page_login(password)

page_login() takes in the site password as a string. If the password is incorrect it will return false and vice versa if it is correct. However, if it is correct, all current nodes will be deleted from the document.

Ensure that {{{$script}}} is embedded in the page before your script used to login or it may be marked as undefined.

Example

<html>
  <body>
    {{{$script}}}
    <script>
      while (!page_login(prompt("password:"))) {
        alert("incorrect password");
      }
    </script>
  </body>
</html>

Options

| Option | Description | | :-- | :--- | | -s <salt> | You can specify the salt used to encrypt the website |

How it works

  • Sscrpted scans the target file for all instances matching a regex which marks a file to be encrypted and thus encrypts and saves it.

  • It then also encrypts contents of the HTML page encoded in hex and is embedded into a script which is loaded with the login page.

  • If the password is correct then the script will decrypt the encrypted html page and replace the current page with its contents.

  • The script then recursively scans the nodes for hrefs or src attributes. Any found with a value matching a certain regex will have its encrypted equivalent file loaded and decrypted using the same key and stored in a blob. It will then replace the href or src value with a new blob url.

  • Page scripts are then re executed by recreating the object and copying its contents into the new one, then replacing it.