Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

订阅源联系隐私© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
secimport — 面向 Python 的库级 eBPF 沙箱(Linux 与 macOS):按模块进行系统调用级控制。 | Kitploit
工具/GitHubGitHub/avilum/secimport
防御工具容器安全动态分析 (沙盒)脚本与自动化配置审计安全虚拟化恶意软件分析二进制分析供应链安全
GitHubavilum/secimport

secimport

面向 Python 的库级 eBPF 沙箱(Linux 与 macOS):按模块进行系统调用级控制。

24518497个月前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
查看仓库网站

secimport

macOS Linux

Upload Python Package

面向 Python 应用的模块级沙箱

secimport 是一个基于 eBPF 的安全工具包,可按 Python 模块强制执行系统调用限制,从而对你的应用程序安全配置提供细粒度控制。可以把它理解为 Linux 上的 seccomp-bpf,但工作在 Python 模块级别。

Star History Chart

主要特性

  • 模块级安全:按 Python 模块定义并强制执行系统调用限制
  • 自动化分析:跟踪你的应用程序以生成量身定制的安全配置
  • 多种执行模式:在违反策略时记录日志、停止或终止进程
  • 生产就绪:得益于 eBPF,性能影响可忽略不计
  • 供应链保护:降低易受攻击依赖项带来的风险

快速开始

使用 Docker(推荐)

git clone https://github.com/avilum/secimport.git
cd secimport/docker
./build.sh && ./run.sh

命令行:

secimport --help

 Usage: python -m secimport.cli [OPTIONS] COMMAND [ARGS]...

 secimport is a comprehensive toolkit designed to enable the tracing, construction, and execution of secure Python runtimes. It leverages USDT probes and eBPF/DTrace technologies to enhance overall security measures.
 WORKFLOW:     1. secimport trace / secimport shell     2. secimport build     3. secimport run
 QUICKSTART:     $ secimport interactive
 For more details, please see https://github.com/avilum/secimport/wiki/Command-Line-Usage

╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.                                                                                                                                                                                    │
│ --show-completion             Show completion for the current shell, to copy it or customize the installation.                                                                                                                                             │
│ --help                        Show this message and exit.                                                                                                                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ trace         Trace a Python process using an entrypoint or interactive shell.                                                                                                                                                                             │
│ shell         Alias for 'trace'.                                                                                                                                                                                                                           │
│ trace-pid     Trace a running process by PID.                                                                                                                                                                                                              │
│ build         Build a sandbox profile from a trace log.                                                                                                                                                                                                    │
│ run           Run a Python process inside the sandbox.                                                                                                                                                                                                     │
│ interactive   Run secimport in interactive mode.                                                                                                                                                                                                           │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

创建你的第一个沙箱

secimport interactive

# In the Python shell that opens:
>>> secimport trace   # Start tracing
>>> import requests   # Perform actions you want to profile
>>> # Press CTRL+D to stop tracing

>>> secimport build   # Build sandbox from trace
>>> secimport run     # Run with enforcement

高级用法

命令行选项

secimport trace              # Trace a new Python process
secimport trace_pid <PID>    # Trace an existing process
secimport build              # Build sandbox from trace
secimport run [options]      # Run with enforcement

执行模式

# Stop on violation
secimport run --stop_on_violation=true

# Kill on violation
secimport run --kill_on_violation=true

Python API

import secimport

# Replace standard import with secure import
requests = secimport.secure_import('requests', allowed_syscalls=['open', 'read', ...])

手动安装

  1. 安装带有 USDT 探针的 Python:

    # Configure Python with --enable-dtrace
    # See detailed instructions in our wiki
    
  2. 安装受支持的后端(eBPF 或 DTrace)

    # Ubuntu/Debian
    apt-get install bpftrace
    
    # For other platforms, see our Installation wiki
    
  3. 安装 secimport

    pip install secimport
    

使用 nsjail 的 seccomp-bpf 支持

除了 secimport 构建的沙箱之外,
secimport build 命令会为你的被追踪代码创建一个带有 seccomp 配置文件的 nsjail 沙箱。
nsjail 在 Linux 上启用带 seccomp 的命名空间沙箱
secimport 会自动生成可与 nsjail 配合使用的 seccomp 配置文件,作为可执行的 bash 脚本。 它可用于限制整个 Python 进程的系统调用,作为另一层防御。

文档

  • 安装指南
  • 命令行用法
  • API 参考
  • 沙箱示例

了解更多

技术资源

  • https://www.oligo.security/
  • 演讲:secimport 在 PyCon
  • 演讲:secimport 在 BSides
  • 博客文章:
    • secimport + DTrace
    • secimport + eBPF + PyTorch
    • secimport + eBPF + FastAPI

贡献

我们欢迎贡献!详情请参阅我们的贡献指南。

许可证

本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。

下载工具