1

I want to write a Python script to automatically unzip lots of apk files and then do static analysis. However, when I unzip some apk files, unzip prompted that "Press 'Q' to quit, or any other key to continue".

Because it's a script and I haven't press any key then the script hangs. Any command option can solve this problem? Or do I have to handle it in Python? Thanks in advance :D

YjyJeff
  • 833
  • 1
  • 6
  • 14
  • 1
    How are you unzipping the files? If the "static analysis" can be done as a separate step...https://docs.python.org/3/library/zipfile.html. Here is a SO link: https://stackoverflow.com/q/3451111/6655092. Otherwise, there may be an option with whatever you are using to unzip it to not request user input. – JakeD Jun 11 '17 at 01:26

2 Answers2

0

I just ran into the same thing and figured out what's causing it. Turns out, if a zip file has a zip comment attached, it will be shown, along with a prompt that hangs your script.

Passing -q to unzip will avoid showing the comment and any hangs, though you will lose the list of files being unzipped too. I haven't figured out how to just prevent the comment from showing up and not the rest of the stuff unzip prints.

Artem Russakovskii
  • 21,516
  • 18
  • 92
  • 115
-1

You don't say what the structure looks like, but for a single use of unzip you can try this:

echo Q | unzip myfile.zip
Marichyasana
  • 2,966
  • 1
  • 19
  • 20