Is there a possibility like in jDownloader, where password protected files are automatically extracted by trying all passwords one by one which are provided by the user?
Something like this:
$ unarchive foo.rar --password-list baz.txt
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
lsar) somewhere your shell can find it.
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