Commit fa476b8f4bd1cea7a69d071e49b7b6712316abfe
1 parent
3d3fb43c
ftguess: added is_ole and is_openxml
Showing
1 changed file
with
14 additions
and
0 deletions
oletools/ftguess.py
| @@ -650,6 +650,20 @@ class FileTypeGuesser(object): | @@ -650,6 +650,20 @@ class FileTypeGuesser(object): | ||
| 650 | if self.zipfile is not None: | 650 | if self.zipfile is not None: |
| 651 | self.zipfile.close() | 651 | self.zipfile.close() |
| 652 | 652 | ||
| 653 | + def is_ole(self): | ||
| 654 | + """ | ||
| 655 | + Shortcut to check if the container is OLE | ||
| 656 | + :return: bool | ||
| 657 | + """ | ||
| 658 | + return issubclass(self.ftype, FType_Generic_OLE) or self.container == CONTAINER.OLE | ||
| 659 | + | ||
| 660 | + def is_openxml(self): | ||
| 661 | + """ | ||
| 662 | + Shortcut to check if the container is OpenXML | ||
| 663 | + :return: bool | ||
| 664 | + """ | ||
| 665 | + return issubclass(self.ftype, FType_Generic_OpenXML) or self.container == CONTAINER.OpenXML | ||
| 666 | + | ||
| 653 | def is_word(self): | 667 | def is_word(self): |
| 654 | """ | 668 | """ |
| 655 | Shortcut to check if a file is an Excel workbook, template or add-in | 669 | Shortcut to check if a file is an Excel workbook, template or add-in |