Repository navigation
Resolve file paths in key=value attack arguments - #45
Open
four-random-common-words wants to merge 2 commits into
Open
four-random-common-words wants to merge 2 commits into
four-random-common-words wants to merge 2 commits into
Conversation
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.
Ports the fix from hashtopolis/agent-python#79 to the Rust agent.
Problem
Hashcat's PCFG support (
-a 4) passes a hint file as akey=valueargument, e.g.hintfile=mylist. Both cracker backends resolved file tokens by joining the whole token onto the files directory and testingis_file(). Akey=valuetoken never matched a real file, so the path was never substituted and the run failed. The Python agent had the same bug before #79.Fix
resolve_file_tokenhelper insrc/backend/paths.rs. A bare token naming a file still resolves to its absolute path. Akey=valuetoken whose value names a file now resolves tokey=<absolute path>, stripping matching surrounding quotes from the value first.argv.rs) and the generic backend (mod.rs, covering both crack and keyspace paths) now call the shared helper, removing the duplicated lookup logic.Because the Rust agent builds a real argv vector instead of a quoted shell string, no re-quoting is needed. A bare filename containing
=is matched as a whole file first, before anykey=valuesplit.Tests
Added coverage in all three locations: the helper's unit tests (bare file,
key=value, quoted value, missing file, non-file flag like--hash-type=0, empty value, bare-file-with-=precedence) plus regression tests in the hashcat and generic backends including the keyspace path. Full library suite passes and clippy is clean.