idavenv 0.1.0__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.
- idavenv-0.1.0/.github/workflows/ci.yml +39 -0
- idavenv-0.1.0/.github/workflows/publish.yml +107 -0
- idavenv-0.1.0/.gitignore +233 -0
- idavenv-0.1.0/LICENSE +0 -0
- idavenv-0.1.0/PKG-INFO +197 -0
- idavenv-0.1.0/README.md +171 -0
- idavenv-0.1.0/idavenv/__init__.py +43 -0
- idavenv-0.1.0/idavenv/__main__.py +8 -0
- idavenv-0.1.0/idavenv/cli.py +264 -0
- idavenv-0.1.0/idavenv/core.py +177 -0
- idavenv-0.1.0/idavenv/env_backend.py +322 -0
- idavenv-0.1.0/idavenv/hook_template.py +210 -0
- idavenv-0.1.0/idavenv/paths.py +154 -0
- idavenv-0.1.0/main.py +8 -0
- idavenv-0.1.0/pyproject.toml +56 -0
- idavenv-0.1.0/tests/test_backend.py +76 -0
- idavenv-0.1.0/tests/test_cli.py +92 -0
- idavenv-0.1.0/tests/test_core.py +79 -0
- idavenv-0.1.0/tests/test_hook.py +95 -0
- idavenv-0.1.0/tests/test_main_module.py +12 -0
- idavenv-0.1.0/tests/test_paths.py +144 -0
- idavenv-0.1.0/tests/test_runtime_hook.py +122 -0
- idavenv-0.1.0/uv.lock +655 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test (Python ${{ matrix.python-version }}, ${{ matrix.os }})
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
17
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Install uv
|
|
28
|
+
uses: astral-sh/setup-uv@v5
|
|
29
|
+
with:
|
|
30
|
+
enable-cache: true
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: uv sync --group dev
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
run: uv run pytest -v --tb=short
|
|
37
|
+
|
|
38
|
+
- name: Build package (smoke test)
|
|
39
|
+
run: uv build
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
# ── 1. 跨平台测试门禁 ──
|
|
11
|
+
test:
|
|
12
|
+
name: Test (Python ${{ matrix.python-version }}, ${{ matrix.os }})
|
|
13
|
+
runs-on: ${{ matrix.os }}
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
18
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Install uv
|
|
29
|
+
uses: astral-sh/setup-uv@v5
|
|
30
|
+
with:
|
|
31
|
+
enable-cache: true
|
|
32
|
+
|
|
33
|
+
- name: Install dependencies
|
|
34
|
+
run: uv sync --group dev
|
|
35
|
+
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: uv run pytest -v --tb=short
|
|
38
|
+
|
|
39
|
+
# ── 2. 构建分发包 ──
|
|
40
|
+
build:
|
|
41
|
+
name: Build distribution
|
|
42
|
+
needs: test
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
|
|
48
|
+
- name: Set up Python
|
|
49
|
+
uses: actions/setup-python@v5
|
|
50
|
+
with:
|
|
51
|
+
python-version: "3.12"
|
|
52
|
+
|
|
53
|
+
- name: Install uv
|
|
54
|
+
uses: astral-sh/setup-uv@v5
|
|
55
|
+
with:
|
|
56
|
+
enable-cache: true
|
|
57
|
+
|
|
58
|
+
- name: Build sdist and wheel
|
|
59
|
+
run: uv build
|
|
60
|
+
|
|
61
|
+
- name: Upload build artifacts
|
|
62
|
+
uses: actions/upload-artifact@v4
|
|
63
|
+
with:
|
|
64
|
+
name: dist
|
|
65
|
+
path: dist/
|
|
66
|
+
|
|
67
|
+
# ── 3. 发布到 PyPI (Trusted Publisher) ──
|
|
68
|
+
publish:
|
|
69
|
+
name: Publish to PyPI
|
|
70
|
+
needs: build
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
environment: pypi
|
|
73
|
+
permissions:
|
|
74
|
+
id-token: write
|
|
75
|
+
|
|
76
|
+
steps:
|
|
77
|
+
- name: Download build artifacts
|
|
78
|
+
uses: actions/download-artifact@v4
|
|
79
|
+
with:
|
|
80
|
+
name: dist
|
|
81
|
+
path: dist/
|
|
82
|
+
|
|
83
|
+
- name: Publish to PyPI
|
|
84
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
85
|
+
|
|
86
|
+
# ── 4. 创建 GitHub Release ──
|
|
87
|
+
github-release:
|
|
88
|
+
name: Create GitHub Release
|
|
89
|
+
needs: publish
|
|
90
|
+
runs-on: ubuntu-latest
|
|
91
|
+
permissions:
|
|
92
|
+
contents: write
|
|
93
|
+
|
|
94
|
+
steps:
|
|
95
|
+
- uses: actions/checkout@v4
|
|
96
|
+
|
|
97
|
+
- name: Download build artifacts
|
|
98
|
+
uses: actions/download-artifact@v4
|
|
99
|
+
with:
|
|
100
|
+
name: dist
|
|
101
|
+
path: dist/
|
|
102
|
+
|
|
103
|
+
- name: Create GitHub Release
|
|
104
|
+
uses: softprops/action-gh-release@v2
|
|
105
|
+
with:
|
|
106
|
+
files: dist/*
|
|
107
|
+
generate_release_notes: true
|
idavenv-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.pyc
|
|
3
|
+
.pytest_cache/
|
|
4
|
+
.coverage
|
|
5
|
+
htmlcov/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
*.egg-info/
|
|
9
|
+
.venv/
|
|
10
|
+
env/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Byte-compiled / optimized / DLL files
|
|
14
|
+
__pycache__/
|
|
15
|
+
*.py[codz]
|
|
16
|
+
*$py.class
|
|
17
|
+
|
|
18
|
+
# C extensions
|
|
19
|
+
*.so
|
|
20
|
+
|
|
21
|
+
# Distribution / packaging
|
|
22
|
+
.Python
|
|
23
|
+
build/
|
|
24
|
+
develop-eggs/
|
|
25
|
+
dist/
|
|
26
|
+
downloads/
|
|
27
|
+
eggs/
|
|
28
|
+
.eggs/
|
|
29
|
+
lib/
|
|
30
|
+
lib64/
|
|
31
|
+
parts/
|
|
32
|
+
sdist/
|
|
33
|
+
var/
|
|
34
|
+
wheels/
|
|
35
|
+
share/python-wheels/
|
|
36
|
+
*.egg-info/
|
|
37
|
+
.installed.cfg
|
|
38
|
+
*.egg
|
|
39
|
+
MANIFEST
|
|
40
|
+
|
|
41
|
+
# PyInstaller
|
|
42
|
+
# Usually these files are written by a python script from a template
|
|
43
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
44
|
+
*.manifest
|
|
45
|
+
*.spec
|
|
46
|
+
|
|
47
|
+
# Installer logs
|
|
48
|
+
pip-log.txt
|
|
49
|
+
pip-delete-this-directory.txt
|
|
50
|
+
|
|
51
|
+
# Unit test / coverage reports
|
|
52
|
+
htmlcov/
|
|
53
|
+
.tox/
|
|
54
|
+
.nox/
|
|
55
|
+
.coverage
|
|
56
|
+
.coverage.*
|
|
57
|
+
.cache
|
|
58
|
+
nosetests.xml
|
|
59
|
+
coverage.xml
|
|
60
|
+
*.cover
|
|
61
|
+
*.py.cover
|
|
62
|
+
*.lcov
|
|
63
|
+
.hypothesis/
|
|
64
|
+
.pytest_cache/
|
|
65
|
+
cover/
|
|
66
|
+
|
|
67
|
+
# Translations
|
|
68
|
+
*.mo
|
|
69
|
+
*.pot
|
|
70
|
+
|
|
71
|
+
# Django stuff:
|
|
72
|
+
*.log
|
|
73
|
+
local_settings.py
|
|
74
|
+
db.sqlite3
|
|
75
|
+
db.sqlite3-journal
|
|
76
|
+
|
|
77
|
+
# Flask stuff:
|
|
78
|
+
instance/
|
|
79
|
+
.webassets-cache
|
|
80
|
+
|
|
81
|
+
# Scrapy stuff:
|
|
82
|
+
.scrapy
|
|
83
|
+
|
|
84
|
+
# Sphinx documentation
|
|
85
|
+
docs/_build/
|
|
86
|
+
|
|
87
|
+
# PyBuilder
|
|
88
|
+
.pybuilder/
|
|
89
|
+
target/
|
|
90
|
+
|
|
91
|
+
# Jupyter Notebook
|
|
92
|
+
.ipynb_checkpoints
|
|
93
|
+
|
|
94
|
+
# IPython
|
|
95
|
+
profile_default/
|
|
96
|
+
ipython_config.py
|
|
97
|
+
|
|
98
|
+
# pyenv
|
|
99
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
100
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
101
|
+
# .python-version
|
|
102
|
+
|
|
103
|
+
# pipenv
|
|
104
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
105
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
106
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
107
|
+
# install all needed dependencies.
|
|
108
|
+
# Pipfile.lock
|
|
109
|
+
|
|
110
|
+
# UV
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
112
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
113
|
+
# commonly ignored for libraries.
|
|
114
|
+
# uv.lock
|
|
115
|
+
|
|
116
|
+
# poetry
|
|
117
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
118
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
119
|
+
# commonly ignored for libraries.
|
|
120
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
121
|
+
# poetry.lock
|
|
122
|
+
# poetry.toml
|
|
123
|
+
|
|
124
|
+
# pdm
|
|
125
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
126
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
127
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
128
|
+
# pdm.lock
|
|
129
|
+
# pdm.toml
|
|
130
|
+
.pdm-python
|
|
131
|
+
.pdm-build/
|
|
132
|
+
|
|
133
|
+
# pixi
|
|
134
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
135
|
+
# pixi.lock
|
|
136
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
137
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
138
|
+
.pixi/*
|
|
139
|
+
!.pixi/config.toml
|
|
140
|
+
|
|
141
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
142
|
+
__pypackages__/
|
|
143
|
+
|
|
144
|
+
# Celery stuff
|
|
145
|
+
celerybeat-schedule*
|
|
146
|
+
celerybeat.pid
|
|
147
|
+
|
|
148
|
+
# Redis
|
|
149
|
+
*.rdb
|
|
150
|
+
*.aof
|
|
151
|
+
*.pid
|
|
152
|
+
|
|
153
|
+
# RabbitMQ
|
|
154
|
+
mnesia/
|
|
155
|
+
rabbitmq/
|
|
156
|
+
rabbitmq-data/
|
|
157
|
+
|
|
158
|
+
# ActiveMQ
|
|
159
|
+
activemq-data/
|
|
160
|
+
|
|
161
|
+
# SageMath parsed files
|
|
162
|
+
*.sage.py
|
|
163
|
+
|
|
164
|
+
# Environments
|
|
165
|
+
.env
|
|
166
|
+
.envrc
|
|
167
|
+
.venv
|
|
168
|
+
env/
|
|
169
|
+
venv/
|
|
170
|
+
ENV/
|
|
171
|
+
env.bak/
|
|
172
|
+
venv.bak/
|
|
173
|
+
|
|
174
|
+
# Spyder project settings
|
|
175
|
+
.spyderproject
|
|
176
|
+
.spyproject
|
|
177
|
+
|
|
178
|
+
# Rope project settings
|
|
179
|
+
.ropeproject
|
|
180
|
+
|
|
181
|
+
# mkdocs documentation
|
|
182
|
+
/site
|
|
183
|
+
|
|
184
|
+
# mypy
|
|
185
|
+
.mypy_cache/
|
|
186
|
+
.dmypy.json
|
|
187
|
+
dmypy.json
|
|
188
|
+
|
|
189
|
+
# Pyre type checker
|
|
190
|
+
.pyre/
|
|
191
|
+
|
|
192
|
+
# pytype static type analyzer
|
|
193
|
+
.pytype/
|
|
194
|
+
|
|
195
|
+
# Cython debug symbols
|
|
196
|
+
cython_debug/
|
|
197
|
+
|
|
198
|
+
# PyCharm
|
|
199
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
200
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
201
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
202
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
203
|
+
# .idea/
|
|
204
|
+
|
|
205
|
+
# Abstra
|
|
206
|
+
# Abstra is an AI-powered process automation framework.
|
|
207
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
208
|
+
# Learn more at https://abstra.io/docs
|
|
209
|
+
.abstra/
|
|
210
|
+
|
|
211
|
+
# Visual Studio Code
|
|
212
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
213
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
214
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
215
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
216
|
+
# .vscode/
|
|
217
|
+
# Temporary file for partial code execution
|
|
218
|
+
tempCodeRunnerFile.py
|
|
219
|
+
|
|
220
|
+
# Ruff stuff:
|
|
221
|
+
.ruff_cache/
|
|
222
|
+
|
|
223
|
+
# PyPI configuration file
|
|
224
|
+
.pypirc
|
|
225
|
+
|
|
226
|
+
# Marimo
|
|
227
|
+
marimo/_static/
|
|
228
|
+
marimo/_lsp/
|
|
229
|
+
__marimo__/
|
|
230
|
+
|
|
231
|
+
# Streamlit
|
|
232
|
+
.streamlit/secrets.toml
|
|
233
|
+
.ai_memory/
|
idavenv-0.1.0/LICENSE
ADDED
|
File without changes
|
idavenv-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: idavenv
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Cross-platform automated IDAPython virtual environment management powered by uv
|
|
5
|
+
Project-URL: Repository, https://github.com/ckcat/idavenv
|
|
6
|
+
Author: ckcat
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: binary-analysis,ida,idapro,idapython,reverse-engineering,security,uv,venv,virtualenv
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Information Technology
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Security
|
|
23
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# idavenv 🚀
|
|
28
|
+
|
|
29
|
+
[](https://pypi.org/project/idavenv/)
|
|
30
|
+
[](https://www.python.org/)
|
|
31
|
+
[](https://github.com/astral-sh/uv)
|
|
32
|
+
[]()
|
|
33
|
+
[](LICENSE)
|
|
34
|
+
|
|
35
|
+
基于 **`uv`** 的跨平台自动化 **IDAPython 虚拟环境** 管理工具与 Python 库。
|
|
36
|
+
|
|
37
|
+
参考 Hex-Rays 官方社区讨论 [Using a virtualenv for IDAPython](https://community.hex-rays.com/t/using-a-virtualenv-for-idapython/261/9),通过非侵入式的 `idapythonrc.py` 智能 Hook 机制,使 IDA Pro 能够无缝、自动加载独立的 Python 虚拟环境及其第三方依赖(如 `z3-solver`, `requests`, `capstone`, `ida-pro-mcp` 等)。
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 🌟 核心特性
|
|
42
|
+
|
|
43
|
+
- ⚡ **毫秒级极速管理**:深度集成 Astral 的 **`uv`**(`uv venv` 和 `uv pip`),秒级创建环境与解析依赖,同时提供标准库 `venv` 的无缝回退支持。
|
|
44
|
+
- 🖥️ **全平台深度适配**:
|
|
45
|
+
- **Windows**:自动探测 `%APPDATA%\Hex-Rays\IDA Pro` 与 `Lib/site-packages`,原生支持 Python 3.8+ `os.add_dll_directory`(解决 `z3`, `unicorn`, `keystone` 等二进制扩展 DLL 动态加载问题)。
|
|
46
|
+
- **Linux**:自动探测 `~/.idapro` 与 `lib/pythonX.Y/site-packages`。
|
|
47
|
+
- **macOS**:自动探测 `~/.idapro`。
|
|
48
|
+
- 支持 `$IDAUSR` 多路径智能发现(优先复用已有配置)。
|
|
49
|
+
- 🛡️ **智能非侵入式 Hook**:
|
|
50
|
+
- 使用专用标记块 (`# >>> IDAPython Virtualenv Hook >>>`) 注入 `idapythonrc.py`,绝不破坏用户原有的 IDA 配置。
|
|
51
|
+
- 自动提升虚拟环境在 `sys.path` 中的加载优先级,彻底防止宿主全局旧版本包覆盖(Shadowing)。
|
|
52
|
+
- 内置 `builtins` 哨兵变量机制,杜绝在 IDA 中切换数据库或重复执行时的重入副作用。
|
|
53
|
+
- 包含 Python 版本不匹配智能诊断与友好告警。
|
|
54
|
+
- 🔄 **动态多环境切换**:
|
|
55
|
+
- 支持通过环境变量 `IDAPYTHON_VENV=/path/to/custom_venv` 动态临时覆盖当前激活的虚拟环境。
|
|
56
|
+
- 📦 **支持多种依赖安装格式**:
|
|
57
|
+
- 支持安装单个/多个包:`idavenv install z3-solver requests`
|
|
58
|
+
- 支持批量安装依赖文件:`idavenv install -r requirements.txt`
|
|
59
|
+
- 支持安装 GitHub 仓库:`idavenv install "git+https://github.com/mrexodia/ida-pro-mcp"`
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 🚀 极速上手
|
|
64
|
+
|
|
65
|
+
### 方式 1:使用 `uvx` 免安装直接运行(最优雅推荐!)
|
|
66
|
+
|
|
67
|
+
无需提前安装任何包,直接在终端中调用:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# 1. 一键初始化 IDAPython 虚拟环境并自动关联 IDA
|
|
71
|
+
uvx idavenv init
|
|
72
|
+
|
|
73
|
+
# 2. 为 IDA 安装依赖(秒级解析安装)
|
|
74
|
+
uvx idavenv install z3-solver requests
|
|
75
|
+
|
|
76
|
+
# 3. 诊断当前环境状态
|
|
77
|
+
uvx idavenv info
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### 方式 2:使用 `pip` 或 `pipx` 全局安装
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install idavenv
|
|
86
|
+
|
|
87
|
+
# 随后可在任意终端直接使用 idavenv 命令:
|
|
88
|
+
idavenv init
|
|
89
|
+
idavenv install z3-solver
|
|
90
|
+
idavenv info
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### 方式 3:源码本地运行
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
uv run main.py init
|
|
99
|
+
uv run main.py install z3-solver
|
|
100
|
+
uv run main.py info
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 🛠️ 命令行参考 (CLI Reference)
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
usage: idavenv [-h] [--version] {init,info,install,list,run,uninstall} ...
|
|
109
|
+
|
|
110
|
+
positional arguments:
|
|
111
|
+
init Create virtualenv and link to IDA via idapythonrc.py
|
|
112
|
+
info Display IDA and IDAPython virtualenv status.
|
|
113
|
+
install Install Python packages or requirement files into IDAPython virtualenv.
|
|
114
|
+
list List packages installed in IDAPython virtualenv.
|
|
115
|
+
run Run a command inside IDAPython virtualenv environment.
|
|
116
|
+
uninstall Remove IDAPython virtualenv hook and optionally delete venv.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 常用命令示例
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# 1. 初始化并指定特定 Python 解释器 (例如 3.11)
|
|
123
|
+
idavenv init --python 3.11
|
|
124
|
+
|
|
125
|
+
# 2. 安装 requirements.txt 文件中的所有依赖
|
|
126
|
+
idavenv install -r requirements.txt
|
|
127
|
+
|
|
128
|
+
# 3. 查看环境中已安装的依赖
|
|
129
|
+
idavenv list
|
|
130
|
+
|
|
131
|
+
# 4. 在虚拟环境中执行测试命令
|
|
132
|
+
idavenv run python -c "import z3; print(z3.__version__)"
|
|
133
|
+
|
|
134
|
+
# 5. 解除 IDA 关联
|
|
135
|
+
idavenv uninstall
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 💻 Python API 使用
|
|
141
|
+
|
|
142
|
+
作为第三方库被其它 IDA 插件或自动化工具集成:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from idavenv import IDAVirtualenvManager
|
|
146
|
+
|
|
147
|
+
manager = IDAVirtualenvManager()
|
|
148
|
+
|
|
149
|
+
# 初始化环境并关联 IDA
|
|
150
|
+
manager.init()
|
|
151
|
+
|
|
152
|
+
# 安装依赖
|
|
153
|
+
manager.install_packages(packages=["z3-solver", "requests"])
|
|
154
|
+
|
|
155
|
+
# 查看状态
|
|
156
|
+
status = manager.status()
|
|
157
|
+
print(f"Hook installed: {status.is_hooked}")
|
|
158
|
+
print(f"Venv path: {status.venv_dir}")
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## 📦 PyPI 构建与发布指南
|
|
164
|
+
|
|
165
|
+
### 构建分发包
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
uv build
|
|
169
|
+
# 产物生成在 dist/ 目录下:
|
|
170
|
+
# - dist/idavenv-0.1.0.tar.gz (sdist)
|
|
171
|
+
# - dist/idavenv-0.1.0-py3-none-any.whl (wheel)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 发布到 PyPI
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# 使用 uv publish 上传
|
|
178
|
+
uv publish
|
|
179
|
+
# 或通过 API Token 发布
|
|
180
|
+
uv publish --token <YOUR_PYPI_API_TOKEN>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## 🧪 自动化测试
|
|
186
|
+
|
|
187
|
+
项目遵循严格的 TDD 规范,覆盖全部跨平台路径、Hook 注入、DLL 目录、版本诊断与 CLI 功能(41 项测试全部通过):
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
uv run pytest -v
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 📄 License
|
|
196
|
+
|
|
197
|
+
MIT License.
|