Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to v3 #4

Merged
merged 17 commits into from
May 11, 2018
Prev Previous commit
Next Next commit
Recover msoffcrypto.py
  • Loading branch information
nolze committed May 10, 2018
commit 53ffe1ade3fb3d09d5ddcbd78d0364724b99d77a
15 changes: 15 additions & 0 deletions msoffcrypto/msoffcrypto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import olefile

def OfficeFile(file):
ole = olefile.OleFileIO(file)

## MS-DOC: The WordDocument stream MUST be present in the file.
## https://msdn.microsoft.com/en-us/library/dd926131(v=office.12).aspx
if ole.exists('wordDocument'):
from .format.doc97 import Doc97File
return Doc97File(file)
elif ole.exists('EncryptionInfo'):
from .format.ooxml import OOXMLFile
return OOXMLFile(file)
else:
raise AssertionError("Unrecognized file format")