Skip to content

Commit

Permalink
Merge branch 'master' into Aayush-Goel-04/Issue#331
Browse files Browse the repository at this point in the history
  • Loading branch information
williballenthin authored Aug 9, 2023
2 parents c497ad8 + 448aa9c commit f1e737a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- linter: skip native API check for NtProtectVirtualMemory #1675 @williballenthin

### capa explorer IDA Pro plugin
- fix unhandled exception when resolving rule path #1693 @mike-hunhoff

### Development

Expand Down
11 changes: 6 additions & 5 deletions capa/ida/plugin/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,11 @@ def ida_hook_rebase(self, meta, post=False):

def ensure_capa_settings_rule_path(self):
try:
path: Path = Path(settings.user.get(CAPA_SETTINGS_RULE_PATH, ""))
path: str = settings.user.get(CAPA_SETTINGS_RULE_PATH, "")

# resolve rules directory - check self and settings first, then ask user
if not path.exists():
# pathlib.Path considers "" equivalent to "." so we first check if rule path is an empty string
if not path or not Path(path).exists():
# configure rules selection messagebox
rules_message = QtWidgets.QMessageBox()
rules_message.setIcon(QtWidgets.QMessageBox.Information)
Expand All @@ -594,15 +595,15 @@ def ensure_capa_settings_rule_path(self):
if pressed == QtWidgets.QMessageBox.Cancel:
raise UserCancelledError()

path = Path(self.ask_user_directory())
path = self.ask_user_directory()
if not path:
raise UserCancelledError()

if not path.exists():
if not Path(path).exists():
logger.error("rule path %s does not exist or cannot be accessed", path)
return False

settings.user[CAPA_SETTINGS_RULE_PATH] = str(path)
settings.user[CAPA_SETTINGS_RULE_PATH] = path
except UserCancelledError:
capa.ida.helpers.inform_user_ida_ui("Analysis requires capa rules")
logger.warning(
Expand Down

0 comments on commit f1e737a

Please sign in to comment.