mirror of
https://github.com/mandiant/capa.git
synced 2026-06-12 19:11:32 -07:00
idalib: remove custom idalib loading
This commit is contained in:
committed by
Willi Ballenthin
parent
b5f81e30f0
commit
9ba497f6f7
+2
-5
@@ -894,11 +894,8 @@ def get_idalib_extractor(path: Path):
|
||||
import capa.features.extractors.ida.idalib as idalib
|
||||
import capa.features.extractors.ida.extractor
|
||||
|
||||
if not idalib.has_idalib():
|
||||
raise RuntimeError("cannot find IDA idalib module.")
|
||||
|
||||
if not idalib.load_idalib():
|
||||
raise RuntimeError("failed to load IDA idalib module.")
|
||||
if not idalib.is_idalib_installed():
|
||||
raise RuntimeError("idalib is not available.")
|
||||
|
||||
_check_stale_idalib_files(path)
|
||||
|
||||
|
||||
@@ -16,30 +16,26 @@ import logging
|
||||
import pytest
|
||||
import fixtures
|
||||
|
||||
import capa.features.extractors.ida.idalib as idalib
|
||||
from capa.features.file import FunctionName
|
||||
from capa.features.insn import API
|
||||
from capa.features.common import Characteristic
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
idalib_present = idalib.has_idalib()
|
||||
if idalib_present:
|
||||
try:
|
||||
if True:
|
||||
# in order to use idalib, we have to import the idapro package
|
||||
# which manipulates the search path as a side effect.
|
||||
# we have to do this before importing ida_* packages.
|
||||
# but isort wants to put idapro after ida_kernwin, so we use
|
||||
# this dumb branch to keep the ordering correct.
|
||||
import idapro # noqa: F401 [imported but unused]
|
||||
import ida_kernwin
|
||||
try:
|
||||
if True:
|
||||
# in order to use idalib, we have to import the idapro package
|
||||
# which manipulates the search path as a side effect.
|
||||
# we have to do this before importing ida_* packages.
|
||||
# but isort wants to put idapro after ida_kernwin, so we use
|
||||
# this dumb branch to keep the ordering correct.
|
||||
import idapro # noqa: F401 [imported but unused]
|
||||
import ida_kernwin
|
||||
|
||||
kernel_version: str = ida_kernwin.get_kernel_version()
|
||||
except ImportError:
|
||||
idalib_present = False
|
||||
kernel_version = "0.0"
|
||||
else:
|
||||
kernel_version: str = ida_kernwin.get_kernel_version()
|
||||
idalib_present = True
|
||||
except ImportError:
|
||||
idalib_present = False
|
||||
kernel_version = "0.0"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user