Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

frida.get_usb_device() can not works at first time.

未关闭
#174 1 条评论 12 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
devtools

调研方向

使用 Python 3.9 和 Frida 14.0.0 重现首次调用失败,然后根据 traceback 检查 frida/init.py 中的 get_usb_device 和 get_device_matching 方法,以及 frida/core.py:get_device_matching。完成的标准是,初始调用 frida.get_usb_device() 无需重试或 sleep 即可找到 USB 设备。

由索引模型根据 Issue 内容生成。

描述

Please check the error logs as follow: (frida --version 14.0.0)

Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import frida
>>> frida.get_usb_device()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Bytedance\AppData\Local\Programs\Python\Python39\lib\site-packages\frida\__init__.py", line 82, in get_usb_device
    return get_device_matching(lambda d: d.type == 'usb', timeout, **kwargs)
  File "C:\Users\Bytedance\AppData\Local\Programs\Python\Python39\lib\site-packages\frida\__init__.py", line 90, in get_device_matching
    return get_device_manager().get_device_matching(predicate, timeout, **kwargs)
  File "C:\Users\Bytedance\AppData\Local\Programs\Python\Python39\lib\site-packages\frida\core.py", line 26, in wrapper
    return f(*args, **kwargs)
  File "C:\Users\Bytedance\AppData\Local\Programs\Python\Python39\lib\site-packages\frida\core.py", line 58, in get_device_matching
    return Device(self._impl.get_device_matching(lambda d: predicate(Device(d)), raw_timeout))
frida.InvalidArgumentError: device not found
>>> frida.get_usb_device()
Device(id="89EX0A89A", name="Pixel 3", type='usb')

As you saw it, went I call frida.get_usb_device() first time it will get an error. But if you try to call it second time, it's OK!
So I try to solve this problem as follow and it works:

try:
	device = frida.get_usb_device()
except BaseException: 
	time.sleep(3)
	device = frida.get_usb_device()
主要语言
Python
星标
873
派生
173
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

frida/frida-python 的其他 Issue

查看 frida/frida-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。