(self)
libraries can be mapped differently in the original run(in the trace) and in angr
        this function identifies the difference(called aslr slides) of each library to help angr translate
        original address and address in angr back and forth
libraries can be mapped differently in the original run(in the trace) and in angr
        this function identifies the difference(called aslr slides) of each library to help angr translate
        original address and address in angr back and forth
libraries can be mapped differently in the original run ( in the trace ) and in angr this function identifies the difference ( called aslr slides ) of each library to help angr translate original address and address in angr back and forth
def _identify_aslr_slides(self):
        """
        libraries can be mapped differently in the original run(in the trace) and in angr
        this function identifies the difference(called aslr slides) of each library to help angr translate
        original address and address in angr back and forth
        """
        if self._aslr:
            # if we don't know whether there is any slide, we need to identify the slides via heuristics
            for obj in self.project.loader.all_objects:
                # do not analyze pseudo-objects
                if obj.binary_basename.startswith('cle##'):
                    continue

                # heuristic 1: non-PIC  objects are loaded without aslr slides
                if not obj.pic:
                    self._aslr_slides[obj] = 0
                    continue

                # heuristic 2: library objects with custom_base_addr are loaded at the correct locations
                if obj._custom_base_addr:
                    l.info("%s is assumed to be loaded at the address matching the one in the trace", obj)
                    self._aslr_slides[obj] = 0
                    continue

                # heuristic 3: entry point of an object should appear in the trace
                possibilities = None
                for entry in obj.initializers + ([obj.entry] if obj.is_main_bin else []):
                    indices = self._locate_entry_point(entry)
                    slides = {self._trace[idx] - entry for idx in indices}
                    if possibilities is None:
                        possibilities = slides
                    else:
                        possibilities.intersection_update(slides)

                if possibilities is None:
                    continue

                if len(possibilities) == 0:
                    raise AngrTracerError("Trace does not seem to contain object initializers for %s. Do you want to have a Tracer(aslr=False)?" % obj)
                if len(possibilities) == 1:
                    self._aslr_slides[obj] = next(iter(possibilities))
                else:
                    raise AngrTracerError("Trace seems ambiguous with respect to what the ASLR slides are for %s. This is surmountable, please open an issue." % obj)
        else:
            # if we know there is no slides, just trust the address in the loader
            for obj in self.project.loader.all_objects:
                # do not analyze pseudo-objects
                if obj.binary_basename.startswith('cle##'):
                    continue
                self._aslr_slides[obj] = 0
            self._current_slide = 0
def _identify_aslr_slides ( self ) : if self . _aslr : # if we don't know whether there is any slide, we need to identify the slides via heuristics for obj in self . project . loader . all_objects : # do not analyze pseudo-objects if obj . binary_basename . startswith ( 'cle##' ) : continue # heuristic 1: non-PIC  objects are loaded without aslr slides if not obj . pic : self . _aslr_slides [ obj ] = 0 continue # heuristic 2: library objects with custom_base_addr are loaded at the correct locations if obj . _custom_base_addr : l . info ( "%s is assumed to be loaded at the address matching the one in the trace" , obj ) self . _aslr_slides [ obj ] = 0 continue # heuristic 3: entry point of an object should appear in the trace possibilities = None for entry in obj . initializers + ( [ obj . entry ] if obj . is_main_bin else [ ] ) : indices = self . _locate_entry_point ( entry ) slides = { self . _trace [ idx ] - entry for idx in indices } if possibilities is None : possibilities = slides else : possibilities . intersection_update ( slides ) if possibilities is None : continue if len ( possibilities ) == 0 : raise AngrTracerError ( "Trace does not seem to contain object initializers for %s. Do you want to have a Tracer(aslr=False)?" % obj ) if len ( possibilities ) == 1 : self . _aslr_slides [ obj ] = next ( iter ( possibilities ) ) else : raise AngrTracerError ( "Trace seems ambiguous with respect to what the ASLR slides are for %s. This is surmountable, please open an issue." % obj ) else : # if we know there is no slides, just trust the address in the loader for obj in self . project . loader . all_objects : # do not analyze pseudo-objects if obj . binary_basename . startswith ( 'cle##' ) : continue self . _aslr_slides [ obj ] = 0 self . _current_slide = 0