idapro 0.0.5__tar.gz → 0.0.6.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. {idapro-0.0.5 → idapro-0.0.6.dev2}/PKG-INFO +5 -1
  2. {idapro-0.0.5 → idapro-0.0.6.dev2}/idapro/__init__.py +23 -24
  3. {idapro-0.0.5 → idapro-0.0.6.dev2}/idapro/config.py +15 -12
  4. {idapro-0.0.5 → idapro-0.0.6.dev2}/idapro/stubs/ida_allins.pyi +325 -47
  5. idapro-0.0.6.dev2/idapro/stubs/ida_auto.pyi +329 -0
  6. idapro-0.0.6.dev2/idapro/stubs/ida_bitrange.pyi +161 -0
  7. idapro-0.0.6.dev2/idapro/stubs/ida_bytes.pyi +3138 -0
  8. idapro-0.0.6.dev2/idapro/stubs/ida_dbg.pyi +3108 -0
  9. idapro-0.0.6.dev2/idapro/stubs/ida_dirtree.pyi +1297 -0
  10. idapro-0.0.6.dev2/idapro/stubs/ida_diskio.pyi +506 -0
  11. idapro-0.0.6.dev2/idapro/stubs/ida_entry.pyi +93 -0
  12. idapro-0.0.6.dev2/idapro/stubs/ida_expr.pyi +861 -0
  13. idapro-0.0.6.dev2/idapro/stubs/ida_fixup.pyi +412 -0
  14. idapro-0.0.6.dev2/idapro/stubs/ida_fpro.pyi +203 -0
  15. idapro-0.0.6.dev2/idapro/stubs/ida_frame.pyi +952 -0
  16. idapro-0.0.6.dev2/idapro/stubs/ida_funcs.pyi +1931 -0
  17. idapro-0.0.6.dev2/idapro/stubs/ida_gdl.pyi +1217 -0
  18. idapro-0.0.6.dev2/idapro/stubs/ida_graph.pyi +4102 -0
  19. idapro-0.0.6.dev2/idapro/stubs/ida_hexrays.pyi +25331 -0
  20. idapro-0.0.6.dev2/idapro/stubs/ida_ida.pyi +2282 -0
  21. idapro-0.0.6.dev2/idapro/stubs/ida_idaapi.pyi +2074 -0
  22. idapro-0.0.6.dev2/idapro/stubs/ida_idc.pyi +15 -0
  23. idapro-0.0.6.dev2/idapro/stubs/ida_idd.pyi +3639 -0
  24. idapro-0.0.6.dev2/idapro/stubs/ida_idp.pyi +4327 -0
  25. idapro-0.0.6.dev2/idapro/stubs/ida_ieee.pyi +330 -0
  26. idapro-0.0.6.dev2/idapro/stubs/ida_kernwin.pyi +10837 -0
  27. idapro-0.0.6.dev2/idapro/stubs/ida_libfuncs.pyi +160 -0
  28. idapro-0.0.6.dev2/idapro/stubs/ida_lines.pyi +373 -0
  29. idapro-0.0.6.dev2/idapro/stubs/ida_loader.pyi +942 -0
  30. idapro-0.0.6.dev2/idapro/stubs/ida_merge.pyi +948 -0
  31. {idapro-0.0.5 → idapro-0.0.6.dev2}/idapro/stubs/ida_mergemod.pyi +6 -46
  32. idapro-0.0.6.dev2/idapro/stubs/ida_moves.pyi +1094 -0
  33. idapro-0.0.6.dev2/idapro/stubs/ida_nalt.pyi +2121 -0
  34. idapro-0.0.6.dev2/idapro/stubs/ida_name.pyi +854 -0
  35. idapro-0.0.6.dev2/idapro/stubs/ida_netnode.pyi +389 -0
  36. idapro-0.0.6.dev2/idapro/stubs/ida_offset.pyi +167 -0
  37. idapro-0.0.6.dev2/idapro/stubs/ida_pro.pyi +5386 -0
  38. idapro-0.0.6.dev2/idapro/stubs/ida_problems.pyi +83 -0
  39. idapro-0.0.6.dev2/idapro/stubs/ida_range.pyi +844 -0
  40. idapro-0.0.6.dev2/idapro/stubs/ida_regfinder.pyi +664 -0
  41. idapro-0.0.6.dev2/idapro/stubs/ida_registry.pyi +186 -0
  42. idapro-0.0.6.dev2/idapro/stubs/ida_search.pyi +63 -0
  43. idapro-0.0.6.dev2/idapro/stubs/ida_segment.pyi +1044 -0
  44. idapro-0.0.6.dev2/idapro/stubs/ida_segregs.pyi +269 -0
  45. idapro-0.0.6.dev2/idapro/stubs/ida_srclang.pyi +102 -0
  46. idapro-0.0.6.dev2/idapro/stubs/ida_strlist.pyi +224 -0
  47. idapro-0.0.6.dev2/idapro/stubs/ida_tryblks.pyi +947 -0
  48. idapro-0.0.6.dev2/idapro/stubs/ida_typeinf.pyi +10336 -0
  49. idapro-0.0.6.dev2/idapro/stubs/ida_ua.pyi +1575 -0
  50. idapro-0.0.6.dev2/idapro/stubs/ida_undo.pyi +43 -0
  51. idapro-0.0.6.dev2/idapro/stubs/ida_xref.pyi +594 -0
  52. idapro-0.0.6.dev2/idapro/stubs/idaapi.pyi +117152 -0
  53. idapro-0.0.6.dev2/idapro/stubs/idadex.pyi +1157 -0
  54. idapro-0.0.6.dev2/idapro/stubs/idautils.pyi +573 -0
  55. idapro-0.0.6.dev2/idapro/stubs/idc.pyi +5723 -0
  56. {idapro-0.0.5 → idapro-0.0.6.dev2}/idapro.egg-info/PKG-INFO +5 -1
  57. {idapro-0.0.5 → idapro-0.0.6.dev2}/idapro.egg-info/SOURCES.txt +0 -1
  58. {idapro-0.0.5 → idapro-0.0.6.dev2}/setup.py +4 -1
  59. idapro-0.0.5/idapro/stubs/ida_api.pyi +0 -34096
  60. idapro-0.0.5/idapro/stubs/ida_auto.pyi +0 -311
  61. idapro-0.0.5/idapro/stubs/ida_bitrange.pyi +0 -158
  62. idapro-0.0.5/idapro/stubs/ida_bytes.pyi +0 -2637
  63. idapro-0.0.5/idapro/stubs/ida_dbg.pyi +0 -2398
  64. idapro-0.0.5/idapro/stubs/ida_dirtree.pyi +0 -952
  65. idapro-0.0.5/idapro/stubs/ida_diskio.pyi +0 -409
  66. idapro-0.0.5/idapro/stubs/ida_entry.pyi +0 -124
  67. idapro-0.0.5/idapro/stubs/ida_expr.pyi +0 -697
  68. idapro-0.0.5/idapro/stubs/ida_fixup.pyi +0 -355
  69. idapro-0.0.5/idapro/stubs/ida_fpro.pyi +0 -192
  70. idapro-0.0.5/idapro/stubs/ida_frame.pyi +0 -772
  71. idapro-0.0.5/idapro/stubs/ida_funcs.pyi +0 -1472
  72. idapro-0.0.5/idapro/stubs/ida_gdl.pyi +0 -878
  73. idapro-0.0.5/idapro/stubs/ida_graph.pyi +0 -2856
  74. idapro-0.0.5/idapro/stubs/ida_hexrays.pyi +0 -17971
  75. idapro-0.0.5/idapro/stubs/ida_ida.pyi +0 -1707
  76. idapro-0.0.5/idapro/stubs/ida_idaapi.pyi +0 -1573
  77. idapro-0.0.5/idapro/stubs/ida_idc.pyi +0 -53
  78. idapro-0.0.5/idapro/stubs/ida_idd.pyi +0 -2562
  79. idapro-0.0.5/idapro/stubs/ida_idp.pyi +0 -3570
  80. idapro-0.0.5/idapro/stubs/ida_ieee.pyi +0 -278
  81. idapro-0.0.5/idapro/stubs/ida_kernwin.pyi +0 -8279
  82. idapro-0.0.5/idapro/stubs/ida_libfuncs.pyi +0 -171
  83. idapro-0.0.5/idapro/stubs/ida_lines.pyi +0 -355
  84. idapro-0.0.5/idapro/stubs/ida_loader.pyi +0 -760
  85. idapro-0.0.5/idapro/stubs/ida_merge.pyi +0 -776
  86. idapro-0.0.5/idapro/stubs/ida_moves.pyi +0 -685
  87. idapro-0.0.5/idapro/stubs/ida_nalt.pyi +0 -1590
  88. idapro-0.0.5/idapro/stubs/ida_name.pyi +0 -719
  89. idapro-0.0.5/idapro/stubs/ida_netnode.pyi +0 -287
  90. idapro-0.0.5/idapro/stubs/ida_offset.pyi +0 -194
  91. idapro-0.0.5/idapro/stubs/ida_pro.pyi +0 -3507
  92. idapro-0.0.5/idapro/stubs/ida_problems.pyi +0 -117
  93. idapro-0.0.5/idapro/stubs/ida_range.pyi +0 -621
  94. idapro-0.0.5/idapro/stubs/ida_regfinder.pyi +0 -552
  95. idapro-0.0.5/idapro/stubs/ida_registry.pyi +0 -202
  96. idapro-0.0.5/idapro/stubs/ida_search.pyi +0 -92
  97. idapro-0.0.5/idapro/stubs/ida_segment.pyi +0 -903
  98. idapro-0.0.5/idapro/stubs/ida_segregs.pyi +0 -263
  99. idapro-0.0.5/idapro/stubs/ida_srclang.pyi +0 -100
  100. idapro-0.0.5/idapro/stubs/ida_strlist.pyi +0 -204
  101. idapro-0.0.5/idapro/stubs/ida_tryblks.pyi +0 -634
  102. idapro-0.0.5/idapro/stubs/ida_typeinf.pyi +0 -7441
  103. idapro-0.0.5/idapro/stubs/ida_ua.pyi +0 -1257
  104. idapro-0.0.5/idapro/stubs/ida_undo.pyi +0 -79
  105. idapro-0.0.5/idapro/stubs/ida_xref.pyi +0 -486
  106. idapro-0.0.5/idapro/stubs/idaapi.pyi +0 -90764
  107. idapro-0.0.5/idapro/stubs/idadex.pyi +0 -756
  108. idapro-0.0.5/idapro/stubs/idautils.pyi +0 -486
  109. idapro-0.0.5/idapro/stubs/idc.pyi +0 -5159
  110. {idapro-0.0.5 → idapro-0.0.6.dev2}/LICENSE +0 -0
  111. {idapro-0.0.5 → idapro-0.0.6.dev2}/README.md +0 -0
  112. {idapro-0.0.5 → idapro-0.0.6.dev2}/idapro/py.typed +0 -0
  113. {idapro-0.0.5 → idapro-0.0.6.dev2}/idapro.egg-info/dependency_links.txt +0 -0
  114. {idapro-0.0.5 → idapro-0.0.6.dev2}/idapro.egg-info/not-zip-safe +0 -0
  115. {idapro-0.0.5 → idapro-0.0.6.dev2}/idapro.egg-info/top_level.txt +0 -0
  116. {idapro-0.0.5 → idapro-0.0.6.dev2}/setup.cfg +0 -0
@@ -1,10 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: idapro
3
- Version: 0.0.5
3
+ Version: 0.0.6.dev2
4
4
  Summary: IDA Library Python module
5
5
  Author: Hex-Rays SA
6
6
  Author-email: support@hex-rays.com
7
7
  License: MIT
8
+ Classifier: Development Status :: 2 - Pre-Alpha
8
9
  Classifier: License :: OSI Approved :: MIT License
9
10
  Classifier: Programming Language :: Python :: 3
10
11
  Classifier: Operating System :: OS Independent
@@ -24,6 +25,9 @@ Dynamic: summary
24
25
 
25
26
 
26
27
  # IDA Library Python Module
28
+
29
+ **⚠️ This is a dev pre-release version. APIs may change without notice and pre-release versions may be deleted at any time.**
30
+
27
31
  The IDA Library Python module enables running IDA Pro as an independent Python package outside the IDA UI environment, allowing for programmatic binary analysis and reverse engineering tasks.
28
32
 
29
33
  ## Prerequisites
@@ -9,7 +9,7 @@ from .config import get_ida_install_dir
9
9
 
10
10
  def find_file(name, path):
11
11
  """Internal method used for recursively find a file in a folder"""
12
- for root, dirs, files in os.walk(path):
12
+ for root, _, files in os.walk(path):
13
13
  if name in files:
14
14
  return os.path.join(root, name)
15
15
  return None
@@ -28,30 +28,9 @@ else:
28
28
 
29
29
  # Get the ida-install-dir setting
30
30
  root_dir = get_ida_install_dir()
31
-
32
- if platform_str == "Windows":
33
- # IDA kernel and modules may need dependencies in its root dir (e.g. clp64.dll)
34
- # tell Windows loader where they can be found
35
- # NB: for AddDllDirectory() be effective for indirectly loaded DLLs,
36
- # SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS) has to be called first
37
- kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
38
- SetDefaultDllDirectories = getattr(kernel32, "SetDefaultDllDirectories")
39
- if SetDefaultDllDirectories:
40
- from ctypes.wintypes import DWORD, BOOL
41
- SetDefaultDllDirectories.argtypes = [DWORD]
42
- SetDefaultDllDirectories.restype = BOOL
43
- LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000
44
- LOAD_LIBRARY_SEARCH_USER_DIRS = 0x00000400
45
- flags = LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_USER_DIRS
46
- if SetDefaultDllDirectories(flags):
47
- # finally, add IDA's directory for dependencies
48
- os.add_dll_directory(root_dir)
49
- else:
50
- os.environ['PATH'] = root_dir + os.pathsep + os.environ.get('PATH', '')
51
-
52
- idalib_path = find_file(name=name, path=root_dir)
31
+ idalib_path = find_file(name=name, path=root_dir) if root_dir else None
53
32
  if idalib_path is None:
54
- raise ImportError(f"Could not find {name} in {root_dir}. Please make sure you are using IDA version 9.0 or newer and the IDADIR environment variable is set and points to the active IDA installation.")
33
+ raise ImportError(f"Cannot load IDA library file {name}. Please make sure you are using IDA version 9.0 or newer and the IDADIR environment variable is set and points to the active IDA installation.")
55
34
 
56
35
  if "IDA_IS_INTERACTIVE" in os.environ:
57
36
  if os.environ["IDA_IS_INTERACTIVE"] == "1":
@@ -59,6 +38,26 @@ if "IDA_IS_INTERACTIVE" in os.environ:
59
38
 
60
39
  # load the library and initialize the kernel
61
40
  try:
41
+ if platform_str == "Windows":
42
+ # IDA kernel and modules may need dependencies in its root dir (e.g. clp64.dll)
43
+ # tell Windows loader where they can be found
44
+ # NB: for AddDllDirectory() be effective for indirectly loaded DLLs,
45
+ # SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_USER_DIRS) has to be called first
46
+ kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
47
+ SetDefaultDllDirectories = getattr(kernel32, "SetDefaultDllDirectories")
48
+ if SetDefaultDllDirectories:
49
+ from ctypes.wintypes import DWORD, BOOL
50
+ SetDefaultDllDirectories.argtypes = [DWORD]
51
+ SetDefaultDllDirectories.restype = BOOL
52
+ LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000
53
+ LOAD_LIBRARY_SEARCH_USER_DIRS = 0x00000400
54
+ flags = LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_USER_DIRS
55
+ if SetDefaultDllDirectories(flags):
56
+ # finally, add IDA's directory for dependencies
57
+ os.add_dll_directory(root_dir)
58
+ else:
59
+ os.environ['PATH'] = root_dir + os.pathsep + os.environ.get('PATH', '')
60
+
62
61
  libida = ctypes.cdll.LoadLibrary(idalib_path)
63
62
  except Exception as e:
64
63
  raise ImportError(f"Failed loading IDA library file {idalib_path}, exception {e}\n")
@@ -7,12 +7,16 @@ def get_user_config_path():
7
7
  """Get the path to the user's config file based on platform following IDA's user directories."""
8
8
  system = platform.system()
9
9
 
10
- if system == "Windows":
11
- # On Windows, use the %APPDATA%\Hex-Rays\IDA Pro directory
12
- config_dir = Path(os.getenv('APPDATA')) / "Hex-Rays" / "IDA Pro"
10
+ idausr_env = os.getenv("IDAUSR")
11
+ if idausr_env:
12
+ config_dir = Path(idausr_env)
13
13
  else:
14
- # On macOS and Linux, use ~/.idapro
15
- config_dir = Path.home() / ".idapro"
14
+ if system == "Windows":
15
+ # On Windows, use the %APPDATA%\Hex-Rays\IDA Pro directory
16
+ config_dir = Path(os.getenv('APPDATA')) / "Hex-Rays" / "IDA Pro"
17
+ else:
18
+ # On macOS and Linux, use ~/.idapro
19
+ config_dir = Path.home() / ".idapro"
16
20
 
17
21
  # Return the full path to the config file (now in JSON format)
18
22
  user_config_path = config_dir / "ida-config.json"
@@ -71,12 +75,11 @@ def set_ida_install_dir(new_path):
71
75
  def get_ida_install_dir():
72
76
  """Retrieve the IDA installation directory."""
73
77
 
78
+ # $IDADIR overrides JSON config
79
+ idadir = os.environ.get('IDADIR')
80
+ if idadir:
81
+ return idadir
82
+
74
83
  # Read the configuration JSON file
75
84
  config = load_config()
76
- install_dir = config['Paths'].get('ida-install-dir', None)
77
-
78
- # Fallback to IDADIR env var if the JSON value is not set
79
- if install_dir is None or len(install_dir) == 0:
80
- install_dir = os.environ.get('IDADIR', '')
81
-
82
- return install_dir
85
+ return config['Paths'].get('ida-install-dir', None)