summaryrefslogtreecommitdiff
path: root/ole1preview-dump.py
diff options
context:
space:
mode:
Diffstat (limited to 'ole1preview-dump.py')
-rwxr-xr-xole1preview-dump.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/ole1preview-dump.py b/ole1preview-dump.py
new file mode 100755
index 0000000..045c1d0
--- /dev/null
+++ b/ole1preview-dump.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from msodumper import ole1previewrecord
+import sys
+
+
+# Dumps the OLE1 preview: see [MS-OLEDS] 2.2.5.
+class Ole1PreviewDumper:
+ def __init__(self, filepath):
+ self.filepath = filepath
+
+ def dump(self):
+ file = open(self.filepath, 'rb')
+ strm = ole1previewrecord.Ole1PreviewStream(file.read())
+ file.close()
+ print('<?xml version="1.0"?>')
+ strm.dump()
+
+
+def main(args):
+ dumper = Ole1PreviewDumper(args[1])
+ dumper.dump()
+
+
+if __name__ == '__main__':
+ main(sys.argv)
+
+# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab: