Skip to main content

Restore a Frida 16-style Python session.create_script() workflow on Frida 17+

Project description

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
  • 继续直接把旧版 JS 字符串传给 session.create_script(source)
  • 旧脚本里的 JavaObjCSwift 继续可用

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

特性

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

安装

pip install frida-legacy-compat

如果希望同时安装推荐范围内的 Frida:

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

使用 uv add

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

兼容性

  • frida < 17:可安装、可保留 import frida_legacy_compat,导入后默认静默 no-op
  • 17.0 <= frida < 17.2:不支持
  • 17.2 <= frida < 18:支持
  • frida >= 18:当前版本默认视为未验证

快速开始

import frida
import frida_legacy_compat

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()

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

frida_legacy_compat-1.0.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

frida_legacy_compat-1.0.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file frida_legacy_compat-1.0.0.tar.gz.

File metadata

  • Download URL: frida_legacy_compat-1.0.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for frida_legacy_compat-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9b665342031578ebabc7c5b5743e91619b1030cc6606b1d9455e01a8536d0666
MD5 80588fc605909bb965e48523be2534e5
BLAKE2b-256 a27a56d365775aa73ef519222898cf1be5e5aea5059258eae7e180509d35f92c

See more details on using hashes here.

Provenance

The following attestation bundles were made for frida_legacy_compat-1.0.0.tar.gz:

Publisher: publish.yml on RYF5584/frida-legacy-compat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file frida_legacy_compat-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for frida_legacy_compat-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9d960e376fb65e235ed71f9ed66c6da7d198dda11623fcda5a0724c5365ebc9
MD5 f1d8bf81988891cd1f77544fbffce4d5
BLAKE2b-256 d7c5861d72b17aa9926c45c1036984daf1fcab2c6690dabdb5df7eb9cb884a87

See more details on using hashes here.

Provenance

The following attestation bundles were made for frida_legacy_compat-1.0.0-py3-none-any.whl:

Publisher: publish.yml on RYF5584/frida-legacy-compat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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