Commit 95cf243479f56b242f04b0265cdbcaec14088337

Authored by Philippe Lagadec
1 parent 4a10d004

updated oletimes to use olefile, improved usage display and comments

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