Initial implementation of C++ password checker #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a first working version of a password checker written in C++. It uses the Boost Asio and Beast libraries for asynchronous networking and HTTP, and both threads and the Asio support for Boost Coroutines for concurrency. Like the python tool, it has command line toggles to specify the number of threads and workers per thread (or concurrent requests per thread) to use.
This tool implements an in-memory cache, but for the time being there's no loading or dumping of the cache -- it only works for the current session.
In terms of speed, when not using cache I've been able to check passwords at rates of ~25k passwords a second, which amounts to downloading data at ~750 MB/s. When using cache, and while the cache is cold, filling it is rather slow as all threads create contingency to write into it, and thus the maximum initial download speeds go only up to ~400 MB/s. Once the cache is hot the tool can check ~200k passwords per second, if not more. All in all, when using 16 threads and 100 workers per thread, I've been able to check the RockYou database in 1:50 minutes when caching, and 10 minutes without (so caching helps). On the other hand the top 100k passwords can be checked in 9 seconds with caching, and 5 seconds without (so caching pushes down):
For convenience I've also added a Dockerfile that will build an image containing an optimised build of the tool ready to use. This is based on the latest ubuntu:21.10 image, and it adds only a couple of megabytes on top of that, being as lightweight as possible.
Other notes of things I found while testing this tool:
Some things to improve in the future: