Beispiel #1
0
 def __repr__(self):
     if self.size != 0:
         return ' '.join(('STACK CFI INIT', hex_str(self.address),
                          hex_str(self.size), ' '.join(self.entries)))
     else:
         return ' '.join(
             ('STACK CFI', hex_str(self.address), ' '.join(self.entries)))
Beispiel #2
0
 def __str__(self):
     res = 'L'
     if self.address_diff:
         res += hex_str(self.address_diff)
     res += ':'
     if self.size_diff:
         res += hex_str(self.size_diff)
     return res + '\n'
Beispiel #3
0
    def __repr__(self):
        res = ' '.join(
            ('FUNC', hex_str(self.address), hex_str(self.size),
             hex_str(self.parameter_size), ' '.join(self.name))) + '\n'
        for line in self.lines:
            res = res + str(line) + '\n'

        return res
Beispiel #4
0
    def __str__(self):
        if self.size_diff:
            res = hex_str(self.size_diff // 8)
        else:
            res = ''
        if self.address_diff:
            res += ':' + hex_str(self.address_diff)

        return res
Beispiel #5
0
 def __repr__(self):
     res = 'Substitute ' + hex_str(
         self.deleted_size) + ' lines for ' + hex_str(len(
             self.added_lines)) + ' lines at ' + hex_str(self.offset) + '\n'
     for line in self.deleted_lines:
         res += str(line) + '\n'
     res += 'For:\n'
     for line in self.added_lines:
         res += str(line) + '\n'
     return res
Beispiel #6
0
 def __str__(self):
     res = ''
     prev_idx = -1
     for (idx, func) in enumerate(self.func_patches):
         patch = str(func)
         # We won't output empty patches. We simply prepend an offset to every function patch
         # that represents the number of empty patches that went before. If the offset is 0,
         # don't encode it.
         if patch != '\n':
             offset = idx - prev_idx - 1
             if offset:
                 res += hex_str(offset)
             res += 'F' + patch
             prev_idx = idx
     return res
Beispiel #7
0
    def __str__(self):
        # If it exists, encode the stack offset in the function patch header. Else simply finish the header.
        if self.stack_patch:
            res = str(self.stack_patch) + '\n'
        else:
            res = '\n'

        # We encode the relative offsets between patches in such a way that two patches on two lines right after each other have offset 0
        # If the offset is 0 we don't encode it.
        prev_offset = -1
        for patch in self.patches:
            rel_offset = patch.offset - prev_offset - 1
            if rel_offset:
                res += hex_str(rel_offset)
            res += str(patch)
            prev_offset = patch.offset
        return res
Beispiel #8
0
 def __str__(self):
     return 'D' + hex_str(self.size) + '\n'
Beispiel #9
0
 def __repr__(self):
     res = 'Delete ' + hex_str(self.size) + ' lines at ' + hex_str(
         self.offset) + '\n'
     for line in self.lines:
         res += str(line) + '\n'
     return res
Beispiel #10
0
 def __repr__(self):
     return 'Patch the stack record with size difference: ' + hex_str(
         self.size_diff) + ' and address difference: ' + hex_str(
             self.address_diff) + '\n'
Beispiel #11
0
 def __str__(self):
     res = 'A' + hex_str(len(self.lines)) + '\n'
     for line in self.lines:
         res += str(line) + '\n'
     return res
Beispiel #12
0
 def __str__(self):
     res = 'S' + hex_str(self.deleted_size) + ':' + hex_str(
         len(self.added_lines)) + '\n'
     for line in self.added_lines:
         res += str(line) + '\n'
     return res
Beispiel #13
0
 def __repr__(self):
     res = 'Add ' + hex_str(len(self.lines)) + ' lines at ' + hex_str(
         self.offset) + '\n'
     for line in self.lines:
         res += str(line) + '\n'
     return res
Beispiel #14
0
 def __repr__(self):
     res = 'Change line at ' + hex_str(self.offset) + '\n'
     res += 'Address diff: ' + hex_str(self.address_diff) + '\n'
     res += 'Size diff: ' + hex_str(self.size_diff) + '\n'
     return res
Beispiel #15
0
 def __repr__(self):
     return ' '.join(
         (hex_str(self.address), hex_str(self.size), str(self.location)))
Beispiel #16
0
 def __repr__(self):
     return ' '.join(('PUBLIC', hex_str(self.address),
                      hex_str(self.parameter_size), ' '.join(self.name)))