Commit dfc2cd919bbfa896307cc882437b101a54a3e8d6
1 parent
ee1834c6
olemeta: only display properties when present in the file
Showing
1 changed file
with
17 additions
and
2 deletions
oletools/olemeta.py
| @@ -43,8 +43,9 @@ http://www.decalage.info/python/oletools | @@ -43,8 +43,9 @@ http://www.decalage.info/python/oletools | ||
| 43 | # 2013-07-24 v0.01 PL: - first version | 43 | # 2013-07-24 v0.01 PL: - first version |
| 44 | # 2014-11-29 v0.02 PL: - use olefile instead of OleFileIO_PL | 44 | # 2014-11-29 v0.02 PL: - use olefile instead of OleFileIO_PL |
| 45 | # - improved usage display | 45 | # - improved usage display |
| 46 | +# 2015-12-29 v0.03 PL: - only display properties present in the file | ||
| 46 | 47 | ||
| 47 | -__version__ = '0.02' | 48 | +__version__ = '0.03' |
| 48 | 49 | ||
| 49 | #------------------------------------------------------------------------------ | 50 | #------------------------------------------------------------------------------ |
| 50 | # TODO: | 51 | # TODO: |
| @@ -68,6 +69,20 @@ except IndexError: | @@ -68,6 +69,20 @@ except IndexError: | ||
| 68 | 69 | ||
| 69 | # parse and display metadata: | 70 | # parse and display metadata: |
| 70 | meta = ole.get_metadata() | 71 | meta = ole.get_metadata() |
| 71 | -meta.dump() | 72 | + |
| 73 | +print('Properties from SummaryInformation stream:') | ||
| 74 | +for prop in meta.SUMMARY_ATTRIBS: | ||
| 75 | + value = getattr(meta, prop) | ||
| 76 | + if value is not None: | ||
| 77 | + # TODO: pretty printing for strings, dates, numbers | ||
| 78 | + print('- %s: %s' % (prop, value)) | ||
| 79 | +print '' | ||
| 80 | +print('Properties from DocumentSummaryInformation stream:') | ||
| 81 | +for prop in meta.DOCSUM_ATTRIBS: | ||
| 82 | + value = getattr(meta, prop) | ||
| 83 | + if value is not None: | ||
| 84 | + # TODO: pretty printing for strings, dates, numbers | ||
| 85 | + print('- %s: %s' % (prop, value)) | ||
| 86 | + | ||
| 72 | 87 | ||
| 73 | ole.close() | 88 | ole.close() |