Steam新版应用令牌获取

本文章参考【ROOT Android】Steam 3.0 导出令牌的数种方法Frida Doc 并在原文章基础上做了补充和修正。感谢原作者的分享!

使用Frida Hook获取Steam令牌

使用前需要准备:

  • 按照 Doc 配置并运行 Android Frida Server,在 USB 调试模式 开启的条件下使用 USB 连接设备。
  • 拥有一个安装了 frida 模块的 Python 环境

在 Android 端运行 Frida 服务端

  • 下载 Frida Server 文件,下载链接
  • 将下载好的 Frida Server 文件解压,并将里面的二进制文件重命名为 frida-server
  • 将 Frida Server 文件移动至 /data/local/tmp 目录下,并赋予777权限
  • 使用 shell 运行 frida-server

在电脑端进行连接 Frida 服务端

  • 首先,需要安装 Python3 最新版本,下载链接
  • 安装完毕后,打开命令提示符或 PowerShell 输入以下命令来安装 frida
1
pip install frida-tools
  • Frida 安装完成后,输入以下命令查看是否可用,如果有输出应用列表,代表成功安装
1
frida-ps -U

通过 Frida Hook 获取 Steam 手机令牌

  • 新建一个 Python 文件,将下面内容复制进去,然后保存并运行
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import json
import frida
import sys

package = "com.valvesoftware.android.steam.community"
cmd = """
'use strict;'

if (Java.available) {
Java.perform(function() {

//Cipher stuff
const Cipher = Java.use('javax.crypto.Cipher');

Cipher.doFinal.overload('[B').implementation = function (input) {
var result = this.doFinal.overload('[B').call(this, input);
send(result);
}

}
)}
"""


def parse_hook(cmd_):
print('[*] Parsing hook...')
script = session.create_script(cmd_)
script.on('message', on_message)
script.load()


def on_message(message, _):
try:
if message:
if message['type'] == 'send':
result = "".join(chr(i) for i in message['payload'])
print(json.dumps(json.loads(result), indent=2, ensure_ascii=False))
except Exception as e:
print(e)


if __name__ == '__main__':
try:
print('[*] Spawning ' + package)
pid = frida.get_remote_device().spawn(package)
session = frida.get_remote_device().attach(pid)
parse_hook(cmd)
frida.get_remote_device().resume(pid)
print('')
sys.stdin.read()

except KeyboardInterrupt:
sys.exit(0)
except Exception as e:
print(e)
  • 此时手机端应该会自动打开 Steam ,进入之后在脚本运行窗口按住 Ctrl + D ,便会输出 Steam 令牌相关的信息

Steam新版应用令牌获取

https://199771.xyz/posts/ac65b7ae.html

作者

赛博丁真

发布于

2023-10-29

更新于

2023-12-14

许可协议


评论