Implement multiprocessing for brute-force password attempts#1
Open
bloodstiller wants to merge 3 commits into
Open
Implement multiprocessing for brute-force password attempts#1bloodstiller wants to merge 3 commits into
bloodstiller wants to merge 3 commits into
Conversation
Refactor bfkeepass.py to use multiprocessing for password attempts and improve argument parsing.
Add session management and rich console output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactor bfkeepass.py to use multiprocessing for password attempts and improve argument parsing.
Summary
Refactors
bfkeepassto improve bruteforce performance through parallelism, add real-time verbose progress reporting, and harden error handling.Changes
Performance
ProcessPoolExecutorfor true multiprocessing — KeePass KDF (Argon2/AES) is CPU-bound so processes bypass the GIL where threads cannot-t / --threadsargument to control worker count (default: 4)BATCH_SIZE = 200) to avoid loading large wordlists (e.g. rockyou.txt) fully into memoryEarly Termination
multiprocessing.ManagersharedEvent(stop_flag) passed to all workersVerbose Output
printcalls to the main process — worker process stdout is unreliable across process boundariesflush=TrueError Handling
except:with explicitCredentialsErrorcatch — the expected failure path for a wrong password[WARN]messages tostderrrather than silently swallowedFileNotFoundErrorfrom generalOSErrorand exit with code 1Code Quality
type=asciifrom argparse arguments and the subsequent.replace("'", "")workarounddump_entries()anditer_batches()as standalone functionsPyKeePassentries to plain dicts before returning —PyKeePassobjects are not picklable across process boundariesVerified On Test KDBX