#password-hash #sorting #download #worker #tool #hibp #have-i-been-pwned

bin+lib hibp_downloader

用于下载和/或排序 HaveIBeenPwned 密码散列的命令行应用程序

3 个稳定版本

1.0.3 2023 年 10 月 25 日

#799 in 密码学

MIT 许可证

26KB
514

hibp_downloader

这是一个用 Rust 编写的 CLI 工具,用于从 Cloudflare 下载和/或排序 HIBP 密码散列。

下载(信任 GitHub 为您编译)

对于不想安装 Rust 或自行编译的用户,GitHub CI 会自动构建二进制文件和校验和文件,并将它们上传到每个版本中的“发布”部分。 (您可以在此处查看发布内容。)

安装(自行编译)

这需要安装 Rust。 安装 rustup 是最简单的方法。

MSRV 相当新,欢迎 PR 降低 MSRV,如果这对您很重要的话。

# To install to PATH
$ cargo install --release
# To build in ./target/release/hibp_downloader(.exe)
$ cargo build --release

用法

注意:--workers 应该保持为默认值,因为它决定了 tokio 的异步运行时的工作线程数,但如果您开始收到“在处理任何应用程序逻辑之前拒绝流”错误,请将 --multiplier 选项从默认值降低。

workers * multiplier 是它决定并发下载数量的方式。

无子命令

A CLI app for downloading and/or sorting HaveIBeenPwned password hashes.

Usage: hibp_downloader [OPTIONS] [COMMAND]

Commands:
  sort  Sort the downloaded password hashes in descending frequency order
  help  Print this message or the help of the given subcommand(s)

Options:
      --workers <WORKERS>          The number of workers to use for requests [default: NUM_CPU]
      --multiplier <MULTIPLIER>    The number of requests per worker [default: 128/NUM_CPU]
  -n, --ntlm                       Download NTLM hashes instead of SHA1 hashes
      --output-file <OUTPUT_FILE>  The file where the output will be written.
                                   This file will be sorted by hash. [default: ./hibp_password_hashes.txt]
  -h, --help                       Print help
  -V, --version                    Print version

带有子命令 sort

Sort the downloaded password hashes in descending frequency order

Usage: hibp_downloader sort [OPTIONS]

Options:
      --input-file <INPUT_FILE>    The file to be sorted. [default: ./hibp_password_hashes.txt]
      --output-file <OUTPUT_FILE>  The file where the frequency sorted output will be written.\n
                                   This file will be sorted by descending frequency.
                                   See the sort subcommand if you want to sort after the fact.
                                   WARNING: This option requires 2x the file size in empty space.
                                   (It writes smaller chunked files and sorts the items from those files) [default: ./hibp_password_hashes_sorted.txt]
      --temp-dir <TEMP_DIR>        This directory will be used to store the temporary files
                                   used in the sorting algorithm. It will hold many files
                                   that add up to the size of the original file and will be
                                   deleted upon completion. [default: ./tmp_scratch_disk_for_hibp_sort]
  -h, --help                       Print help
  -V, --version                    Print version

依赖项

~16–32MB
~507K SLoC