bkcrack: Arguments Class Reference

bkcrack 1.8.1 Crack legacy zip encryption with Biham and Kocher's known plaintext attack.

Arguments Class Reference

Parse and store arguments. More...

`#include <src/cli/Arguments.hpp>`

## Classes
class | Error
| Exception thrown if an argument is not valid. More...
struct | ChangePassword
| Arguments needed to change an archive's password. More...
struct | ChangeKeys
| Arguments needed to change an archive's internal password representation. More...
struct | LengthInterval
| Range of password lengths to try during password recovery. More...

## Public Member Functions
| Arguments (int argc, const char *const argv[])
| Constructor parsing command line arguments.
auto | loadData () const -> Data
| Load the data needed for an attack based on parsed arguments.

## Public Attributes
std::optional< std::string > | cipherFile
| File containing the ciphertext.
std::optional< std::size_t > | cipherIndex
| Index of the zip entry containing ciphertext.
std::optional< std::string > | cipherArchive
| Zip archive containing cipherFile.
std::optional< std::string > | plainFile
| File containing the known plaintext.
std::optional< std::size_t > | plainIndex
| Index of the zip entry containing plaintext.
std::optional< std::string > | plainArchive
| Zip archive containing plainFile.
std::size_t | plainFilePrefix = 1 << 20
| Maximum number of bytes of plaintext to read from plainFile.
int | offset = 0
| Plaintext offset relative to ciphertext without encryption header (may be negative).
std::map< int, std::uint8_t > | extraPlaintext
bool | ignoreCheckByte = false
| Tell not to use the check byte derived from ciphertext entry metadata as known plaintext.
int | attackStart = 0
| Starting point of the attack on Z values remaining after reduction.
std::optional< std::string > | password
| Password from which to derive the internal password representation.
std::optional< Keys > | keys
| Internal password representation.
std::optional< std::string > | decipheredFile
| File to write the deciphered text corresponding to cipherFile.
bool | keepHeader = false
| Tell whether to keep the encryption header or discard it when writing the deciphered text.
std::optional< std::string > | decryptedArchive
| File to write an unencrypted copy of the encrypted archive.
std::optional< ChangePassword > | changePassword
| Arguments needed to change an archive's password.
std::optional< ChangeKeys > | changeKeys
| Arguments needed to change an archive's internal password representation.
std::optional< std::vector< std::uint8_t > > | bruteforce
| Characters to generate password candidates.
std::optional< LengthInterval > | length
| Range of password lengths to try during password recovery.
std::optional< std::vector< std::vector< std::uint8_t > > > | mask
| Mask for password recovery, alternative to bruteforce and length.
std::string | recoveryStart
| Starting point for password recovery.
int | jobs
| Number of threads to use for parallelized operations.
bool | exhaustive = false
| Tell whether to try all candidates (keys or passwords) exhaustively or stop after the first success.
std::optional< std::string > | infoArchive
| Zip archive about which to display information.
bool | version = false
| Tell whether version information is needed or not.
bool | help = false
| Tell whether help message is needed or not.

## Detailed Description

Parse and store arguments.

## Constructor & Destructor Documentation

## ◆ Arguments()

Arguments::Arguments | ( | int | argc,
|  | const char *const | argv[] )

Constructor parsing command line arguments.

Exceptions

  Error | if an argument is not valid

## Member Function Documentation

## ◆ loadData()

auto Arguments::loadData | ( |  | ) | const -> Data

Load the data needed for an attack based on parsed arguments.

Exceptions

  FileError | if a file cannot be opened
  ZipError | if a zip entry cannot be opened
  Data::Error | if the loaded data cannot be used to carry out an attack

## Member Data Documentation

## ◆ changeKeys

std::optional<ChangeKeys> Arguments::changeKeys

Arguments needed to change an archive's internal password representation.

Changing the internal password representation is an alternative to changing the password when the target password is not known, but its internal representation is known.

## ◆ changePassword

std::optional<ChangePassword> Arguments::changePassword

Arguments needed to change an archive's password.

## ◆ extraPlaintext

std::map<int, std::uint8_t> Arguments::extraPlaintext

Additional bytes of plaintext with their offset relative to ciphertext without encryption header (may be negative)

## ◆ length

std::optional<LengthInterval> Arguments::length

Range of password lengths to try during password recovery.

## ◆ plainFilePrefix

std::size_t Arguments::plainFilePrefix = 1 << 20

Maximum number of bytes of plaintext to read from plainFile.

Set to 1 MiB by default. Using more plaintext is possible, but it uses more RAM and does not speed up the attack much.

The documentation for this class was generated from the following file:

- src/cli/Arguments.hpp