Commit c7590d7de0c1b9fd73718b3e698c03c652f75d3c
1 parent
aa3e7991
mraptor compliant python3.5
Showing
2 changed files
with
6 additions
and
6 deletions
oletools/mraptor.py
| ... | ... | @@ -292,7 +292,7 @@ def main(): |
| 292 | 292 | vba_code_all_modules = '' |
| 293 | 293 | try: |
| 294 | 294 | for (subfilename, stream_path, vba_filename, vba_code) in vba_parser.extract_all_macros(): |
| 295 | - vba_code_all_modules += vba_code + '\n' | |
| 295 | + vba_code_all_modules += vba_code.decode('utf-8','replace') + '\n' | |
| 296 | 296 | except Exception as e: |
| 297 | 297 | # log.error('Error when parsing VBA macros from file %r' % full_name) |
| 298 | 298 | result = Result_Error | ... | ... |
oletools/thirdparty/tablestream/tablestream.py
| ... | ... | @@ -224,7 +224,7 @@ class TableStream(object): |
| 224 | 224 | assert len(row) == self.num_columns |
| 225 | 225 | columns = [] |
| 226 | 226 | max_lines = 0 |
| 227 | - for i in xrange(self.num_columns): | |
| 227 | + for i in range(self.num_columns): | |
| 228 | 228 | cell = row[i] |
| 229 | 229 | # Convert to string: |
| 230 | 230 | # TODO: handle unicode properly |
| ... | ... | @@ -233,7 +233,7 @@ class TableStream(object): |
| 233 | 233 | # encode to UTF8, avoiding errors |
| 234 | 234 | cell = cell.decode('utf-8', errors='replace') |
| 235 | 235 | else: |
| 236 | - cell = unicode(cell) | |
| 236 | + cell = cell | |
| 237 | 237 | # Wrap cell text according to the column width |
| 238 | 238 | # TODO: use a TextWrapper object for each column instead |
| 239 | 239 | column = textwrap.wrap(cell, width=self.column_width[i]) |
| ... | ... | @@ -241,16 +241,16 @@ class TableStream(object): |
| 241 | 241 | if colors is not None and self.outfile.isatty(): |
| 242 | 242 | color = colors[i] |
| 243 | 243 | if color: |
| 244 | - for j in xrange(len(column)): | |
| 244 | + for j in range(len(column)): | |
| 245 | 245 | # print '%r: %s' % (column[j], type(column[j])) |
| 246 | 246 | column[j] = colorclass.Color('{auto%s}%s{/%s}' % (color, column[j], color)) |
| 247 | 247 | columns.append(column) |
| 248 | 248 | # determine which column has the highest number of lines |
| 249 | 249 | max_lines = max(len(columns[i]), max_lines) |
| 250 | 250 | # transpose: write output line by line |
| 251 | - for j in xrange(max_lines): | |
| 251 | + for j in range(max_lines): | |
| 252 | 252 | self.write(self.style.vertical_left) |
| 253 | - for i in xrange(self.num_columns): | |
| 253 | + for i in range(self.num_columns): | |
| 254 | 254 | column = columns[i] |
| 255 | 255 | if j<len(column): |
| 256 | 256 | # text to be written | ... | ... |