Skip to content

Commit 3022b1f

Browse files
claudioandre-brsolardiz
authored andcommitted
libreoffice2john.py: error in encrypted 24.2+ files
Warn that LibreOffice 24.2+ encrypted documents are not supported. See: #5652. Signed-off-by: Claudio André <[email protected]>
1 parent 126b2a4 commit 3022b1f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

run/libreoffice2john.py

+18
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,26 @@ def process_file(filename):
4646
elements = list(r.getiterator())
4747

4848
is_encrypted = False
49+
is_supported = True
4950
key_size = 16
5051
start_key_generation_name = "SHA1"
52+
53+
for element in elements:
54+
if element.get("{urn:oasis:names:tc:opendocument:xmlns:manifest:1.0}full-path") == "encrypted-package":
55+
is_supported = False
56+
57+
if element.get("{urn:oasis:names:tc:opendocument:xmlns:manifest:1.0}key-derivation-name") is not None:
58+
key_derivation_name = element.get("{urn:oasis:names:tc:opendocument:xmlns:manifest:1.0}key-derivation-name")
59+
60+
if element.get("{urn:oasis:names:tc:opendocument:xmlns:manifest:1.0}algorithm-name") is not None:
61+
algorithm_name = element.get("{urn:oasis:names:tc:opendocument:xmlns:manifest:1.0}algorithm-name")
62+
63+
if not is_supported:
64+
sys.stderr.write("%s is an unsupported encrypted OpenOffice file!\n" % filename)
65+
sys.stderr.write("- Algorithm name: '%s';\n" % algorithm_name)
66+
sys.stderr.write("- Key derivation name: '%s'.\n" % key_derivation_name)
67+
return 14
68+
5169
for i in range(0, len(elements) - 4):
5270
element = elements[i]
5371
if element.get("{urn:oasis:names:tc:opendocument:xmlns:manifest:1.0}full-path") == "content.xml":

0 commit comments

Comments
 (0)