Compare commits
2 Commits
ed3b9e7e4c
...
958dee355e
Author | SHA1 | Date | |
---|---|---|---|
958dee355e | |||
8d445b11a4 |
@ -70,6 +70,59 @@ python backdoor_detection.py ./src -o ./output/report.pdf
|
||||
python requirements_detection.py ./requirements.txt -o ./output/report.md
|
||||
```
|
||||
|
||||
## 打包
|
||||
|
||||
### 简介
|
||||
|
||||
本项目需要将 Python 代码打包成 pip 包,以便于分发和安装。以下是如何实现和使用该打包功能的详细步骤。
|
||||
|
||||
### 打包命令
|
||||
|
||||
```bash
|
||||
pip install wheel
|
||||
python setup.py sdist bdist_wheel
|
||||
```
|
||||
|
||||
执行上述命令后,会在 dist 目录下生成 .tar.gz 和 .whl 文件。
|
||||
|
||||
### 本地安装
|
||||
|
||||
- 安装 .whl 文件:
|
||||
|
||||
``` bash
|
||||
pip install dist/my_project-0.1.0-py3-none-any.whl
|
||||
```
|
||||
|
||||
- 安装 .tar.gz 文件:
|
||||
|
||||
``` bash
|
||||
pip install dist/my_project-0.1.0.tar.gz
|
||||
```
|
||||
|
||||
## 上传到 PyPI
|
||||
|
||||
- 安装 twine:
|
||||
|
||||
``` bash
|
||||
pip install twine
|
||||
```
|
||||
|
||||
- 使用 twine 上传包到 PyPI:
|
||||
|
||||
``` bash
|
||||
twine upload dist/*
|
||||
```
|
||||
|
||||
需要提供 PyPI 的用户名和密码。如果没有 PyPI 账号,可以在 PyPI 注册。
|
||||
|
||||
## 使用 PyPI 安装
|
||||
|
||||
包上传到 PyPI 后,可以通过以下命令安装:
|
||||
|
||||
``` bash
|
||||
pip install my_project
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 结论
|
||||
|
@ -46,7 +46,13 @@
|
||||
|
||||
- **主要应用**:通过爬虫收集漏洞依赖信息并进行汇总,用于判断依赖是否存在漏洞版本。
|
||||
|
||||
## 8. 代码和风险分析
|
||||
## 8. 打包
|
||||
|
||||
本项目支持打包作为pip包进行发布
|
||||
|
||||
- **主要应用**:通过`wheel`并自行撰写`setup.py`以及`MANIFEST.in`,将项目打包发布
|
||||
|
||||
## 9. 代码和风险分析
|
||||
|
||||
项目中实现了基本的静态代码分析功能,用于识别和报告潜在的安全风险函数调用,如 `system`、`exec` 等。
|
||||
|
||||
|
@ -66,6 +66,55 @@ python backdoor_detection.py ./src -o output/report.pdf -m regex
|
||||
- 结果中会标注出每个文件中发现的高风险和中风险函数调用位置。
|
||||
- 对于依赖检测,结果将标明每个依赖包的安全状态,包括存在安全风险的依赖及其版本。
|
||||
|
||||
## 打包
|
||||
|
||||
### 打包命令
|
||||
|
||||
```bash
|
||||
pip install wheel
|
||||
python setup.py sdist bdist_wheel
|
||||
```
|
||||
|
||||
执行上述命令后,会在 dist 目录下生成 .tar.gz 和 .whl 文件。
|
||||
|
||||
### 本地安装
|
||||
|
||||
- 安装 .whl 文件:
|
||||
|
||||
``` bash
|
||||
pip install dist/my_project-0.1.0-py3-none-any.whl
|
||||
```
|
||||
|
||||
- 安装 .tar.gz 文件:
|
||||
|
||||
``` bash
|
||||
pip install dist/my_project-0.1.0.tar.gz
|
||||
```
|
||||
|
||||
### 上传到 PyPI
|
||||
|
||||
- 安装 twine:
|
||||
|
||||
``` bash
|
||||
pip install twine
|
||||
```
|
||||
|
||||
- 使用 twine 上传包到 PyPI:
|
||||
|
||||
``` bash
|
||||
twine upload dist/*
|
||||
```
|
||||
|
||||
需要提供 PyPI 的用户名和密码。如果没有 PyPI 账号,可以在 PyPI 注册。
|
||||
|
||||
### 使用 PyPI 安装
|
||||
|
||||
包上传到 PyPI 后,可以通过以下命令安装:
|
||||
|
||||
``` bash
|
||||
pip install my_project
|
||||
```
|
||||
|
||||
## 常见问题处理
|
||||
|
||||
- 确保所有路径都正确无误,避免因路径错误导致文件读取失败。
|
||||
|
Loading…
x
Reference in New Issue
Block a user