arfoll / unrarall

bash script to unrar everything and cleanup in a given directory
GNU General Public License v3.0
261 stars 68 forks source link

Added reading passwords from file #15

Closed Holzhaus closed 10 years ago

Holzhaus commented 10 years ago

You can now create a password list (default is ~/.unrar_passwords), which is a simple text file containing archive passwords (separated by newlines). If an archive needs a password, then unrarall will read the file in a top down manner and try to use each password until it finds the correct one or reaches EOF.

Please note, that this commit removes the ability to get asked for a password and input it manually. IMHO this is not needed, as this tool is clearly designed for mass extraction and should not wait for user input (this is also why the '-y' option is used in the code). If you need to extract an archive with a password, just put it in the passwords file and remove the file afterwards (or just use plain unrar/7z).

This fixes arfoll/unrarall#13.

arfoll commented 10 years ago

Looks really nice! thanks! I'll try test this tonight and if you don't mind making SIGKILL -> SIGTERM/SIGINT I'll merge this in.

Holzhaus commented 10 years ago

I just found a bug. Some RAR archives also have encrypted headers. In this case, unrar l x.rar will request a password, too. I'll commit a patch soon.

Holzhaus commented 10 years ago

Done.

nigg commented 10 years ago

Nice work Holzhaus. :) I can use this feature a lot! Arfoll can you pls merge his commit to master branch?

nigg commented 10 years ago

I just tested that password feature and I did find a bug. If you are using 2 diffrent archive sets with 2 diffrent passwords the unrar process can use the wrong password and fails with the following error message: "Corrupt file or wrong password."

Short, the algorithm can't decide correctly which password to use, if the password list contains several password. :/

Can you pls fix this?

Holzhaus commented 10 years ago

Actually, this is true, but I don't see a solution for this problem. unrar/7z can't determine the password without trying to extract the archive. There is no other way for this.This is why unrarall performs these steps:

This is the expected behaviour.

There might be some workarounds, e.g.:

I might implement the latter 2 workarounds at some point, but I'm too busy at the moment.

Holzhaus commented 10 years ago

@arfoll Are any stumbling blocks for merging left?

arfoll commented 10 years ago

Nope. Sorry I was being slow :). Nice work!