Skip to main content

frida-legacy-compat

Repository GitHub stars

默认中文 | English

frida-legacy-compat 是一个面向 Frida 17+ 的 Python 兼容层,用来把 Frida 16 风格的 session.create_script() 注入体验尽量恢复回来。

这个库就是专门用来解决 Frida 17.0.0 以上版本中,使用 Python API 执行旧版 JS 脚本时常见的 bridge 报错问题,例如:

{'type': 'error', 'description': "ReferenceError: 'Java' is not defined", 'stack': "ReferenceError: 'Java' is not defined\n at (/script1.js:3)"}

Frida 17 以后,旧版 bridge 默认不再跟随原来的 plain JS 工作流一起可用,很多场景需要改成 TypeScript/ESM 编译,或者额外下载 bridge,使用成本明显变高。

这个库的目标很直接:

  • 安装一次
  • 多加一行 import frida_legacy_compat
  • 显式调用 frida_legacy_compat.patch_frida()
  • 继续直接把旧版 JS 字符串传给 session.create_script(source)
  • 旧脚本里的 Java、ObjC、Swift 继续可用

仓库地址:https://github.com/RYF5584/frida-legacy-compat

特性

  • 显式调用后 patch frida.core.Session.create_script()
  • 自动识别旧版 bridge 脚本并按需编译
  • 自动安装所需 bridge 包
  • 不需要 Node.js
  • 根据 frida.__version__ 自动选择默认 bridge profile

安装

本项目已发布到 PyPI,可直接通过 PyPI 安装: https://pypi.org/project/frida-legacy-compat/

pip install frida-legacy-compat

如果希望同时安装 frida:

pip install 'frida-legacy-compat[full]'

说明:

  • 本库安装时不限制 frida 版本
  • 推荐范围为 frida>=17.2,<18
  • 如果当前 frida 版本不满足,import frida_legacy_compat 和 frida_legacy_compat.patch_frida() 都只会给出中英文 warning,不会报错

使用 uv add:

uv add frida-legacy-compat
uv add 'frida-legacy-compat[full]'

兼容性

  • frida < 17:可安装;import 和 patch_frida() 都只会 warning,并保持 no-op
  • 17.0 <= frida < 17.2:可安装;import 和 patch_frida() 都只会 warning,提示需要 frida>=17.2,<18
  • 17.2 <= frida < 18:支持
  • frida >= 18:可安装;import 和 patch_frida() 都只会 warning,提示当前不在已验证范围内

快速开始

import frida
import frida_legacy_compat

frida_legacy_compat.patch_frida()

device = frida.get_usb_device()
session = device.attach("com.example.app")
source = """
Java.perform(function () {
  var Activity = Java.use("android.app.Activity");
  console.log(Activity);
});
"""

script = session.create_script(source)
script.load()

CLI

frida-legacy -U -f com.example.app -l agent.js

文档

注意事项

  • 第一次运行可能会慢一点,因为 bridge 包会按需安装
  • 已编译的 Frida bundle 会被自动识别并直接透传
  • 当前兼容入口是 Session.create_script()

Metadata

Release files for frida-legacy-compat 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for frida-legacy-compat 1.1.0
File Size Uploaded Provenance Actions
frida_legacy_compat-1.1.0.tar.gz 13.3 kB With provenance Details for frida_legacy_compat-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for frida-legacy-compat 1.1.0
File Interpreter ABI Platform Actions
frida_legacy_compat-1.1.0-py3-none-any.whl Python 3 none any Details for frida_legacy_compat-1.1.0-py3-none-any.whl

Total release size: 26.2 kB

Release files / frida_legacy_compat-1.1.0.tar.gz

Download URL frida_legacy_compat-1.1.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6c29f4eca2d39e266649ec9150bee967a643e6f7c34e6cf170dc5b0d29f047b8
BLAKE2b-256 checksum
How to use checksums
aabf9f6311edff6e44d166767fbd6364fbbeb291f510e4afbafa3f6e75985a29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 23, 2026.

Transparency log

Release files / frida_legacy_compat-1.1.0-py3-none-any.whl

Download URL frida_legacy_compat-1.1.0-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba555c1bf2447ffe09724aaf880ecd163a35a7c3ffdde420a6d1bfdce1ce2ce2
BLAKE2b-256 checksum
How to use checksums
c94d1163c0f9fd8404371b1f06763191203b580c18d8d719f532088419cd061b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 23, 2026.

Transparency log

Security for frida-legacy-compat 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for frida_legacy_compat-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page