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