-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMSExcelFindPassword.py
63 lines (51 loc) · 1.65 KB
/
MSExcelFindPassword.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
##################################################################################
#
# MSExcelFindPassword
# ---------------------------------------------------------------------------------
# Find Password of MS Excel File with custom wordlist "wordlist.lst"
# ---------------------------------------------------------------------------------
# Yacine REZGUI <yacine.rezgui@gmail.com>
# Version 1.0
# ---------------------------------------------------------------------------------
# Prerequisites:
# - win32com.client package need to install.
# - Give proper path for excel file.
#
# Usage :
# python MSExcelFindPassword.py <filename>
#
###################################################################################
########## Builtin Package
import sys as sys
import os as os
import win32com.client as win32
from tqdm import tqdm
openedDoc = win32.gencache.EnsureDispatch('Excel.Application')
filename= sys.argv[1]
filepath = os.path.abspath(filename)
password_file = open ( 'wordlist.lst', 'r' )
passwords = password_file.readlines()
password_file.close()
passwords = [item.rstrip('\n') for item in passwords]
# Result store Path
results = open('results.txt', 'w')
print(filepath)
pwfind = 0
for password in tqdm(passwords):
try:
wb = openedDoc.Workbooks.Open(filepath, False, True, None, password)
pwfind = 1
results.write(password)
results.close()
except:
continue
if pwfind == 1:
results = open('results.txt', 'r')
text = results.read()
print(' ')
print('Password Find : ')
print('----------------------------')
print(text)
results.close()
else:
print('Rien .....')