File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323from datetime import datetime
2424from functools import partial
2525
26+ import six
27+
2628
2729class memoize (object ):
2830 """cache the return value of a method
@@ -557,7 +559,7 @@ def unpack_guid(self, offset):
557559 raise OverrunBufferException (o , len (self ._buf ))
558560
559561 # Yeah, this is ugly
560- h = _bin
562+ h = [ six . indexbytes ( _bin , i ) for i in range ( len ( _bin ))]
561563 return """{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}""" .format (
562564 h [3 ], h [2 ], h [1 ], h [0 ],
563565 h [5 ], h [4 ],
Original file line number Diff line number Diff line change 1919import base64
2020import itertools
2121
22+ import six
2223import hexdump
2324
2425from .BinaryParser import Block
@@ -1010,17 +1011,19 @@ def fast_substitutions(self):
10101011 val = self .unpack_dword (ofs + 8 + (4 * i ))
10111012 value += "-{}" .format (val )
10121013 sub_def .append (value )
1013- #[20] = parse_hex32_type_node, -- Hex32TypeNoe , 0x14
1014+ #[20] = parse_hex32_type_node, -- Hex32TypeNode , 0x14
10141015 elif type_ == 0x14 :
10151016 value = "0x"
1016- for c in self .unpack_binary (ofs , size )[::- 1 ]:
1017- value += "{:02x}" .format (c )
1017+ b = self .unpack_binary (ofs , size )[::- 1 ]
1018+ for i in range (len (b ) - 1 ):
1019+ value += '{:02x}' .format (six .indexbytes (b , i ))
10181020 sub_def .append (value )
10191021 #[21] = parse_hex64_type_node, -- Hex64TypeNode, 0x15
10201022 elif type_ == 0x15 :
10211023 value = "0x"
1022- for c in bytes (self .unpack_binary (ofs , size )[::- 1 ]):
1023- value += "{:02x}" .format (c )
1024+ b = self .unpack_binary (ofs , size )[::- 1 ]
1025+ for i in range (len (b ) - 1 ):
1026+ value += '{:02x}' .format (six .indexbytes (b , i ))
10241027 sub_def .append (value )
10251028 #[33] = parse_bxml_type_node, -- BXmlTypeNode, 0x21
10261029 elif type_ == 0x21 :
You can’t perform that action at this time.
0 commit comments