Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archives with passwords cause an infinite hang while waiting for input #5

Closed
dilinger opened this issue Oct 25, 2020 · 5 comments
Closed

Comments

@dilinger
Copy link

A number of archive types support encryption with a password: zip, rar, 7z.. When dtrx encounters one of these, it just hangs waiting for the user to put in a password. However, it doesn't ask for a password, nor does it echo the password prompt from the underlying command. Instead, it just sits there silently waiting.

The reason for this is because dtrx sets stdout to /dev/null, and saves stderr to a temporary file. So the user never sees the password prompt. Zip and rar output their prompts to stderr, and 7z outputs it prompt to stdout.


In addition, errors to stderr seem to be thrown away, or shown AFTER we're asked where to output (invalid) files

For example:

dilinger@e7470:$ echo foo > test2; zip -P foobar file.zip test2
updating: test2 (stored 0%)
dilinger@e7470:
$ dtrx file.zip

file.zip contains one file but its name doesn't match.
Expected: file
Actual: test2
You can:

  • extract the file _I_nside a new directory named file
  • extract the file and _R_ename it file
  • extract the file _H_ere
    What do you want to do? (I/r/h) i
    dtrx: WARNING: extracting /home/dilinger/file.zip to ./file.rl629f5n
    dtrx: WARNING: Error output from this process:
    ERROR: Wrong password : test2
@noahp
Copy link
Member

noahp commented Mar 22, 2021

I think this is closed via #6, reopen if necessary!

@noahp noahp closed this as completed Mar 22, 2021
@erhan-
Copy link

erhan- commented Aug 31, 2021

Would you consider adding an option to skip password archives during extraction?
Also I had this problem of hanging where the error or output was not visible. This happened for me with password protected files for example. I had to kill the subprocess and then I was able to see it. Now it works for that case. Thank you!

@noahp
Copy link
Member

noahp commented Aug 31, 2021

Would you consider adding an option to skip password archives during extraction?
Also I had this problem of hanging where the error or output was not visible. This happened for me with password protected files for example. I had to kill the subprocess and then I was able to see it. Now it works for that case. Thank you!

Definitely! feel free to open a PR with that change.

@dilinger
Copy link
Author

Can you either provide the full archive file that contained the password archive, or provide a recipe for reproducing the full archive? Having it just hang is definitely a bug, and I'd like to fix it. Assuming this happened with version 8.1.0 or above.

As far as skipping passworded archives - we have a --noninteractive option. I wonder if that's the best way to skip password archives, rather than adding another argument?

@erhan-
Copy link

erhan- commented Sep 1, 2021

"Now it works for that case. Thank you!" -> as in, your MR fixed this bug and thank you for doing this for all of us! Most of my issues I had by using old version which were delivered with Kali repository for example and then trying to pip3 install over it etc.

I like your idea for --noninteractive . Currently this makes it not non-interactive. I believe a Warning output would be enough so that people are notified that it was skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants