### Define installation rules Source: https://github.com/kimci86/bkcrack/blob/master/CMakeLists.txt Specifies files and directories to be included in the installation package. ```cmake # install rules install(DIRECTORY example DESTINATION .) install(DIRECTORY tools DESTINATION .) install(FILES readme.md DESTINATION .) install(FILES license.txt DESTINATION .) ``` -------------------------------- ### Install Doxygen Documentation Source: https://github.com/kimci86/bkcrack/blob/master/doc/CMakeLists.txt Defines the installation rule for the generated HTML documentation directory. ```cmake install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" DESTINATION doc) ``` -------------------------------- ### Compile bkcrack from Source with CMake Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Compile the project using CMake. This process creates an installation in the 'install' folder. Ensure you have CMake installed. ```bash cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install cmake --build build --config Release cmake --build build --config Release --target install ``` -------------------------------- ### Brute-force password recovery examples Source: https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md Commands to attempt password recovery by testing different character sets and length ranges. ```bash $ ../bkcrack -k c4490e28 b414a23d 91404b31 --bruteforce ?b --length 0..9 ``` ```bash $ ../bkcrack -k c4490e28 b414a23d 91404b31 --bruteforce ?p --length 10..11 ``` ```bash $ ../bkcrack -k c4490e28 b414a23d 91404b31 --bruteforce ?a --length 12 ``` -------------------------------- ### Recover Internal Keys from Files Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Recover internal keys using ciphertext and known plaintext from separate files. The ciphertext file must start with the 12-byte encryption header. ```bash bkcrack -c cipherfile -p plainfile ``` -------------------------------- ### Build from Source Source: https://context7.com/kimci86/bkcrack/llms.txt Compile the project using CMake. ```bash git clone https://github.com/kimci86/bkcrack.git cd bkcrack cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install cmake --build build --config Release cmake --build build --config Release --target install ``` -------------------------------- ### Prepare plaintext file Source: https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md Creates a file containing the guessed plaintext bytes for the attack. ```bash $ echo -n ' plain.txt ``` -------------------------------- ### Configure project subdirectories Source: https://github.com/kimci86/bkcrack/blob/master/CMakeLists.txt Includes core library and CLI program directories. ```cmake # core library add_subdirectory(src/bkcrack) # main program add_subdirectory(src/cli) ``` -------------------------------- ### Configure optional build features Source: https://github.com/kimci86/bkcrack/blob/master/CMakeLists.txt Conditional inclusion of documentation and testing subdirectories based on user options. ```cmake # documentation generation option(BKCRACK_BUILD_DOC "Enable documentation generation with doxygen." OFF) if(BKCRACK_BUILD_DOC) add_subdirectory(doc) endif() # automated tests option(BKCRACK_BUILD_TESTING "Enable automated testing with ctest." OFF) if(BKCRACK_BUILD_TESTING) enable_testing() add_subdirectory(tests) endif() ``` -------------------------------- ### Configure CPack packaging Source: https://github.com/kimci86/bkcrack/blob/master/CMakeLists.txt Sets up platform-specific packaging generators and includes CPack. ```cmake # package generation if(WIN32) set(CPACK_GENERATOR "ZIP") else() set(CPACK_GENERATOR "TGZ") endif() if(APPLE) set(CPACK_SYSTEM_NAME "macOS-${CMAKE_HOST_SYSTEM_PROCESSOR}") elseif(NOT WIN32) set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}") endif() include(CPack) ``` -------------------------------- ### Test BKCrack Version Information Source: https://github.com/kimci86/bkcrack/blob/master/tests/CMakeLists.txt Tests the bkcrack command with the --version option to display the tool's version and build date. It verifies that the output matches the expected format. ```bash add_test(NAME cli.version COMMAND bkcrack --version) set_tests_properties(cli.version PROPERTIES PASS_REGULAR_EXPRESSION "^bkcrack ${bkcrack_VERSION} - ${bkcrack_VERSION_DATE} $") ``` -------------------------------- ### Run the attack Source: https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md Executes the attack using the ciphertext archive, the target file, and the known plaintext. ```bash $ ../bkcrack -C secrets.zip -c spiral.svg -p plain.txt ``` -------------------------------- ### Define and Configure Test Runner Library Source: https://github.com/kimci86/bkcrack/blob/master/tests/runner/CMakeLists.txt Defines the 'bkcrack-testrunner' library and specifies its source files and enabled compiler features. Use this to set up the core testing framework. ```cmake add_library(bkcrack-testrunner) target_sources(bkcrack-testrunner PUBLIC FILE_SET HEADERS FILES TestRunner.hpp PRIVATE TestRunner.cpp main.cpp ) target_enable_warnings(bkcrack-testrunner) target_compile_features(bkcrack-testrunner PUBLIC cxx_std_20) ``` -------------------------------- ### Discover and Add Unit Tests Source: https://github.com/kimci86/bkcrack/blob/master/tests/bkcrack/CMakeLists.txt Uses CMake's GLOB command to find all .test.cpp files and then iterates through them to add each as a unit test using the custom bkcrack_add_unittest macro. This is typically used in a CMakeLists.txt file. ```cmake file(GLOB TESTS "*.test.cpp") foreach(test IN ITEMS ${TESTS}) bkcrack_add_unittest(${test} bkcrack-core) endforeach() ``` -------------------------------- ### Configure CMake project for bkcrack Source: https://github.com/kimci86/bkcrack/blob/master/CMakeLists.txt Initializes the project metadata and sets the default build type to Release. ```cmake cmake_minimum_required(VERSION 3.23) # project definition project(bkcrack VERSION 1.8.1 # remember to update bkcrack_VERSION_DATE below when releasing a new version DESCRIPTION "Crack legacy zip encryption with Biham and Kocher's known plaintext attack." HOMEPAGE_URL "https://github.com/kimci86/bkcrack" LANGUAGES CXX) set(bkcrack_VERSION_DATE "2025-10-25") # default build type set(default_build_type "Release") if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to '${default_build_type}' as none was specified.") set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() ``` -------------------------------- ### Configure and Add Doxygen Documentation Target Source: https://github.com/kimci86/bkcrack/blob/master/doc/CMakeLists.txt Configures Doxygen settings and defines a build target to generate documentation from source and include directories. ```cmake find_package(Doxygen REQUIRED) # doxygen configuration set(DOXYGEN_STRIP_FROM_PATH "${PROJECT_SOURCE_DIR}") set(DOXYGEN_STRIP_FROM_INC_PATH "${PROJECT_SOURCE_DIR}/include;${PROJECT_SOURCE_DIR}") set(DOXYGEN_FILE_PATTERNS "*.hpp;*.md") set(DOXYGEN_QUIET "YES") set(DOXYGEN_SEARCHENGINE "NO") set(DOXYGEN_ALIASES [[limitation=\xrefitem limitations "Known limitations" "Known limitations"]]) set(DOXYGEN_DISTRIBUTE_GROUP_DOC "YES") # add target doxygen_add_docs(doc ALL "${PROJECT_SOURCE_DIR}/doc" "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/src" "${PROJECT_SOURCE_DIR}/example" COMMENT "Generating HTML documentation with doxygen") ``` -------------------------------- ### Configure code formatting target Source: https://github.com/kimci86/bkcrack/blob/master/CMakeLists.txt Sets up a custom target to format C++ source files using clang-format. ```cmake # code formatting find_program(BKCRACK_CLANG_FORMAT_EXECUTABLE clang-format DOC "Path to clang-format program used to format C++ code.") if(BKCRACK_CLANG_FORMAT_EXECUTABLE) set(files_to_format "") foreach(folder IN ITEMS include src tests) file(GLOB_RECURSE folder_files "${folder}/*.hpp" "${folder}/*.cpp") list(APPEND files_to_format ${folder_files}) endforeach() add_custom_target(format COMMAND ${BKCRACK_CLANG_FORMAT_EXECUTABLE} -i ${files_to_format} COMMENT "Formatting C++ code with ${BKCRACK_CLANG_FORMAT_EXECUTABLE}" VERBATIM) endif() ``` -------------------------------- ### Set a new password Source: https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md Creates a new encrypted archive with a specified password. ```bash $ ../bkcrack -C secrets.zip -k c4490e28 b414a23d 91404b31 -U secrets_with_new_password.zip easy ``` -------------------------------- ### Exhaustive Search Mode Source: https://context7.com/kimci86/bkcrack/llms.txt Find all possible solutions instead of stopping at the first match. ```bash bkcrack -C encrypted.zip -c entry -p plain.txt --exhaustive ``` ```bash bkcrack -k c4490e28 b414a23d 91404b31 --bruteforce ?a --length 12 --exhaustive ``` -------------------------------- ### Configure CMake build for bkcrack-core Source: https://github.com/kimci86/bkcrack/blob/master/src/bkcrack/CMakeLists.txt Configures the project version header, defines the library target with its source files, sets C++20 standard, and links required threads. ```cmake # configure version header set(VERSION_HEADER_CONFIGURED "${PROJECT_BINARY_DIR}/include/bkcrack/version.hpp") configure_file("${PROJECT_SOURCE_DIR}/include/bkcrack/version.hpp.in" "${VERSION_HEADER_CONFIGURED}") # list files file(GLOB HEADERS "${PROJECT_SOURCE_DIR}/include/bkcrack/*.hpp") file(GLOB SOURCES "*.cpp") # add the library target add_library(bkcrack-core) target_sources(bkcrack-core PUBLIC FILE_SET HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include FILES ${VERSION_HEADER_CONFIGURED} ${HEADERS} PRIVATE ${SOURCES} ) target_enable_warnings(bkcrack-core) # enable C++20 target_compile_features(bkcrack-core PUBLIC cxx_std_20) # let CMake work out the system-specific details to use threads find_package(Threads REQUIRED) target_link_libraries(bkcrack-core PRIVATE Threads::Threads) ``` -------------------------------- ### Test BKCrack Help Message Source: https://github.com/kimci86/bkcrack/blob/master/tests/CMakeLists.txt Tests the bkcrack command with the -h option to display the help message. It verifies that the output contains the expected usage information. ```bash add_test(NAME cli.help COMMAND bkcrack -h) set_tests_properties(cli.help PROPERTIES PASS_REGULAR_EXPRESSION "usage:") ``` -------------------------------- ### Test BKCrack with Short Cycle Character Set Source: https://github.com/kimci86/bkcrack/blob/master/tests/CMakeLists.txt Tests the bkcrack command with an empty password and a short cycle for character set testing. Verifies the tool's behavior with minimal input and a simple cycle. ```bash add_test(NAME cli.charset.short-cycle COMMAND bkcrack --password "" -r 0 ?0 -s 0 ?0) set_tests_properties(cli.charset.short-cycle PROPERTIES PASS_REGULAR_EXPRESSION "circular reference") ``` -------------------------------- ### Register Unit Tests with CMake Source: https://github.com/kimci86/bkcrack/blob/master/tests/cli/CMakeLists.txt Uses file globbing to identify test files and iterates through them to register each with the bkcrack_add_unittest macro. ```cmake file(GLOB TESTS "*.test.cpp") foreach(test IN ITEMS ${TESTS}) bkcrack_add_unittest(${test} bkcrack-cli) endforeach() ``` -------------------------------- ### Configure code coverage reporting Source: https://github.com/kimci86/bkcrack/blob/master/CMakeLists.txt Adds targets for generating HTML and Coveralls reports using gcovr. ```cmake # code coverage report option(BKCRACK_BUILD_COVERAGE "Enable code coverage report generation." OFF) if(BKCRACK_BUILD_COVERAGE) target_compile_options(bkcrack-core PUBLIC --coverage) target_link_options(bkcrack-core PUBLIC --coverage) find_program(BKCRACK_GCOVR_EXECUTABLE gcovr DOC "Path to gcovr program used to generate code coverage report." REQUIRED) add_custom_target(coverage COMMAND ${CMAKE_COMMAND} -E make_directory coverage COMMAND ${BKCRACK_GCOVR_EXECUTABLE} --root ${CMAKE_SOURCE_DIR} --html-nested coverage/index.html COMMENT "Generating code coverage HTML report" VERBATIM) add_custom_target(coveralls COMMAND ${BKCRACK_GCOVR_EXECUTABLE} --root ${CMAKE_SOURCE_DIR} --coveralls coverage.json COMMENT "Generating coverage.json report for coveralls.io" VERBATIM) endif() ``` -------------------------------- ### List Archive Entries with bkcrack Source: https://github.com/kimci86/bkcrack/blob/master/readme.md List entries and metadata from a zip archive. This command helps identify entries vulnerable to known-plaintext attacks. ```bash bkcrack -L archive.zip ``` -------------------------------- ### Register Unit Tests Source: https://github.com/kimci86/bkcrack/blob/master/tests/runner/CMakeLists.txt Registers unit tests using the custom 'bkcrack_add_unittest' function. One test is marked to potentially fail. ```cmake # test the testing framework itself bkcrack_add_unittest(TestRunner-pass.test.cpp) bkcrack_add_unittest(TestRunner-fail.test.cpp) set_property(TEST unittest.testrunner-fail PROPERTY WILL_FAIL ON) ``` -------------------------------- ### Recover Internal Keys from Raw Files Source: https://context7.com/kimci86/bkcrack/llms.txt Execute the attack using raw files. The ciphertext file must contain the 12-byte encryption header. ```bash # Basic attack with raw ciphertext and plaintext files bkcrack -c cipherfile -p plainfile # Attack with plaintext at a specific offset within the ciphertext # (offset is relative to ciphertext without the encryption header) bkcrack -c cipherfile -p plainfile -o 100 # Attack with negative offset (plaintext includes part of encryption header) bkcrack -c cipherfile -p plainfile -o -5 ``` -------------------------------- ### List Archive Entries Source: https://context7.com/kimci86/bkcrack/llms.txt Display metadata for entries within a ZIP archive to identify ZipCrypto-encrypted files. ```bash # List all entries in a ZIP archive bkcrack -L archive.zip ``` -------------------------------- ### Test BKCrack with Question Mark Character Set Source: https://github.com/kimci86/bkcrack/blob/master/tests/CMakeLists.txt Tests the bkcrack command with a password containing a question mark, specifying a character set and range. Ensure the password and range characters are correctly handled. ```bash add_test(NAME cli.charset.question-mark COMMAND bkcrack --password hello? -r 6 ?0 -s 0 ?l?) ``` -------------------------------- ### Bruteforce Password Recovery Shortcut Source: https://github.com/kimci86/bkcrack/blob/master/readme.md A shortcut option '-r' combines length and charset for bruteforce password recovery. It specifies the maximum length and the character set to use. ```bash bkcrack -k 1ded830c 24454157 7213b8c5 -r 10 ?p ``` -------------------------------- ### Decipher Data with Known Keys Source: https://github.com/kimci86/bkcrack/blob/master/readme.md If the encryption keys are known from a previous attack, use this command to decipher data. Provide the cipherfile, keys, and output decipheredfile. ```bash bkcrack -c cipherfile -k 12345678 23456789 34567890 -d decipheredfile ``` -------------------------------- ### List archive contents Source: https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md Displays the contents of a zip file to identify encrypted entries. ```bash $ ../bkcrack -L secrets.zip ``` -------------------------------- ### Extract ZIP with internal keys using 7za Source: https://github.com/kimci86/bkcrack/blob/master/doc/resources.md Use the -p flag with the specified key format to extract encrypted ZIP files. ```bash 7za e cipher.zip '-p[12345678_23456789_34567890]' ``` -------------------------------- ### Change Password Using Internal Key Representation Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Generate a new encrypted archive with a new password by specifying the new password's internal key representation. Provide the original archive, keys, the new archive name, and the new key representations. ```bash bkcrack -C encrypted.zip -k 12345678 23456789 34567890 --change-keys unlocked.zip 581da44e 8e40167f 50c009a0 ``` -------------------------------- ### Test BKCrack List Archive Contents Source: https://github.com/kimci86/bkcrack/blob/master/tests/CMakeLists.txt Tests the bkcrack command with the -L option to list the contents of a secrets.zip archive. It verifies that the output format matches the expected structure, including index, encryption, compression, CRC32, and sizes. ```bash add_test(NAME cli.list COMMAND bkcrack -L secrets.zip WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/example) set_tests_properties(cli.list PROPERTIES PASS_REGULAR_EXPRESSION " Index Encryption Compression CRC32 Uncompressed Packed size Name ----- ---------- ----------- -------- ------------ ------------ ---------------- 0 ZipCrypto Deflate 7ca9f10a 54799 54700 advice.jpg 1 ZipCrypto Store a99f1d0d 1265 1277 spiral.svg ") ``` -------------------------------- ### Remove password protection Source: https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md Creates a new archive without password protection using the recovered keys. ```bash $ ../bkcrack -C secrets.zip -k c4490e28 b414a23d 91404b31 -D secrets_without_password.zip ``` -------------------------------- ### Define CMake targets for bkcrack Source: https://github.com/kimci86/bkcrack/blob/master/src/cli/CMakeLists.txt Configures the library and executable targets for the project, including source file filtering and linking dependencies. ```cmake file(GLOB HEADERS "*.hpp") file(GLOB SOURCES "*.cpp") list(FILTER SOURCES EXCLUDE REGEX "main\\.cpp") # add the library target add_library(bkcrack-cli) target_sources(bkcrack-cli PUBLIC FILE_SET HEADERS FILES ${HEADERS} PRIVATE ${SOURCES} ) target_enable_warnings(bkcrack-cli) target_link_libraries(bkcrack-cli PUBLIC bkcrack-core) # add the executable target add_executable(bkcrack) target_sources(bkcrack PRIVATE main.cpp utf-8.manifest) target_enable_warnings(bkcrack) target_link_libraries(bkcrack PRIVATE bkcrack-cli) # install rules install(TARGETS bkcrack DESTINATION .) ``` -------------------------------- ### Remove Password from Archive Source: https://context7.com/kimci86/bkcrack/llms.txt Create an unencrypted copy of an entire ZIP archive using recovered internal keys. ```bash # Create unencrypted archive from encrypted one bkcrack -C encrypted.zip -k c4490e28 b414a23d 91404b31 -D decrypted.zip # The resulting archive can be extracted with any standard zip utility unzip decrypted.zip ``` -------------------------------- ### Custom CMake Function for Unit Tests Source: https://github.com/kimci86/bkcrack/blob/master/tests/runner/CMakeLists.txt A CMake function to simplify the creation and registration of unit test executables. It automatically names the executable and test, links against the test runner, and enables warnings. ```cmake function(bkcrack_add_unittest file) cmake_path(GET file STEM stem) string(TOLOWER ${stem} name) add_executable(unittest-${name} ${file}) target_enable_warnings(unittest-${name}) target_link_libraries(unittest-${name} PRIVATE bkcrack-testrunner ${ARGN}) add_test(NAME unittest.${name} COMMAND unittest-${name}) endfunction() ``` -------------------------------- ### Bruteforce Password Recovery with Charset Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Attempt to recover a password using bruteforce with a specified character set. The '?' character acts as a placeholder for characters from the provided charset. ```bash bkcrack -k 1ded830c 24454157 7213b8c5 -b ?p ``` -------------------------------- ### Test BKCrack with Long Cycle Character Set Source: https://github.com/kimci86/bkcrack/blob/master/tests/CMakeLists.txt Tests the bkcrack command with an empty password and an extended cycle for character set testing. This checks the tool's ability to handle longer, more complex cycles. ```bash add_test(NAME cli.charset.long-cycle COMMAND bkcrack --password "" -r 0 ?0 -s 0 ?1 -s 1 ?2 -s 2 ?3 -s 3 ?4 -s 4 ?5 -s 5 ?0) set_tests_properties(cli.charset.long-cycle PROPERTIES PASS_REGULAR_EXPRESSION "circular reference") ``` -------------------------------- ### Change Password of Encrypted Archive Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Generate a new encrypted archive with a new password. Provide the original archive, keys, the new archive name, and the new password. ```bash bkcrack -C encrypted.zip -k 12345678 23456789 34567890 -U unlocked.zip new_password ``` -------------------------------- ### Change Archive Password Source: https://context7.com/kimci86/bkcrack/llms.txt Create a new encrypted archive with a custom password using recovered internal keys. ```bash # Create new archive with chosen password bkcrack -C encrypted.zip -k c4490e28 b414a23d 91404b31 -U unlocked.zip new_password ``` -------------------------------- ### Recover Internal Keys with Sparse Plaintext Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Provide sparse plaintext information using hexadecimal offsets and bytes when contiguous plaintext is less than 12 bytes. This helps meet the minimum 12-byte known plaintext requirement. ```bash bkcrack -c cipherfile -p plainfile -x 25 4b4f -x 30 21 ``` -------------------------------- ### Recover Internal Keys from Zip Archives Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Recover internal keys using ciphertext from one zip archive and known plaintext from another. Requires at least 12 bytes of known plaintext, with at least 8 being contiguous. ```bash bkcrack -C encrypted.zip -c cipher -P plain.zip -p plain ``` -------------------------------- ### Inflate deflated files Source: https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md Uses the provided Python script to decompress files that were stored using the deflate algorithm. ```bash $ python3 ../tools/inflate.py < advice_deciphered.deflate > very_good_advice.jpg ``` -------------------------------- ### Resume Interrupted Operations Source: https://context7.com/kimci86/bkcrack/llms.txt Continue an attack or recovery process from a specific checkpoint. ```bash bkcrack -C encrypted.zip -c entry -p plain.txt --continue-attack 183750 ``` ```bash bkcrack -k c4490e28 b414a23d 91404b31 --bruteforce ?a --length 12 --continue-recovery 573478303030 ``` -------------------------------- ### Decipher Encrypted Data Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Use this command to decipher data using a known ciphertext. Ensure the cipherfile, plainfile, and decipheredfile paths are correct. ```bash bkcrack -c cipherfile -p plainfile -d decipheredfile ``` -------------------------------- ### Test BKCrack with Hexadecimal Character Set Source: https://github.com/kimci86/bkcrack/blob/master/tests/CMakeLists.txt Tests the bkcrack command with a password containing hexadecimal characters, specifying a character set and range. This verifies handling of alphanumeric passwords. ```bash add_test(NAME cli.charset.hexadecimal COMMAND bkcrack --password 1a2b3c -r 6 ?h -s h ?dabcdef) ``` -------------------------------- ### Define compiler warning function Source: https://github.com/kimci86/bkcrack/blob/master/CMakeLists.txt Helper function to apply standard compiler warnings to a specific target. ```cmake function(target_enable_warnings target) target_compile_options(${target} PRIVATE $<$:-Wall -Wextra -Wpedantic>) endfunction() ``` -------------------------------- ### Mask-Based Password Recovery Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Use a mask to specify the password structure for faster recovery. This is efficient for long passwords. The mask uses predefined character set shortcuts. ```bash bkcrack -k 1940e266 d3fd3d89 71ce9871 -m ?l?l?l?l?l?l?l?l-?d?d?d?d?d?d ``` -------------------------------- ### Bruteforce Password Recovery with Length Constraint Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Restrict the bruteforce password search to a specific length or a range of lengths. Use the '-l' option followed by the length or range. ```bash bkcrack -k 1ded830c 24454157 7213b8c5 -b ?p -l 9 ``` ```bash bkcrack -k 1ded830c 24454157 7213b8c5 -b ?p -l 8..10 ``` -------------------------------- ### Brute-force Password Recovery Source: https://context7.com/kimci86/bkcrack/llms.txt Recover passwords by testing combinations within defined character sets and length ranges. ```bash bkcrack -k c4490e28 b414a23d 91404b31 --bruteforce ?b --length 0..9 ``` ```bash bkcrack -k c4490e28 b414a23d 91404b31 --bruteforce ?p --length 10..11 ``` ```bash bkcrack -k c4490e28 b414a23d 91404b31 --bruteforce ?a --length 12 ``` ```bash bkcrack -k c4490e28 b414a23d 91404b31 -r 10 ?p ``` -------------------------------- ### Recover Internal Keys from ZIP Archives Source: https://context7.com/kimci86/bkcrack/llms.txt Perform a known plaintext attack using ciphertext from an encrypted ZIP and plaintext from another source. Requires at least 12 bytes of known plaintext. ```bash # Attack using encrypted entry from one archive and plaintext from another bkcrack -C encrypted.zip -c cipher_entry -P plain.zip -p plain_entry ``` ```bash # Example: Attack secrets.zip using known XML header as plaintext echo -n ' plain.txt bkcrack -C secrets.zip -c spiral.svg -p plain.txt ``` -------------------------------- ### Recover Internal Keys with Offset Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Specify an offset for the known plaintext relative to the ciphertext. The offset can be negative if the plaintext overlaps with the encryption header. ```bash bkcrack -c cipherfile -p plainfile -o offset ``` -------------------------------- ### Mask-based password recovery Source: https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md Commands to optimize recovery time by defining custom character sets for specific password positions. ```bash $ ../bkcrack -k b8c377a6 f603160f 1832a78b --bruteforce ?u?l01 --length 15 ``` ```bash $ ../bkcrack -k b8c377a6 f603160f 1832a78b --mask ?x?x?x?x?x?x?x?x?x?x?y?y?y?y?y -s x ?u?l -s y 01 ``` -------------------------------- ### Decipher individual files Source: https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md Decrypts specific files from the archive using the recovered keys. ```bash $ ../bkcrack -C secrets.zip -c spiral.svg -k c4490e28 b414a23d 91404b31 -d spiral_deciphered.svg $ ../bkcrack -C secrets.zip -c advice.jpg -k c4490e28 b414a23d 91404b31 -d advice_deciphered.deflate ``` -------------------------------- ### Decipher Data Source: https://context7.com/kimci86/bkcrack/llms.txt Extract and decrypt data using recovered internal keys. Use the provided Python script for deflated data. ```bash # Decipher during the attack (saves deciphered data if keys are found) bkcrack -c cipherfile -p plainfile -d decipheredfile # Decipher using previously recovered keys bkcrack -c cipherfile -k 12345678 23456789 34567890 -d decipheredfile # Decipher from a ZIP archive entry bkcrack -C encrypted.zip -c entry_name -k c4490e28 b414a23d 91404b31 -d deciphered.bin # Decompress deflated data using provided Python script python3 tools/inflate.py < deciphered.deflate > decompressed.file ``` -------------------------------- ### Mask-Based Password Recovery Source: https://context7.com/kimci86/bkcrack/llms.txt Use specific character masks to reduce the search space for long passwords. ```bash bkcrack -k 1940e266 d3fd3d89 71ce9871 -m ?l?l?l?l?l?l?l?l-?d?d?d?d?d?d ``` ```bash bkcrack -k b8c377a6 f603160f 1832a78b -m ?x?x?x?x?x?x?x?x?x?x?y?y?y?y?y -s x ?u?l -s y 01 ``` -------------------------------- ### Decompress Deciphered Data Source: https://github.com/kimci86/bkcrack/blob/master/readme.md If the deciphered data is compressed using deflate, use this Python 3 script to decompress it. Redirect input from the deciphered file and output to the decompressed file. ```python python3 tools/inflate.py < decipheredfile > decompressedfile ``` -------------------------------- ### Custom Charset Definition for Mask-Based Recovery Source: https://github.com/kimci86/bkcrack/blob/master/readme.md Define custom charsets using the '-s' option to precisely specify the search space for password recovery. Custom charsets can reference predefined charsets. ```bash bkcrack -k b8c377a6 f603160f 1832a78b -m ?x?x?x?x?x?x?x?x?x?x?y?y?y?y?y -s x ?u?l -s y 01 ``` -------------------------------- ### Modify Archive Keys Source: https://context7.com/kimci86/bkcrack/llms.txt Change the internal keys of an encrypted ZIP archive or perform a workflow to edit an archive without knowing the original password. ```bash bkcrack -C encrypted.zip -k c4490e28 b414a23d 91404b31 --change-keys unlocked.zip 581da44e 8e40167f 50c009a0 ``` ```bash bkcrack -C original.zip -k c4490e28 b414a23d 91404b31 -U temp.zip mypassword bkcrack -C temp.zip -p mypassword --change-keys restored.zip c4490e28 b414a23d 91404b31 ``` -------------------------------- ### Sparse Plaintext Attack Source: https://context7.com/kimci86/bkcrack/llms.txt Provide additional known bytes at specific offsets when contiguous plaintext is limited. ```bash # Attack with 8 bytes of contiguous plaintext plus extra bytes at known offsets # -x specifies offset and bytes in hexadecimal bkcrack -c cipherfile -p plainfile -x 25 4b4f -x 30 21 # Example: Known file header plus additional structure bytes echo -n 'PK\x03\x04' > header.txt bkcrack -c encrypted_entry -p header.txt -x 14 0800 -x 26 0000 ``` -------------------------------- ### Remove Password from Encrypted Archive Source: https://github.com/kimci86/bkcrack/blob/master/readme.md This command generates a new archive without encryption, assuming all entries share the same password. Provide the encrypted archive, keys, and the output decrypted archive name. ```bash bkcrack -C encrypted.zip -k 12345678 23456789 34567890 -D decrypted.zip ``` -------------------------------- ### Multi-threaded Processing Source: https://context7.com/kimci86/bkcrack/llms.txt Control the number of threads used for computationally intensive operations. ```bash bkcrack -C encrypted.zip -c entry -p plain.txt --jobs 8 ``` ```bash bkcrack -C encrypted.zip -c entry -p plain.txt ``` ```bash bkcrack -C encrypted.zip -c entry -p plain.txt --jobs 1 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.