Skip to content

Commit 101fc50

Browse files
magnumrippersolardiz
authored andcommitted
office2john: Emit a user-friendly message about missing olefile module
See #5931
1 parent 195d9f8 commit 101fc50

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

run/office2john.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
#!/usr/bin/env python3
22
#
33
# This software is Copyright (c) 2012-2013 Dhiru Kholia <dhiru at openwall.com>
4-
# and Copyright (c) 2013-2025 magnum,
4+
# and Copyright (c) 2013-2026 magnum,
55
# and is hereby released to the general public under the following terms:
66
# Redistribution and use in source and binary forms, with or without
77
# modification, are permitted.
88

9-
from olefile import isOleFile, OleFileIO
109
import sys
1110
import os
1211

12+
try:
13+
from olefile import isOleFile, OleFileIO
14+
except ImportError:
15+
print(f"{os.path.basename(sys.argv[0])}: olefile python module is missing, please install your distro's", file=sys.stderr)
16+
print("package, eg. 'sudo apt-get install python3-olefile' if available, otherwise", file=sys.stderr)
17+
print("'pip install --user olefile' (activate your venv if you already did that)", file=sys.stderr)
18+
sys.exit(1)
19+
1320
PY3 = sys.version_info[0] == 3
1421

1522
if not PY3:

0 commit comments

Comments
 (0)