Search code examples
python7zip

how to test for passwords entries of a 7zip file using a python script?


I would like to write a python script to test passwords for a 7zip file, is there a function that allow to write in the password field of the 7zip file ?

Thanks


Solution

  • I don't know if there is a particular function that might help you but what I usually do is that just run terminal commands from python (I use a Linux system).

    import os
    import subprocess
    
    subprocess.call (["7z", "x", "test.7z", "-ppasswd"])
    

    In the above example test is the name of your file and passwd is the password that you need for decompression.