Skip to main content

修复mitmdump检查函数的导入错误,完善自动打开浏览器功能

Project description

JDCat

JDCat 是一个 Python 包装工具,提供命令行入口来启动本地安全测试助手服务。该服务是 sensitive-check-local 项目的 FastAPI 服务封装,用于安全测试中的代理和数据捕获。

项目说明

  • 功能:包装并启动本地助手 FastAPI 服务,提供安全测试所需的代理功能
  • 技术栈:Python 3.10-3.14, FastAPI, uvicorn, mitmproxy
  • 默认端口:17866
  • 业务逻辑:完全来自 sensitive-check-local 项目,本包仅提供 CLI 入口

本地调试

开发环境安装

# 克隆项目并进入 jdcat 目录
cd jdcat

# 安装开发依赖(可编辑模式)
uv pip install -e .

本地开发调试

# 使用本地代码运行(推荐开发方式,默认会自动打开浏览器)
uv run python -m jdcat start

# 或者直接运行模块
python -m jdcat start

# 启动但不自动打开浏览器
uv run python -m jdcat start --no-open-browser

# 停止服务
uv run python -m jdcat stop

构建测试

# 构建包
uv pip install -U build
python -m build

# 验证构建结果
ls -la dist/

分发服务

一键构建和发布

# 在 jdcat 目录下执行构建脚本
./build_and_publish.sh

该脚本会自动完成:

  • 清理之前的构建文件
  • 安装构建工具(build、twine)
  • 构建分发包(wheel 和 tar.gz)
  • 检查包完整性
  • 可选择上传到 PyPI 或 Test PyPI

分发后使用

安装方式

使用 pip(推荐)

# 安装最新版本
pip install jdcat

# 升级到最新版本
pip install --upgrade jdcat

# 安装指定版本
pip install jdcat==1.0.4

使用 pipx(隔离安装)

# 安装 pipx
python -m pip install --user pipx
python -m pipx ensurepath

# 安装 jdcat 最新版本
pipx install jdcat

# 升级 jdcat 到最新版本
pipx upgrade jdcat

# 强制重新安装最新版本
pipx uninstall jdcat && pipx install jdcat

使用 uv(快速安装)

# 直接运行最新版本(无需安装)
uv run --from jdcat jdcat start

# 安装到全局
uv tool install jdcat

# 升级到最新版本
uv tool upgrade jdcat

基本使用

# 启动服务(默认会自动打开浏览器到 http://aq.jdtest.net:8007/)
jdcat start

# 启动服务但不自动打开浏览器
jdcat start --no-open-browser

# 启动服务并指定自定义浏览器URL
jdcat start --browser-url "http://localhost:8007/"

# 指定端口启动服务
jdcat start --port 18000

# 停止服务
jdcat stop

# 查看帮助
jdcat --help

# 检查版本
jdcat --version

常见问题

externally-managed-environment 错误

  • 原因:现代 Python 环境管理安全特性(PEP 668)
  • 解决:使用 uv 或 pipx 安装,避免直接在系统 Python 中安装
# 推荐使用 uv
uv run --from jdcat jdcat start --port 17866

# 或使用 pipx
pipx install jdcat

mitmdump 不存在

  • 原因:jdcat 依赖 mitmproxy 提供的 mitmdump 工具
  • 解决方案:
    1. 检查版本:确保使用最新版本的 jdcat
      # 检查当前版本
      jdcat --version
      
      # 升级到最新版本(当前:1.0.3)
      pip install --upgrade jdcat
      
      # 或使用 pipx
      pipx upgrade jdcat
      
    2. 重新安装:完全重新安装 jdcat 和依赖
      # 使用 pip
      pip uninstall jdcat mitmproxy
      pip install jdcat
      
      # 使用 pipx
      pipx uninstall jdcat
      pipx install jdcat
      
    3. 手动安装 mitmproxy
      # macOS
      brew install mitmproxy
      
      # 使用 pip
      pip install mitmproxy
      
      # 验证安装
      mitmdump --version
      
    4. 使用 uv(推荐)
      # 直接运行,自动处理依赖
      uv run --from jdcat jdcat start
      

端口占用

  • 解决:指定其他端口
jdcat start --port 18000

开源信息

  • 作者:Sensitive Check Team
  • 许可:详见 LICENSE 文件
  • Python 版本:3.10 - 3.14

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jdcat-1.0.4.tar.gz (71.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jdcat-1.0.4-py3-none-any.whl (79.3 kB view details)

Uploaded Python 3

File details

Details for the file jdcat-1.0.4.tar.gz.

File metadata

  • Download URL: jdcat-1.0.4.tar.gz
  • Upload date:
  • Size: 71.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for jdcat-1.0.4.tar.gz
Algorithm Hash digest
SHA256 a90c4e513d005a337c08675a8175b3ffd1788deb8efd8700516e9a6e12af5fb3
MD5 88b0af4084b03fd1ef3c9f10bcf3140c
BLAKE2b-256 ac96580212b831dd4ca329b73395ed2eb8f450e7d5ce7b5a444d29912fcd8396

See more details on using hashes here.

File details

Details for the file jdcat-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: jdcat-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 79.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for jdcat-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 74d1bebedfa342b1256dc4fae78a400df68281e96a7633bf3b156c762df477e9
MD5 33338ae1b116944ae3779a6e7805f075
BLAKE2b-256 92de143a96beb12de6177c04459ae009003ab0adcfba4e43c4e06db9e1d8cfe3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page