feat(账号探测): dumpsys account 快速通道
- parse_dumpsys_account / probe_one_dumpsys / probe_online_dumpsys - 不打开抖音、不点「我」,直接 adb dumpsys account 读账号 - MIUI 昵称会打码(***),可按前后缀对台账;完整昵称仍用 u2 probe_one - 新增解析单测;DEVICE_AGENT 文档同步
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
test_action_ref 动作引用:执行时现展开、循环引用挡住、引用扫描(谁在用)、删除保护、摊平逃生口
|
||||
test_assets 资产管理:模板导入(两项校验/分拣/去重/音频)、指定素材、编辑元数据、共享文件删除
|
||||
test_miss_limit 连续未命中:连续 N 步 miss 跳过本账号,成功一次重新计数
|
||||
test_dumpsys_account `dumpsys account` 解析:抖音账号/打码/uid/切号时间
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
@@ -36,7 +37,8 @@ CASES = ["test_parse_name.py", "test_upload_name.py", "test_name_scope.py",
|
||||
"test_switch_account.py", "test_foreach_account.py", "test_push_by_name.py",
|
||||
"test_expect_el.py", "test_read_text.py", "test_account_folder.py",
|
||||
"test_task_try.py", "test_roster.py", "test_plan.py",
|
||||
"test_action_ref.py", "test_assets.py", "test_miss_limit.py"]
|
||||
"test_action_ref.py", "test_assets.py", "test_miss_limit.py",
|
||||
"test_dumpsys_account.py"]
|
||||
|
||||
if hasattr(sys.stdout, "reconfigure"):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""`dumpsys account` 解析用例(纯字符串,不连设备、不连库)。"""
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||
os.chdir(sys.path[0])
|
||||
|
||||
from core.account_probe import parse_dumpsys_account # noqa: E402
|
||||
|
||||
fails = []
|
||||
|
||||
|
||||
def check(label, got, want):
|
||||
ok = got == want
|
||||
if not ok:
|
||||
fails.append(label)
|
||||
print((' ✅ ' if ok else ' ❌ ') + label + ('' if ok else '\n 得到 %r\n 期望 %r' % (got, want)))
|
||||
|
||||
|
||||
SAMPLE = """
|
||||
Accounts: 2
|
||||
Account {name=锋哥苏***实录, type=com.ss.android.ugc.aweme}
|
||||
Account {[email protected], type=com.xiaomi}
|
||||
AccountId,Action,Time,User,Accounts,Key
|
||||
1,action_account_add,2026-10-18 09:00:00,10123,accounts,0
|
||||
2,action_account_add,2026-10-18 10:00:00,10199,accounts,0
|
||||
AuthenticatorDescription {type=com.ss.android.ugc.aweme}, uid 10123
|
||||
"""
|
||||
|
||||
print('=== 1. 读出抖音账号 / 打码标记 / uid / 最近切号时间 ===')
|
||||
r = parse_dumpsys_account(SAMPLE)
|
||||
check('昵称(MIUI 打码)', r['name'], '锋哥苏***实录')
|
||||
check('打码标记', r['masked'], True)
|
||||
check('uid', r['uid'], '10123')
|
||||
check('只取该 uid 的最近切号时间', r['last_switch'], '2026-10-18 09:00:00')
|
||||
|
||||
print('=== 2. 没有抖音账号 ===')
|
||||
r = parse_dumpsys_account("Accounts: 1\n Account {name=abc, type=com.xiaomi}")
|
||||
check('name 为空', r['name'], '')
|
||||
check('masked=False', r['masked'], False)
|
||||
|
||||
print()
|
||||
if fails:
|
||||
print('❌ 失败 %d 项:%s' % (len(fails), ' / '.join(fails)))
|
||||
sys.exit(1)
|
||||
print('✅ test_dumpsys_account 全部通过(纯解析,没连设备)')
|
||||
Reference in New Issue
Block a user