decalage2 / oletools

oletools - python tools to analyze MS OLE2 files (Structured Storage, Compound File Binary Format) and MS Office documents, for malware analysis, forensics and debugging.
http://www.decalage.info/python/oletools
Other
2.92k stars 562 forks source link

python3 setup.py test fails #173

Open xambroz opened 7 years ago

xambroz commented 7 years ago

Hello, the "setup.py test" fails for python3. I guess there should be oletools in the imports like "import oletools.oleobj as oleobj"


$ python3 setup.py test
running test
running egg_info
writing top-level names to oletools.egg-info/top_level.txt
writing oletools.egg-info/PKG-INFO
writing dependency_links to oletools.egg-info/dependency_links.txt
writing entry points to oletools.egg-info/entry_points.txt
reading manifest file 'oletools.egg-info/SOURCES.txt'
writing manifest file 'oletools.egg-info/SOURCES.txt'
running build_ext
olevba (unittest.loader._FailedTest) ... ERROR
pyxswf (unittest.loader._FailedTest) ... ERROR
ezhexviewer (unittest.loader._FailedTest) ... ERROR
oleobj (unittest.loader._FailedTest) ... ERROR
mraptor_milter (unittest.loader._FailedTest) ... ERROR
mraptor3 (unittest.loader._FailedTest) ... ERROR
olemap (unittest.loader._FailedTest) ... ERROR
olebrowse (unittest.loader._FailedTest) ... ERROR
olemeta (unittest.loader._FailedTest) ... ERROR
mraptor (unittest.loader._FailedTest) ... ERROR
rtfobj (unittest.loader._FailedTest) ... ERROR
oletimes (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: olevba (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: olevba
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/olevba.py", line 227, in <module>
    import cStringIO
ImportError: No module named 'cStringIO'

======================================================================
ERROR: pyxswf (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: pyxswf
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/pyxswf.py", line 77, in <module>
    import optparse, sys, os, rtfobj
ImportError: No module named 'rtfobj'

======================================================================
ERROR: ezhexviewer (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: ezhexviewer
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/ezhexviewer.py", line 57, in <module>
    from thirdparty.easygui import easygui
ImportError: No module named 'thirdparty'

======================================================================
ERROR: oleobj (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: oleobj
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/oleobj.py", line 71, in <module>
    from thirdparty.olefile import olefile
ImportError: No module named 'thirdparty'

======================================================================
ERROR: mraptor_milter (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: mraptor_milter
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/mraptor_milter.py", line 71, in <module>
    import Milter
ImportError: No module named 'Milter'

======================================================================
ERROR: mraptor3 (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: mraptor3
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/mraptor3.py", line 66, in <module>
    from thirdparty.xglob import xglob
ImportError: No module named 'thirdparty'

======================================================================
ERROR: olemap (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: olemap
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/olemap.py", line 55, in <module>
    from thirdparty.olefile import olefile
ImportError: No module named 'thirdparty'

======================================================================
ERROR: olebrowse (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: olebrowse
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/olebrowse.py", line 55, in <module>
    from thirdparty.easygui import easygui
ImportError: No module named 'thirdparty'

======================================================================
ERROR: olemeta (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: olemeta
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/olemeta.py", line 63, in <module>
    import thirdparty.olefile as olefile
ImportError: No module named 'thirdparty'

======================================================================
ERROR: mraptor (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: mraptor
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/mraptor.py", line 68, in <module>
    from thirdparty.xglob import xglob
ImportError: No module named 'thirdparty'

======================================================================
ERROR: rtfobj (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: rtfobj
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/rtfobj.py", line 85, in <module>
    from thirdparty.xglob import xglob
ImportError: No module named 'thirdparty'

======================================================================
ERROR: oletimes (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: oletimes
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/rpmbuild/BUILD/oletools-0.50/oletools/oletimes.py", line 64, in <module>
    import thirdparty.olefile as olefile
ImportError: No module named 'thirdparty'

----------------------------------------------------------------------
Ran 12 tests in 0.002s

FAILED (errors=12)
xambroz commented 7 years ago

Tried with current dev version from github. Imports from "thirdparty" are fixed now. What remains is Milter and cStringIO. The cStringIO is python2 thingie - there should be probably some try/except for io.StringIO (if it works in python3 the same way)

The Milter probably doesn't exist yet for python3 so the module mraptor_milter.py will probably work just with python2 - https://github.com/jmehnle/pymilter/issues/2

======== Cut here ==================================

$ python3 setup.py test
/usr/lib/python3.5/site-packages/setuptools/dist.py:364: UserWarning: Normalizing '0.51dev8' to '0.51.dev8'
  normalized_version,
running test
running egg_info
writing dependency_links to oletools.egg-info/dependency_links.txt
writing top-level names to oletools.egg-info/top_level.txt
writing oletools.egg-info/PKG-INFO
writing entry points to oletools.egg-info/entry_points.txt
reading manifest file 'oletools.egg-info/SOURCES.txt'
writing manifest file 'oletools.egg-info/SOURCES.txt'
running build_ext
olevba (unittest.loader._FailedTest) ... ERROR
mraptor_milter (unittest.loader._FailedTest) ... ERROR
mraptor (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: olevba (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: olevba
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/opt/oletools/oletools/olevba.py", line 237, in <module>
    import cStringIO
ImportError: No module named 'cStringIO'

======================================================================
ERROR: mraptor_milter (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: mraptor_milter
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/opt/oletools/oletools/mraptor_milter.py", line 72, in <module>
    import Milter
ImportError: No module named 'Milter'

======================================================================
ERROR: mraptor (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: mraptor
Traceback (most recent call last):
  File "/usr/lib64/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mambroz/opt/oletools/oletools/mraptor.py", line 85, in <module>
    from oletools import olevba
  File "/home/mambroz/opt/oletools/oletools/olevba.py", line 237, in <module>
    import cStringIO
ImportError: No module named 'cStringIO'

----------------------------------------------------------------------
Ran 3 tests in 0.001s

FAILED (errors=3)