Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored constants, added token format validation, flexible parameter parsing, and Jest unit testing. #27

Merged
merged 3 commits into from
Apr 3, 2023

Conversation

0xCaponte
Copy link
Contributor

Added:

  • constants.js to centralize the various constants used
  • jwtValidator.js for format and algorithm validation of the JWT token. Only well formatted HS256 should pass
  • argsParser.js for flexible argument parsing and improved help message by using Yargs
  • index.test.js to replace test.js using jest and the new argument-flags
  • Added all the git contributors to the package.json (ordered alphabetically)
  • Added VSCode folders to the gitignore

Tests (with Jest):

  • Unit-Tests for the JwtValidator
  • The logic in test.js is now in index.test.js

Comments:

  • Jest is still working on the ES integration, that is why --experimental-vm-modules is used for testing
  • A refactoring of the index.js might make a more complete test of the "whole" logic easier/faster.

… more flexible parameter parsing. Added unit testing with Jest.

Added:
- constants.js to centralize the various constants used
- jwtValidator.js for format and algorithm validation of the JWT token. Only well formatted HS256 should pass
- argsParser.js for flexible argument parsing and improved help message by using Yargs
- index.test.js to replace test.js using jest and the new argument-flags
- Added all the git contributors to the package.json (ordered alphabetically)
- Added VSCode folders to the gitignore

Tests (with Jest):
-  Unit-Tests for the JwtValidator
-  The logic in test.js is now in index.test.js

Comments:
- Jest is still working on the ES integration, that is why --experimental-vm-modules is used for testing
- A refactoring of the index.js might make a more complete test of the "whole" logic easier/faster.
@0xCaponte
Copy link
Contributor Author

Updating the README.md for the new argument format would also be needed:
jwt-cracker -t <token> [-a <alphabet>] [--max <maxLength>]

Copy link
Owner

@lmammino lmammino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the awesome contribution! 🤟🏽

@lmammino
Copy link
Owner

lmammino commented Apr 2, 2023

The tests seems to be breaking, could you please have a look at them? @0xCaponte ?

@0xCaponte
Copy link
Contributor Author

I had a wrong class name. Now all tests pass locally.

Updated the ReadMe to match the new argument parser
@lmammino lmammino merged commit 8e329af into lmammino:master Apr 3, 2023
@lmammino
Copy link
Owner

lmammino commented Apr 3, 2023

Published as 3.0.0! https://github.com/lmammino/jwt-cracker/releases/tag/3.0.0

Thanks again for the contribution!

FYI, there's also a distribute version of this tool: lmammino/distributed-jwt-cracker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants