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

ez-bruteforcer

v1.0.2

Published

Easy to use package for bruteforce attacks, with support for ECMAScript and CJS

Downloads

115

Readme

ez-bruteforcer

Easy to use package for bruteforce attacks, with support for ECMAScript and CJS MIT License

Table of contents

Import

Import with CommonJS...

const bruteforce = require("ez-bruteforcer");

...or with ECMAScript!

import bruteforce from "ez-bruteforcer";

API Reference

getDispositionsNumber()

Calculate all the dispositions

Will calculate all the avaiable dispositions without finding them

bruteforce.getDispositionsNumber("oh!sle", 6, 1);

| Parameter | Type | Description | | :---------- | :------------------ | :------------------------------------------------------------------------- | | array | array \|\| string | Required. The array where you want to calculate the dispositions | | maxLength | number | Required. The maxium length of the password | | minLength | number | Optional. The minium length of the password, if null will default to 1 |

runSync()

Find all dispositions

Will start the bruteforce attack

bruteforce.runSync({
    data: [],
    step: (value) => return false,
    finish: () => { console.log('finished') },  // Optional
    maxLength: 2,
    minLength: 1 // Optional
})

This function only takes one options argument

  • data [ARRAY / STRING] (required) - The characters list to perform the attack, you can use an array or a string.
  • step [FUNCTION] (required) - This function will be called every time a new iteration is found, and it will pass as argument the current iteration value. It acts as a "validator" and must always return true or false. If it returns true it will stop searching, if instead returns false it will continue to iterate.
  • finish [FUNCTION] (optional) - This function will be called when all the iteration will be done. NOTE: It will only be executed when the script finishes the iteration, this means that if a function in the step key will return true before it finishes everything this function will not be triggered.
  • maxLength [NUMBER] (required) - The maxium length of the password.
  • minLength [NUMBER] (optional) - The minium length of the password, if not specified, will be defaulted to 1

Usage/Examples

import bruteforce from "ez-bruteforcer";

const charactersList = "oh!sle";
const secretPassword = "hello!";
bruteforce.runSync({
  data: charactersList,
  step: (attempt) => {
    console.log(`Trying password: ${attempt}`);
    if (attempt == secretPassword) {
      console.log(`> Found password: ${attempt}`);
      return true;
    } else return false;
  },
  finish: () => {
    console.log("> Nothing has been found:(");
  },
  maxLength: 6,
  minLength: 1,
});
console.log(
  "> Total possible combinations: " +
    bruteforce.getDispositionsNumber(charactersList, 6, 1)
);

/*
...
Trying password: lsllo!
Trying password: esllo!
Trying password: olllo!
Trying password: hlllo!
Trying password: !lllo!
Trying password: slllo!
Trying password: llllo!
Trying password: elllo!
Trying password: oello!
Trying password: hello!
> Found password: hello!
> Total possible combinations: 55986
*/

Credits

  • I "stole" the code to find the dispositions from the class "BaseN" in the package js-combinatorics to then modify it to make it work for a bruteforce attack

Authors