Skip to content

Commit 1e03d39

Browse files
committed
office2john: Emit a user-friendly message about missing olefile module
See #5931
1 parent 195d9f8 commit 1e03d39

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"{sys.argv[0]}: olefile python module is missing, please install it using", file=sys.stderr)
16+
print("'pip install --user olefile' (or activate your venv)", file=sys.stderr)
17+
print("\nor use your distro's package if available, eg. 'sudo apt-get -y install python3-olefile'\n")
18+
sys.exit(1)
19+
1320
PY3 = sys.version_info[0] == 3
1421

1522
if not PY3:

0 commit comments

Comments
 (0)