1#ifndef BKCRACK_ARGUMENTS_HPP
2#define BKCRACK_ARGUMENTS_HPP
21 explicit Error(
const std::string& description);
107 std::size_t
maxLength{std::numeric_limits<std::size_t>::max()};
134 const char** m_current;
135 const char**
const m_end;
137 auto finished() const ->
bool;
139 void parseArgument();
172 auto readString(
const std::string& description) -> std::string;
173 auto readOption(
const std::string& description) -> Option;
174 auto readInt(
const std::string& description) -> int;
175 auto readSize(
const std::string& description) -> std::size_t;
176 auto readHex(
const std::string& description) -> std::vector<std::uint8_t>;
177 auto readKey(
const std::string& description) -> std::uint32_t;
178 auto readCharset() -> std::vector<std::uint8_t>;
Error(const std::string &description)
Constructor.
std::optional< std::string > infoArchive
Zip archive about which to display information.
Definition Arguments.hpp:125
std::optional< std::string > cipherFile
File containing the ciphertext.
Definition Arguments.hpp:34
Arguments(int argc, const char *argv[])
Constructor parsing command line arguments.
std::optional< std::string > decipheredFile
File to write the deciphered text corresponding to cipherFile.
Definition Arguments.hpp:68
std::optional< std::string > plainFile
File containing the known plaintext.
Definition Arguments.hpp:38
std::string recoveryStart
Starting point for password recovery.
Definition Arguments.hpp:116
std::optional< std::size_t > plainIndex
Index of the zip entry containing plaintext.
Definition Arguments.hpp:39
bool version
Tell whether version information is needed or not.
Definition Arguments.hpp:128
std::optional< std::string > decryptedArchive
File to write an unencrypted copy of the encrypted archive.
Definition Arguments.hpp:74
std::optional< Keys > keys
Internal password representation.
Definition Arguments.hpp:65
bool keepHeader
Tell whether to keep the encryption header or discard it when writing the deciphered text.
Definition Arguments.hpp:71
std::optional< std::string > password
Password from which to derive the internal password representation.
Definition Arguments.hpp:62
int attackStart
Staring point of the attack on Z values remaining after reduction.
Definition Arguments.hpp:59
int jobs
Number of threads to use for parallelized operations.
Definition Arguments.hpp:119
std::optional< ChangePassword > changePassword
Arguments needed to change an archive's password.
Definition Arguments.hpp:83
bool exhaustive
Tell whether to try all candidates (keys or passwords) exhaustively or stop after the first success.
Definition Arguments.hpp:122
bool ignoreCheckByte
Tell not to use the check byte derived from ciphertext entry metadata as known plaintext.
Definition Arguments.hpp:56
std::optional< ChangeKeys > changeKeys
Arguments needed to change an archive's internal password representation.
Definition Arguments.hpp:95
int offset
Plaintext offset relative to ciphertext without encryption header (may be negative)
Definition Arguments.hpp:49
std::optional< std::string > plainArchive
Zip archive containing plainFile.
Definition Arguments.hpp:40
std::map< int, std::uint8_t > extraPlaintext
Definition Arguments.hpp:53
std::size_t plainFilePrefix
Maximum number of bytes of plaintext to read from plainFile.
Definition Arguments.hpp:46
auto loadData() const -> Data
Load the data needed for an attack based on parsed arguments.
std::optional< std::vector< std::uint8_t > > bruteforce
Characters to generate password candidates.
Definition Arguments.hpp:98
std::optional< std::size_t > cipherIndex
Index of the zip entry containing ciphertext.
Definition Arguments.hpp:35
bool help
Tell whether help message is needed or not.
Definition Arguments.hpp:131
std::optional< std::string > cipherArchive
Zip archive containing cipherFile.
Definition Arguments.hpp:36
std::optional< LengthInterval > length
Range of password lengths to try during password recovery.
Definition Arguments.hpp:113
BaseError(const std::string &type, const std::string &description)
Constructor.
Keys defining the cipher state.
Definition Keys.hpp:10
Arguments needed to change an archive's internal password representation.
Definition Arguments.hpp:90
Keys newKeys
Internal password representation chosen to generate the new archive.
Definition Arguments.hpp:92
std::string unlockedArchive
File to write the new encrypted archive.
Definition Arguments.hpp:91
Arguments needed to change an archive's password.
Definition Arguments.hpp:78
std::string unlockedArchive
File to write the new encrypted archive.
Definition Arguments.hpp:79
std::string newPassword
Password chosen to generate the new archive.
Definition Arguments.hpp:80
Range of password lengths to try during password recovery.
Definition Arguments.hpp:102
std::size_t maxLength
Greatest password length to try (inclusive)
Definition Arguments.hpp:107
std::size_t minLength
Smallest password length to try (inclusive)
Definition Arguments.hpp:104
auto operator&(const LengthInterval &other) const -> LengthInterval
Compute the intersection between this interval and the given other interval.
Structure to hold the data needed for an attack.
Definition Data.hpp:10
Useful types, constants and utility functions.