Commit 5699d8bf95971b242778265938920cc32221a9de
1 parent
13eb7056
olevba3: import io instead of _io
Showing
1 changed file
with
9 additions
and
3 deletions
oletools/olevba3.py
| ... | ... | @@ -79,7 +79,6 @@ https://github.com/unixfreak0037/officeparser |
| 79 | 79 | |
| 80 | 80 | from __future__ import print_function |
| 81 | 81 | |
| 82 | - | |
| 83 | 82 | #------------------------------------------------------------------------------ |
| 84 | 83 | # CHANGELOG: |
| 85 | 84 | # 2014-08-05 v0.01 PL: - first version based on officeparser code |
| ... | ... | @@ -248,7 +247,7 @@ import sys |
| 248 | 247 | import os |
| 249 | 248 | import logging |
| 250 | 249 | import struct |
| 251 | -from _io import StringIO,BytesIO | |
| 250 | +from io import BytesIO | |
| 252 | 251 | import math |
| 253 | 252 | import zipfile |
| 254 | 253 | import re |
| ... | ... | @@ -259,7 +258,6 @@ import zlib |
| 259 | 258 | import email # for MHTML parsing |
| 260 | 259 | import string # for printable |
| 261 | 260 | import json # for json output mode (argument --json) |
| 262 | -from functools import reduce | |
| 263 | 261 | |
| 264 | 262 | # import lxml or ElementTree for XML parsing: |
| 265 | 263 | try: |
| ... | ... | @@ -278,6 +276,13 @@ except ImportError: |
| 278 | 276 | + "see http://codespeak.net/lxml " \ |
| 279 | 277 | + "or http://effbot.org/zone/element-index.htm") |
| 280 | 278 | |
| 279 | +import colorclass | |
| 280 | + | |
| 281 | +# On Windows, colorclass needs to be enabled: | |
| 282 | +if os.name == 'nt': | |
| 283 | + colorclass.Windows.enable(auto_colors=True) | |
| 284 | + | |
| 285 | + | |
| 281 | 286 | # IMPORTANT: it should be possible to run oletools directly as scripts |
| 282 | 287 | # in any directory without installing them with pip or setup.py. |
| 283 | 288 | # In that case, relative imports are NOT usable. |
| ... | ... | @@ -324,6 +329,7 @@ else: |
| 324 | 329 | from zipfile import is_zipfile |
| 325 | 330 | # xrange is now called range: |
| 326 | 331 | xrange = range |
| 332 | + from functools import reduce | |
| 327 | 333 | |
| 328 | 334 | |
| 329 | 335 | # === PYTHON 3.0 - 3.4 SUPPORT ====================================================== | ... | ... |