Commit 4a10d004ba37e97bf0272a87f98789cb10d808cd

Authored by Philippe Lagadec
1 parent 877d7b34

updated olemeta to use olefile, improved usage display and comments

Showing 1 changed file with 39 additions and 31 deletions
oletools/olemeta.py
@@ -11,49 +11,57 @@ olemeta project website: http://www.decalage.info/python/olemeta @@ -11,49 +11,57 @@ olemeta project website: http://www.decalage.info/python/olemeta
11 11
12 olemeta is part of the python-oletools package: 12 olemeta is part of the python-oletools package:
13 http://www.decalage.info/python/oletools 13 http://www.decalage.info/python/oletools
14 -  
15 -olemeta is copyright (c) 2013, Philippe Lagadec (http://www.decalage.info)  
16 -All rights reserved.  
17 -  
18 -Redistribution and use in source and binary forms, with or without modification,  
19 -are permitted provided that the following conditions are met:  
20 -  
21 - * Redistributions of source code must retain the above copyright notice, this  
22 - list of conditions and the following disclaimer.  
23 - * Redistributions in binary form must reproduce the above copyright notice,  
24 - this list of conditions and the following disclaimer in the documentation  
25 - and/or other materials provided with the distribution.  
26 -  
27 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND  
28 -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED  
29 -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE  
30 -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE  
31 -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  
32 -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR  
33 -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER  
34 -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,  
35 -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE  
36 -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
37 """ 14 """
38 15
39 -__version__ = '0.01' 16 +#=== LICENSE =================================================================
  17 +
  18 +# olemeta is copyright (c) 2013-2014, Philippe Lagadec (http://www.decalage.info)
  19 +# All rights reserved.
  20 +#
  21 +# Redistribution and use in source and binary forms, with or without modification,
  22 +# are permitted provided that the following conditions are met:
  23 +#
  24 +# * Redistributions of source code must retain the above copyright notice, this
  25 +# list of conditions and the following disclaimer.
  26 +# * Redistributions in binary form must reproduce the above copyright notice,
  27 +# this list of conditions and the following disclaimer in the documentation
  28 +# and/or other materials provided with the distribution.
  29 +#
  30 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  31 +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  32 +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  33 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  34 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  36 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  37 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  38 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 40
41 #------------------------------------------------------------------------------ 41 #------------------------------------------------------------------------------
42 # CHANGELOG: 42 # CHANGELOG:
43 -# 2013-07-24 v0.01 PL 43 +# 2013-07-24 v0.01 PL: - first version
  44 +# 2014-11-29 v0.02 PL: - use olefile instead of OleFileIO_PL
  45 +# - improved usage display
  46 +
  47 +__version__ = '0.02'
44 48
45 #------------------------------------------------------------------------------ 49 #------------------------------------------------------------------------------
46 # TODO: 50 # TODO:
47 # + optparse 51 # + optparse
48 -# + nicer output  
49 -# - CSV output  
50 -# - option to only show available properties (by default) 52 +# + nicer output: table with fixed columns, datetime, etc
  53 +# + CSV output
  54 +# + option to only show available properties (by default)
51 55
52 -import sys  
53 -from thirdparty.OleFileIO_PL import OleFileIO_PL 56 +#=== IMPORTS =================================================================
54 57
  58 +import sys
  59 +import thirdparty.olefile as olefile
55 60
56 -ole = OleFileIO_PL.OleFileIO(sys.argv[1]) 61 +try:
  62 + ole = olefile.OleFileIO(sys.argv[1])
  63 +except IndexError:
  64 + sys.exit(__doc__)
57 65
58 # parse and display metadata: 66 # parse and display metadata:
59 meta = ole.get_metadata() 67 meta = ole.get_metadata()