-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtitle_extract.py
More file actions
44 lines (38 loc) · 998 Bytes
/
title_extract.py
File metadata and controls
44 lines (38 loc) · 998 Bytes
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
import os
import sys
import pyzipper
import json
import requests
import argparse
parser = argparse.ArgumentParser(description='Crack the password on a password-protected malware archive')
parser.add_argument("file",help="The archive to crack")
args = parser.parse_args()
fname = os.path.split(os.path.abspath(args.file))[1]
if fname.endswith(".zip"):
fname = fname[:-4]
seps = [" ",".","-","_"]
try:
os.mkdir("found")
except:
pass
found_match = False
pwtried = 0
def extract_matches(string,div):
return string.split(div)
for sep in seps:
ext = extract_matches(fname,sep)
for password in ext:
pwtried += 1
try:
with pyzipper.AESZipFile(args.file) as zf:
zf.pwd = password.encode()
f = zf.extractall("found/{}".format(args.file))
print("Extracted with password {}".format(password))
found_match = True
except Exception as err:
pass
if found_match == True:
break
print("Tried {} passwords".format(pwtried))
if found_match == False:
print("No password found")