(self)
Hashes various data blobs as defined in datablobs regex.
        Each datablob can be of type 'hash', meaning to hash the contents
        inside the object, or type 'value', which means to read the value after
        the tag
Hashes various data blobs as defined in datablobs regex.
        Each datablob can be of type 'hash', meaning to hash the contents
        inside the object, or type 'value', which means to read the value after
        the tag
Hashes various data blobs as defined in datablobs regex . Each datablob can be of type hash meaning to hash the contents inside the object or type value which means to read the value after the tag
def hash_data_blob(self):
        """Hashes various data blobs as defined in datablobs regex.
        Each datablob can be of type 'hash', meaning to hash the contents
        inside the object, or type 'value', which means to read the value after
        the tag"""
        for collector in self.datablobs:
            hashes = []
            data_offset = collector.get('offset', 0)
            name = collector.get('name', 'N/A')
            hash_re = re.compile(collector.get('regex'), re.M | re.S)
            m = hash_re.finditer(self.data)
            for n in m:
                try:
                    start = n.span()[0]
                    o = self.balanced_braces(self.data[start:])
                    if collector.get('type') == 'hash':
                        n = self.normalize_data_stream(o[data_offset:])
                        d = binascii.unhexlify(n)
                        hashes.append(hashlib.md5(d).hexdigest())
                    elif collector.get('type') == 'value':
                        result = bytes(o[data_offset:]).decode('utf-8')
                        hashes.append(result)
                except Exception as e:
                    if self.debug:
                        print("%s - %s" % (self.features.get('file_md5'), e))
            self.features[name] = self.unique_list(hashes)
def hash_data_blob ( self ) : for collector in self . datablobs : hashes = [ ] data_offset = collector . get ( 'offset' , 0 ) name = collector . get ( 'name' , 'N/A' ) hash_re = re . compile ( collector . get ( 'regex' ) , re . M | re . S ) m = hash_re . finditer ( self . data ) for n in m : try : start = n . span ( ) [ 0 ] o = self . balanced_braces ( self . data [ start : ] ) if collector . get ( 'type' ) == 'hash' : n = self . normalize_data_stream ( o [ data_offset : ] ) d = binascii . unhexlify ( n ) hashes . append ( hashlib . md5 ( d ) . hexdigest ( ) ) elif collector . get ( 'type' ) == 'value' : result = bytes ( o [ data_offset : ] ) . decode ( 'utf-8' ) hashes . append ( result ) except Exception as e : if self . debug : print ( "%s - %s" % ( self . features . get ( 'file_md5' ) , e ) ) self . features [ name ] = self . unique_list ( hashes )