Python Forum

Full Version: Archive (.7z, .zip, .rar, .tar, etc) Password Extractor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Everyone,

I'm just new to Python. I've already learned the basics by watching videos online.

I am planning to write a script that will automatically extract password protected archives such as 7z, zip, rar, tar, etc.

What I want to happened is when I do a right click on that archive (Windows Machine), there will be an option to select to call my script to extract the archive and extract it using predefined passwords. For example, the passwords that I want to use to automatically extract the archive are the following - "1234", "password", "admin".

This is the only code that I have so far.
import zipfile
zf = zipfile.ZipFile('data.zip')
print zf.namelist()
from zipfile import ZipFile
with ZipFile('data.zip') as zf:
    zf.extractall(pwd='password')
Thank you for your help!