Created
March 5, 2014 17:31
-
-
Save gabemarshall/9372073 to your computer and use it in GitHub Desktop.
Cracking a password protected excel doc with python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import win32com.client | |
openedDoc = win32com.client.Dispatch("Excel.Application") | |
filename= sys.argv[1] | |
password_file = open ( 'wordlist.lst', 'r' ) | |
passwords = password_file.readlines() | |
password_file.close() | |
passwords = [item.rstrip('\n') for item in passwords] | |
results = open('results.txt', 'w') | |
for password in passwords: | |
print(password) | |
try: | |
wb = openedDoc.Workbooks.Open(filename, False, True, None, password) | |
print("Success! Password is: "+password) | |
results.write(password) | |
results.close() | |
except: | |
print("Incorrect password") | |
pass |
@datatalking, i think that this code Just work on WInd as a VBA, because If plan is XLSM forgot any others SOs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Gabe, does this work in a mac enviroment?
I'm getting a win32com error when i try to run it.