Unarchive a file with a set of provided password list

  • Get unar from http://unarchiver.c3.cx/commandline
  • Extract the archive and put unar (and lsar) somewhere your shell can find it.
  • Run

    while IFS= read pwd; do
        unar -p "$pwd" ARCHIVE
    done < password-list.txt
    

The solution from @patrix works perfect, except for the case, when the password is not available in the provided list, then the archive will produce a lot of 0 byte files. My changed solution checks, if a password matches, then it's continues to unarchive.

while IFS= read pwd; do
    if lsar -t "$1" -p "$pwd" | grep "[1-9][0-9]* passed" -E -q; then
        unar -p "$pwd" "$1"
        break
    fi
done < password-list.txt