``detect_base_address`` runs initial analysis and attempts to identify candidate base addresses .. note:: This operation can take a long time to complete depending on the size and complexity of the binary \ and the settings used :param Architecture arch: CPU archit
(
self,
arch: Optional[Union['architecture.Architecture', str]] = None,
analysis: Optional[Literal["basic", "controlFlow", "full"]] = "full",
min_strlen: Optional[int] = 10,
alignment: Optional[int] = 1024,
low_boundary: Optional[int] = 0,
high_boundary: Optional[int] = 0xFFFFFFFFFFFFFFFF,
poi_analysis: Optional[BaseAddressDetectionPOISetting] = BaseAddressDetectionPOISetting.POIAnalysisAll,
max_pointers: Optional[int] = 128,
)
| 160 | return core.BNIsBaseAddressDetectionAborted(self._handle) |
| 161 | |
| 162 | def detect_base_address( |
| 163 | self, |
| 164 | arch: Optional[Union['architecture.Architecture', str]] = None, |
| 165 | analysis: Optional[Literal["basic", "controlFlow", "full"]] = "full", |
| 166 | min_strlen: Optional[int] = 10, |
| 167 | alignment: Optional[int] = 1024, |
| 168 | low_boundary: Optional[int] = 0, |
| 169 | high_boundary: Optional[int] = 0xFFFFFFFFFFFFFFFF, |
| 170 | poi_analysis: Optional[BaseAddressDetectionPOISetting] = BaseAddressDetectionPOISetting.POIAnalysisAll, |
| 171 | max_pointers: Optional[int] = 128, |
| 172 | ) -> bool: |
| 173 | """ |
| 174 | ``detect_base_address`` runs initial analysis and attempts to identify candidate base addresses |
| 175 | |
| 176 | .. note:: This operation can take a long time to complete depending on the size and complexity of the binary \ |
| 177 | and the settings used |
| 178 | |
| 179 | :param Architecture arch: CPU architecture of the binary (defaults to using auto-detection) |
| 180 | :param str analysis: analysis mode (``basic``, ``controlFlow``, or ``full``) |
| 181 | :param int min_strlen: minimum length of a string to be considered a point-of-interest |
| 182 | :param int alignment: byte boundary to align the base address to while brute-forcing |
| 183 | :param int low_boundary: lower boundary of the base address range to test |
| 184 | :param int high_boundary: upper boundary of the base address range to test |
| 185 | :param BaseAddressDetectionPOISetting poi_analysis: specifies types of points-of-interest to use for analysis |
| 186 | :param int max_pointers: maximum number of candidate pointers to collect per pointer cluster |
| 187 | :return: True if initial analysis completed with results, False otherwise |
| 188 | :rtype: bool |
| 189 | """ |
| 190 | |
| 191 | if isinstance(arch, str): |
| 192 | arch = architecture.Architecture[arch] |
| 193 | |
| 194 | if not arch and self._view_arch: |
| 195 | arch = self._view_arch |
| 196 | |
| 197 | if analysis not in ["basic", "controlFlow", "full"]: |
| 198 | raise ValueError("invalid analysis setting") |
| 199 | |
| 200 | if alignment <= 0: |
| 201 | raise ValueError("alignment must be greater than 0") |
| 202 | |
| 203 | if max_pointers < 2: |
| 204 | raise ValueError("max pointers must be at least 2") |
| 205 | |
| 206 | if high_boundary < low_boundary: |
| 207 | raise ValueError("upper boundary must be greater than lower boundary") |
| 208 | |
| 209 | archname = arch.name if arch else "" |
| 210 | settings = core.BNBaseAddressDetectionSettings( |
| 211 | archname.encode(), |
| 212 | analysis.encode(), |
| 213 | min_strlen, |
| 214 | alignment, |
| 215 | low_boundary, |
| 216 | high_boundary, |
| 217 | poi_analysis, |
| 218 | max_pointers, |
| 219 | ) |