New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hashcat-reverse-rules-js

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hashcat-reverse-rules-js

Reverse rules hashcat engine and generating candidates for password for complex search

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

hashcat-reverse-rules-js

The library is used to reverse the password based on hashcat rules. Given a final password and one or more Hashcat rules, the library generates candidate inputs that - when the rules are applied - produce that final password.

Password123 ---- > Password, $1$2$3

This is useful for improving wordlists, narrowing down candidate inputs, and for research into rule-based password transformations. For background on rules and rule syntax, see the Hashcat wiki.

Installation

npm install hashcat-reverse-rules-js

Compiles and minifies for production

npm run build

Usage

applyReverseRule

function applyReverseRule(password, rule, memlimit=65000, limit=10)

Generate possible input candidates that would become a password after applying the rule.

The applyReverseRule function takes the following options:

  • password (required): The password to which the rules will be applied.
  • rule (required): Rules compatible with the Hashcat rules engine.
  • memlimit (optional): Maximum memory (or total candidates) to allow while generating results. Defaults to 65000.
  • limit(optional): Max candidates produced by a single part of a multi-part rule. Defaults to 10.

The reverseRule function returns an array of strings (candidates) that will generate the initial password with specific rules. If no candidates could be generated, the empty[] array will be returned.

import reverse from 'hashcat-reverse-rules-js';

console.log(reverse.applyReverseRule('password', 'l'));
/*
[
  'PASSWORD', 'Password',
  'pASSWORD', 'PAssword',
  'PASSWOrd', 'PASSWord',
  'PASsword', 'PASSWORd',
  'PASSword'
]
*/

reversePassword

Try to deduce likely candidate inputs and the rules that could produce the given password.

function reversePassword(string, withRules=false)

The reversePassword function takes the following options:

  • string (required): The password to which the rules will be applied.

  • withRules (required): output the rules for the candidate

An array of candidate strings, or an array of objects when withRules is true (each object contains the candidate and the rule(s) that produced it). If no candidates are found, returns an empty array [].

console.log(hashcat.reversePassword("P@assword123"));

[
  'P@assword12',
  'P@assword1',
  'P@assword',
  'p@assword123',
  'p@assword12',
  'p@assword1',
  'p@assword'
]

Supported rules

NameFunctionDescriptionExample RuleInput WordOutput Word
Nothing:Do nothing (passthrough):p@ssW0rdp@ssW0rd
LowercaselLowercase all letterslp@ssW0rdp@ssw0rd
UppercaseuUppercase all lettersup@ssW0rdP@SSW0RD
CapitalizecCapitalize the first letter and lower the restcp@ssW0rdP@ssw0rd
Invert CapitalizeCLowercase first found character, uppercase the restCp@ssW0rdp@SSW0RD
Toggle CasetToggle the case of all characters in word.tp@ssW0rdP@SSw0RD
Toggle @TNToggle the case of characters at position NT3p@ssW0rdp@sSW0rd
ReverserReverse the entire wordrp@ssW0rddr0Wss@p
DuplicatedDuplicate entire worddp@ssW0rdp@ssW0rdp@ssW0rd
Duplicate NpNAppend duplicated word N timesp2p@ssW0rdp@ssW0rdp@ssW0rdp@ssW0rd
ReflectfDuplicate word reversedfp@ssW0rdp@ssW0rddr0Wss@p
Rotate Left{Rotate the word left.{p@ssW0rd@ssW0rdp
Rotate Right}Rotate the word right}p@ssW0rddp@ssW0r
Append Character$XAppend character X to end$1p@ssW0rdp@ssW0rd1
Prepend Character^XPrepend character X to front^1p@ssW0rd1p@ssW0rd
Truncate left[Delete first character[p@ssW0rd@ssW0rd
Trucate right]Delete last character]p@ssW0rdp@assW0r
Delete @ NDNDelete character at position ND3p@ssW0rdp@sW0rd
Extract rangexNMExtract M characters, starting at position Nx04p@ssW0rdp@ss
Omit rangeONMDelete M characters, starting at position NO12p@ssW0rdpsW0rd
Insert @ NiNXInsert character X at position Ni4!p@ssW0rdp@ss!W0rd
Overwrite @ NoNXOverwrite character at position N with Xo3$p@ssW0rdp@s$W0rd
Truncate @ N'NTruncate word at position N'6p@ssW0rdp@ssW0
ReplacesXYReplace all instances of X with Yss$p@ssW0rdp@$$W0rd
Purge@XPurge all instances of X@sp@ssW0rdp@W0rd
Duplicate first NzNDuplicate first character N timesz2p@ssW0rdppp@ssW0rd
Duplicate last NZNDuplicate last character N timesZ2p@ssW0rdp@ssW0rddd
Duplicate allqDuplicate every characterqp@ssW0rdpp@@ssssWW00rrdd
Swap frontkSwap first two characterskp@ssW0rd@pssW0rd
Swap backKSwap last two charactersKp@ssW0rdp@ssW0dr
Swap @ N*NMSwap character at position N with character at position M*34p@ssW0rdp@sWs0rd
Bitwise shift leftLNBitwise shift left character @ NL2p@ssW0rdp@æsW0rd
Bitwise shift rightRNBitwise shift right character @ NR2p@ssW0rdp@9sW0rd
ASCII increment+NIncrement character @ N by 1 ascii value+2p@ssW0rdp@tsW0rd
ASCII decrement-NDecrement character @ N by 1 ascii value-1p@ssW0rdp?ssW0rd
Replace N + 1.NReplace character @ N with value at @ N plus 1.1p@ssW0rdpsssW0rd
Replace N - 1,NReplace character @ N with value at @ N minus 1,1p@ssW0rdppssW0rd
Duplicate block frontyNDuplicate first N charactersy2p@ssW0rdp@p@ssW0rd
Duplicate block backYNDuplicate last N charactersY2p@ssW0rdp@ssW0rdrd
TitleELower case the whole line, then upper case the first letter and every letter after a spaceEp@ssW0rdP@ssw0rd W0rld
Title w/separatoreLower case the whole line, then upper case the first letter and every letter after a custom separator charactere-p@ssW0rdP@ssw0rd-W0rld

Keywords

hashcat

FAQs

Package last updated on 25 Sep 2025

Did you know?

Socket

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.

Install

Related posts