前提条件

前提条件

わかりました。ダウンロードしました。Have I Been PwnedのすべてのSHA-1ハッシュ、私のパスワードマネージャのすべての内容をエクスポートし、1行に1つのパスワードを持つファイルとして処理しました。これらのファイルを効率的に一致させるにはどうすればよいですか?

ベストアンサー1

前提条件

  • 7z、にする必要があります"p7zip"パッケージ
  • sha1sumshred"coreutils" パッケージにする必要があります。
  • grep"grep"パッケージから。

プロセス

  1. 固有の大文字のパスワードハッシュを含むファイルと、パスワードとそのハッシュを含むファイルを作成します。

    sort -u passwords.txt | while read -r password
    do
        hash="$(printf '%s' "$password" | \
            sha1sum | \
            cut -d' ' -f1 | \
            tr 'a-f' 'A-F')"
        printf '%s\n' "$hash" >> hashes.txt
        printf '%s\t%s\n' "$hash" "$password" >> passwords-with-hashes.txt
    done
    
  2. ダウンロードしたファイルのすべての項目とハッシュを一致させます。

    7z e -so pwned-passwords-sha1-ordered-by-hash-v*.7z | \
    cut -c 1-40 | \
    grep -Fxf hashes.txt | \
    tee matches.txt
    

    しばらくお待ちください。 SSDのあるデスクトップでは、この作業は約20分かかりました!

  3. コンテストに関連するパスワードを表示する:

    grep -Ff matches.txt passwords-with-hashes.txt | cut -f2
    
  4. 作成したファイルを安全に削除してください。

    shred --remove hashes.txt matches.txt passwords.txt passwords-with-hashes.txt
    

おすすめ記事