2026 美亚杯个人赛第一部分(VTM-1、VTM-2、FC-01)
原创
正在思考ing
正在思考ing
正在思考ing
2026年11月19日 21:16
江苏
去阅读
有几道题是参照现场赛后讲解的思路尝试复现的,但反复尝试后依然无法得到预期答案,也不知道究竟是我的问题还是出题阿 Sir 的问题哈哈哈
大部分争议集中在 Photos.sqlite 数据库的预写日志(Photos.sqlite-wal)上。我们的思路是按照 wal 中各帧的记录顺序,以事务提交为界,将相应的数据页回放至主数据库,逐步恢复数据库在不同时间节点的状态,并通过逐次查询寻找答案。若上述分析思路或解题过程存在疏漏,还望各位师傅批评指正
从厦门回来就一直在忙,实在没什么时间复现,本周末还有数证杯等着我们,只能先写到这里了。剩下的有空一定补上,下次一定 !
ᕙ(⇀‸↼‶)ᕗ
案情简介
个人赛故事大纲
李力(LEE%20Lik)创办「创力虚拟货币投资有限公司」,以%20T%20coin%20与虚拟货币挂钩、高回报质押计划及明星宣传作为招徕,成功吸引大量投资者。
公司日常运营主要由陈立(CHAN%20Lap)负责、张美(CHEUNG%20Mei)兼任秘书及会计部主管,冯程(FUNG%20Ching)负责管理公司信息系统,黄家豪(WONG%20Ka-ho)等代理则负责推广投资计划及招揽客户。
其后,多名投资者在参加公司举办的投资讲座并连接现场无线网络后,其信用卡于数日内相继被盗用,警方遂介入调查。
(个人赛题目总数为:%20128%20条)
团体赛故事大纲
一宗看似单纯的网络盗卡案件,逐步揭露可疑网络设备、隐蔽交易平台、毒品交收活动,以及涉及加密货币的复杂资金流
随着调查深入,线索进一步指向与陈立秘密联络并负责毒品交收的王华(WONG%20Wah)及其他相关人员。公司所使用的人工智能代理,以及涉及混币、资金转移和异常分流的交易安排,亦成为案件的重点调查方向。
虽然幕后老板李力仍然在逃,警方已先后拘捕多名涉案人士,并检取多项电子装置及数字证据。参赛者须综合分析手机、计算器、服务器、网络数据包、数据库及区块链记录,重构案件全貌,查明各涉案人士的角色、行动及责任。
(团体赛题目总数为:%20291%20条)
个人赛
容器大小:68GB
容器%20SHA256%20哈希:BD41B98BDB868D416FF136B75F1386BB6700B69F9C025E4EE76C430929272F65
容器密码:=zxky_rvQyv*4VnD2sqW?J!F&TmAcT8$9JgtPZsW?uV*_Smyp*PB+7S?sV-9%FTkTaACHcd9A*aTHKh*rE78m=@?*4aaJdD!6QM$Xa7c56uERjM7C=7L?Zb2YQCernMA
VTM-1
VTM-1%20的检材是一个很小的压缩包,解压出来只有几张照片和视频
第1题【填空题】
比赛材料可能包含刻意设置的错误、不一致或干扰信息,参赛者须自行辨别并交叉验证,依据核实后的证据作答。%20请根据参赛材料%20VTM-1%20回答以下问题:%20根据%20POON%20Chi-ming(VTM-1)提供的资料,他通过哪个社交媒体APP与诈骗分子进行视频通话?%20(答案格式:使用全大写英文作答APP全称)
TELEGRAM
第2题【填空题】
请根据参赛材料%20VTM-1%20回答以下问题:%20POON%20Chi-ming(VTM-1)在什么时间收到信用卡消费消息?%20(答案格式:请以%20MMM-DD\_hhmm%20格式作答,例如:JAN-01\_1523)
AUG-07\_0947
第3题【填空题】
请根据参赛材料%20VTM-1%20回答以下问题:%20在%20POON%20Chi-ming(VTM-1)的通话记录中,诈骗分子来电时显示的名称是什么?%20(答案格式:请按照原始数据作答,并区分英文大小写)
KaHo
VTM-2
VTM-2%20解压出来更简单,只有一段视频
第4题【填空题】
请根据参赛材料%20VTM-2%20回答以下问题:%20诈骗分子安排%20SIU%20Wai-shing(VTM-2)在什么时间参加投资讲座?%20(答案格式:请以%20hh:mm%20格式填写%20阿拉伯数字,例如:16:35)
14:00
前两个检材就这么做完了,就是在翻照片和视频
FC-01
第5题【单选题】
请根据参赛材料%20FC-01%20回答以下问题:%20冯程向张美透露,他此前曾在哪里工作?
A.%20银行%20B.%20学校%20C.%20科网公司%20D.%20酒店
B
看冯程和张美的%20WhatsApp%20聊天记录
第6题【填空题】
请根据参赛材料%20FC-01%20回答以下问题:%20请问群组「IT%20Working%20Group」的建立者,其在数据库底层所记录之帐户标识符(JID%20/%20Creator%20JID)为何?%20(答案格式:请按照原始数据库记录完整填写,包含后缀,例如:123456789012345@lid)
192252030808131@lid
看群组 IT%20Working%20Group 的群成员,只有 Cheung%20Mei(张美)是管理员,因此认定她是群建立者
在弘连的取证工具查看%20WhatsApp%20群聊记录
可以看到 Cheung%20Mei 是群聊创建者,而在美亚的%20Qiko3.0%20显示的却是 您
很诡异,不过%20Qiko3.0%20的每个群好像显示的都是 您创建了本群组,估计是个%20bug
第7题【填空题】
请根据参赛材料%20FC-01%20回答以下问题:%20在涉案群组「IT%20Working%20Group」对话记录中,冯程的手机所记录之发送与接收讯息总数(合计)共有多少条?%20(答案格式:仅填写阿拉伯数字,例如:88)
111
Qiko3.0%20显示是%20111,而弘连的软件显示为%20109,正确答案应该是%20111,疑似是%202%20条空消息导致的差异
第8题【填空题】
请根据参赛材料%20FC-01%20回答以下问题:%20涉案人员冯程(Fung%20Ching)其%20WhatsApp%20账号所设定之个人头像原始图片档案,在该备份架构的列表索引(Manifest)中,该头像档案所对应的备份文件标识符(fileID)为何?%20(答案格式:请按照原始记录完整作答,英文字母统一为全小写和数字)
df40ecf80230f659346084bc556ce96b0646eb2f
查看%20WhatsApp%20账号信息
头像文件名为 Photo.jpg
在 /var/Manifest.db 中检索该文件名
</p>
<p>IMG\_0001.PNG</p>
<blockquote>
<p>本题存疑,官方赛后的赛题讲解中答案是 IMG\_0015.JPG,而且是直接从 <code>Photos.sqlite</code> 中分析得出的</p>
<p><img alt=)
但是数据库里根本没有这张图片
因此可能还是要翻预写日志
关于照片要查找照片数据库,路径 /var/mobile/Media/PhotoData/Photos.sqlite
导出后用%20navicat%20连接,查看 ZASSET 表,重点关注下面%203%20个字段
- ZFILENAME:文件名
- ZDATECREATED:照片创建时间
- ZTRASHEDDATE:删除时间
- ZTRASHEDSTATE:照片状态,1%20表示已删除,0%20表示未删除
由此可以写出查询语句
select ZFILENAME,%20ZDATECREATED,%20ZTRASHEDDATE, round(ZTRASHEDDATE-ZDATECREATED,3) as seconds
from ZASSET
where ZTRASHEDSTATE=1 and seconds < 20;
但是什么都没有查询到
查看一下数据表
发现原表中所有记录的 ZTRASHEDSTATE 字段均为%200,还没有照片被删除
由此考虑被删除照片的记录可能在数据库的预写日志中
如上图中的 Photos.sqlite-wal 就是主数据库 Photos.sqlite 的预写日志
WAL%20是%20SQLite%20的预写日志(Write-Ahead%20Log)。在%20WAL%20模式下,SQLite%20先把修改后的数据库页追加到
Photos.sqlite-wal,之后再把已提交的页写回Photos.sqlite。所以,事务已经提交和修改已经写回主库是两个不同的时刻。
因此%20wal%20可以理解为一张张数据库页的快照,每页的修改优先记录到%20wal%20中,等到某个检查点再将%20wal%20中的快照合并到主数据库对应页上
比如,某次事务先修改了第%207%20页,再修改了第%2012%20页,并在第二帧提交。要读出这次提交后的整个数据库快照,sqlite%20从%20wal%20取第%207%20和第%2012%20页,其余页从主库读取。一个页有多个版本时,取该提交点以内最新的那个
当到达某个检查点时,wal%20中会把已提交的页的快照合并到主库中,因此%20wal%20记录各个页的每次变更,合并后的主库只有多次变更后的结果
因此我们查询不到被删除的照片,要么是这张被删除照片的记录还在%20wal%20中,没有合并,要么是在多次合并后被覆盖了
将%20wal%20文件和主数据库一并导出,放在同一目录下,sqlite%20解析时会自动从%20wal%20中取最新帧合并到主数据库中,但是还没有查询到,那么原因显然是在多次合并后被覆盖了
这道题的思路是将%20wal%20中多个帧从早到晚依次合并到主库中,对每次合并执行上面的查询语句,看看能不能查到些什么
依次合并并查询的脚本:
\"\"\"Inspect%20SQLite%20WAL%20files,%20reconstruct%20snapshots,%20and%20run%20SQL%20on%20copies.\"\"\"
import argparse
from contextlib import closing,%20nullcontext
import csv
from dataclasses import dataclass
from itertools import chain
from pathlib import Path
import shutil
import sqlite3
import struct
import sys
from tempfile import SpooledTemporaryFile,%20TemporaryDirectory
WAL_HEADER_SIZE%20= 32
FRAME_HEADER_SIZE%20= 24
DATABASE_MAGIC%20= b\"SQLite%20format%203\\x00\"
MAX_PAGE%20= 0xFFFFFFFE
@dataclass(frozen=True)
class Frame:
%20 %20offset:%20int
%20 %20page:%20int
%20 %20commit_pages:%20int
@dataclass
class Wal:
%20 %20size:%20int
%20 %20page_size:%20int%20= 0
%20 %20checkpoint_sequence:%20int%20= 0
%20 %20slots:%20int%20= 0
%20 %20tail_bytes:%20int%20= 0
%20 %20frames:%20tuple%20=%20()
%20 %20commits:%20tuple%20=%20()
%20 %20stop_reason:%20str%20= \"\"
def valid_page_size(size):
%20 return512 <=%20size%20<= 65536and (size%20&%20(size%20- 1))%20== 0
def checksum(words,%20data,%20state):
%20 %20first,%20second%20=%20state
%20 for left,%20right in words.iter_unpack(data):
%20 %20 %20 %20first%20=%20(first%20+%20left%20+%20second)%20& 0xFFFFFFFF
%20 %20 %20 %20second%20=%20(second%20+%20right%20+%20first)%20& 0xFFFFFFFF
%20 return first,%20second
def read_wal(file):
%20 %20size%20=%20file.seek(0, 2)
%20 %20file.seek(0)
%20 ifnot size:
%20 %20 %20 return Wal(size)
%20 %20header%20=%20file.read(WAL_HEADER_SIZE)
%20 if len(header)%20!=%20WAL_HEADER_SIZE:
%20 %20 %20 raise ValueError(\"incomplete%20WAL%20header\")
%20 %20magic,%20version,%20page_size,%20sequence,%20salt_a,%20salt_b,%20check_a,%20check_b%20=%20(
%20 %20 %20 %20struct.unpack(\">8I\",%20header)
%20 %20)
%20 if magic notin (0x377F0682, 0x377F0683) or version%20!= 3007000:
%20 %20 %20 raise ValueError(\"unsupported%20SQLite%20WAL%20magic%20or%20format%20version\")
%20 ifnot valid_page_size(page_size):
%20 %20 %20 raise ValueError(f\"invalid%20WAL%20page%20size {page_size}\")
%20 %20words%20=%20struct.Struct(\"<II\"if magic%20== 0x377F0682else\">II\")
%20 %20state%20=%20checksum(words,%20header[:24],%20(0, 0))
%20 if state%20!=%20(check_a,%20check_b):
%20 %20 %20 raise ValueError(\"WAL%20header%20checksum%20mismatch\")
%20 %20frame_size%20=%20FRAME_HEADER_SIZE%20+%20page_size
%20 %20slots,%20tail_bytes%20=%20divmod(size%20-%20WAL_HEADER_SIZE,%20frame_size)
%20 %20frames%20=%20[]
%20 %20commits%20=%20[]
%20 %20stop_reason%20= \"\"
%20 for number in range(1,%20slots%20+ 1):
%20 %20 %20 %20offset%20=%20file.tell()
%20 %20 %20 %20raw%20=%20file.read(frame_size)
%20 %20 %20 if len(raw)%20!=%20frame_size:
%20 %20 %20 %20 %20 raise ValueError(\"WAL%20size%20changed%20while%20reading;%20use%20an%20offline%20copy\")
%20 %20 %20 %20page,%20commit_pages,%20a,%20b,%20check_a,%20check_b%20=%20struct.unpack_from(\">6I\",%20raw)
%20 %20 %20 if (a,%20b)%20!=%20(salt_a,%20salt_b):
%20 %20 %20 %20 %20 %20stop_reason%20= \"salt%20mismatch%20(possible%20frame%20from%20an%20older%20WAL%20generation)\"
%20 %20 %20 %20 %20 break
%20 %20 %20 ifnot1 <=%20page%20<=%20MAX_PAGE or commit_pages%20>%20MAX_PAGE:
%20 %20 %20 %20 %20 %20stop_reason%20= \"invalid%20page%20number%20or%20database%20size\"
%20 %20 %20 %20 %20 break
%20 %20 %20 %20state%20=%20checksum(words,%20memoryview(raw)[:8],%20state)
%20 %20 %20 %20state%20=%20checksum(words,%20memoryview(raw)[FRAME_HEADER_SIZE:],%20state)
%20 %20 %20 if state%20!=%20(check_a,%20check_b):
%20 %20 %20 %20 %20 %20stop_reason%20= \"frame%20checksum%20mismatch\"
%20 %20 %20 %20 %20 break
%20 %20 %20 %20frames.append(Frame(offset,%20page,%20commit_pages))
%20 %20 %20 if commit_pages:
%20 %20 %20 %20 %20 %20commits.append(number)
%20 return Wal(
%20 %20 %20 %20size,%20page_size,%20sequence,%20slots,%20tail_bytes,
%20 %20 %20 %20tuple(frames),%20tuple(commits),%20stop_reason,
%20 %20)
def report_wal(wal,%20stream):
%20 %20last_commit%20=%20wal.commits[-1] if wal.commits else0
%20 %20print(f\"WAL%20bytes: {wal.size}\",%20file=stream)
%20 %20print(f\"Page%20bytes: {wal.page_size or 'unknown%20(empty%20WAL)'}\",%20file=stream)
%20 %20print(f\"Frame%20header%20bytes: {FRAME_HEADER_SIZE}\",%20file=stream)
%20 if wal.page_size:
%20 %20 %20 %20print(f\"Frame%20bytes: {wal.page_size%20+%20FRAME_HEADER_SIZE}\",%20file=stream)
%20 %20 %20 %20print(f\"Checkpoint%20sequence: {wal.checkpoint_sequence}\",%20file=stream)
%20 %20print(f\"Complete%20frame%20slots: {wal.slots}\",%20file=stream)
%20 %20print(f\"Valid%20consecutive%20frames: {len(wal.frames)}\",%20file=stream)
%20 %20print(f\"Commit%20frames: {len(wal.commits)}\",%20file=stream)
%20 %20print(f\"Last%20commit%20frame: {last_commit}\",%20file=stream)
%20 %20print(f\"Valid%20frames%20after%20last%20commit: {len(wal.frames)%20-%20last_commit}\",%20file=stream)
%20 %20print(f\"Incomplete%20final%20slot%20bytes: {wal.tail_bytes}\",%20file=stream)
%20 if wal.stop_reason:
%20 %20 %20 %20print(f\"Validation%20stopped%20at%20frame {len(wal.frames)%20+ 1}: {wal.stop_reason}\",%20file=stream)
def warn_wal_tail(wal):
%20 if wal.stop_reason:
%20 %20 %20 %20print(f\"Warning:%20frame {len(wal.frames)%20+ 1}: {wal.stop_reason}\",%20file=sys.stderr)
%20 if wal.tail_bytes:
%20 %20 %20 %20print(f\"Warning:%20ignoring {wal.tail_bytes} bytes%20in%20a%20partial%20slot\",%20file=sys.stderr)
def frame_limit(wal,%20start,%20end):
%20 %20limit%20=%20len(wal.frames) if end isNoneelse end
%20 if limit%20>%20len(wal.frames) or start%20>%20max(limit, 1):
%20 %20 %20 raise ValueError(f\"frame%20range%20must%20be%20within%20the {len(wal.frames)} valid%20frames\")
%20 return limit
def list_frames(wal,%20start,%20end,%20stream):
%20 %20warn_wal_tail(wal)
%20 %20limit%20=%20frame_limit(wal,%20start,%20end)
%20 %20writer%20=%20csv.writer(stream,%20lineterminator=\"\
\")
%20 %20writer.writerow((\"frame\", \"offset\", \"page\", \"commit_database_pages\", \"frame_bytes\"))
%20 for index in range(start%20- 1,%20limit):
%20 %20 %20 %20frame%20=%20wal.frames[index]
%20 %20 %20 %20writer.writerow((index%20+ 1,%20frame.offset,%20frame.page,%20frame.commit_pages,
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 FRAME_HEADER_SIZE%20+%20wal.page_size))
def select_frame(wal,%20requested,%20committed):
%20 %20warn_wal_tail(wal)
%20 if requested%20== \"latest\":
%20 %20 %20 return wal.commits[-1] if wal.commits else0
%20 try:
%20 %20 %20 %20number%20=%20int(requested)
%20 except ValueError:
%20 %20 %20 raise ValueError(\"--frame%20requires%20a%20frame%20number%20or%20latest\") fromNone
%20 ifnot0 <=%20number%20<=%20len(wal.frames):
%20 %20 %20 raise ValueError(f\"frame {number} is%20outside%20valid%20range%200..{len(wal.frames)}\")
%20 if committed:
%20 %20 %20 return max((item for item in wal.commits if item%20<=%20number),%20default=0)
%20 return number
def database_page_size(db,%20wal):
%20 %20size%20=%20db.seek(0, 2)
%20 %20db.seek(0)
%20 %20header%20=%20db.read(100)
%20 if len(header)%20!= 100or header[:16]%20!=%20DATABASE_MAGIC:
%20 %20 %20 raise ValueError(\"main%20file%20does%20not%20have%20a%20standard%20SQLite%20database%20header\")
%20 %20page_size%20=%20struct.unpack_from(\">H\",%20header, 16)[0]
%20 if page_size%20== 1:
%20 %20 %20 %20page_size%20= 65536
%20 ifnot valid_page_size(page_size) or size%20<%20page_size or size%20%%20page_size:
%20 %20 %20 raise ValueError(\"main%20database%20has%20an%20invalid%20page%20size%20or%20incomplete%20pages\")
%20 if wal.page_size and wal.page_size%20!=%20page_size:
%20 %20 %20 raise ValueError(f\"database%20page%20size {page_size} differs%20from%20WAL%20page%20size {wal.page_size}\")
%20 return page_size
def apply_frame(db,%20wal_file,%20frame,%20page_size):
%20 %20wal_file.seek(frame.offset%20+%20FRAME_HEADER_SIZE)
%20 %20contents%20=%20wal_file.read(page_size)
%20 if len(contents)%20!=%20page_size:
%20 %20 %20 raise ValueError(\"WAL%20changed%20while%20building%20the%20snapshot;%20use%20an%20offline%20copy\")
%20 %20db.seek((frame.page%20- 1)%20*%20page_size)
%20 %20db.write(contents)
%20 if frame.commit_pages:
%20 %20 %20 %20db.truncate(frame.commit_pages%20*%20page_size)
def finalize_snapshot(path,%20page_size,%20replayed):
%20 with path.open(\"r+b\") as db:
%20 %20 %20 %20db.seek(0)
%20 %20 %20 %20header%20=%20bytearray(db.read(100))
%20 %20 %20 if len(header)%20!= 100or header[:16]%20!=%20DATABASE_MAGIC:
%20 %20 %20 %20 %20 raise ValueError(\"replayed%20page%201%20does%20not%20have%20a%20standard%20SQLite%20database%20header\")
%20 %20 %20 %20result_size%20=%20db.seek(0, 2)
%20 %20 %20 %20header[18:20]%20= b\"\\x01\\x01\"#%20Standalone%20database,%20with%20no%20WAL%20sidecar%20required.
%20 %20 %20 if replayed:
%20 %20 %20 %20 %20 %20struct.pack_into(\">I\",%20header, 28,%20result_size%20//%20page_size)
%20 %20 %20 %20 %20 %20header[92:96]%20=%20header[24:28]%20 #%20Mark%20the%20database%20size%20field%20as%20valid.
%20 %20 %20 %20db.seek(0)
%20 %20 %20 %20db.write(header)
def build_snapshot(source,%20output,%20wal_file,%20wal,%20number):
%20 %20shutil.copyfile(source,%20output)
%20 with output.open(\"r+b\") as db:
%20 %20 %20 %20page_size%20=%20database_page_size(db,%20wal)
%20 %20 %20 for index in range(number):
%20 %20 %20 %20 %20 %20apply_frame(db,%20wal_file,%20wal.frames[index],%20page_size)
%20 %20finalize_snapshot(output,%20page_size,%20number)
def check_snapshot(db):
%20 %20errors%20=%20db.execute(\"PRAGMA%20quick_check\").fetchall()
%20 if errors%20!=%20[(\"ok\",)]:
%20 %20 %20 raise ValueError(\"SQLite%20quick_check%20failed:%20\" + \";%20\".join(row[0] for row in errors[:5]))
def publish_snapshot(source,%20destination):
%20 #%20Refuse%20an%20existing%20destination,%20including%20a%20concurrently%20created%20one.
%20 for suffix in (\"-wal\", \"-shm\", \"-journal\"):
%20 %20 %20 if Path(str(destination)%20+%20suffix).exists():
%20 %20 %20 %20 %20 raise ValueError(f\"output%20already%20has%20a%20SQLite%20sidecar: {destination}{suffix}\")
%20 with destination.open(\"xb\") as output:
%20 %20 %20 try:
%20 %20 %20 %20 %20 with source.open(\"rb\") as data:
%20 %20 %20 %20 %20 %20 %20 %20shutil.copyfileobj(data,%20output)
%20 %20 %20 %20 %20 %20output.flush()
%20 %20 %20 except BaseException:
%20 %20 %20 %20 %20 %20output.close()
%20 %20 %20 %20 %20 %20destination.unlink(missing_ok=True)
%20 %20 %20 %20 %20 raise
def statements(sql):
%20 %20start%20= 0
%20 for end,%20char in enumerate(sql, 1):
%20 %20 %20 if char%20== \";\"and sqlite3.complete_statement(sql[start:end]):
%20 %20 %20 %20 %20 yield sql[start:end]
%20 %20 %20 %20 %20 %20start%20=%20end
%20 if sql[start:].strip():
%20 %20 %20 yield sql[start:]
def authorize_scratch(action,%20arg1,%20_arg2,%20_database,%20_trigger):
%20 #%20Prevent%20a%20query%20from%20attaching%20or%20exporting%20to%20an%20external%20database%20file.
%20 #%20VACUUM%20uses%20an%20internal%20attachment%20whose%20filename%20is%20empty.
%20 if action%20==%20sqlite3.SQLITE_ATTACH and arg1%20!= \"\":
%20 %20 %20 return sqlite3.SQLITE_DENY
%20 return sqlite3.SQLITE_OK
def query_snapshot(db,%20sql,%20stream,%20include_empty=True):
%20 %20db.set_authorizer(authorize_scratch)
%20 %20writer%20=%20csv.writer(stream,%20lineterminator=\"\
\")
%20 %20written_set%20= False
%20 %20has_rows%20= False
%20 for statement in statements(sql):
%20 %20 %20 %20cursor%20=%20db.execute(statement)
%20 %20 %20 if cursor.description isNone:
%20 %20 %20 %20 %20 continue
%20 %20 %20 %20first%20=%20cursor.fetchone()
%20 %20 %20 if first isNoneandnot include_empty:
%20 %20 %20 %20 %20 continue
%20 %20 %20 if written_set:
%20 %20 %20 %20 %20 %20writer.writerow([])
%20 %20 %20 %20written_set%20= True
%20 %20 %20 %20writer.writerow(column[0] for column in cursor.description)
%20 %20 %20 if first isNone:
%20 %20 %20 %20 %20 continue
%20 %20 %20 %20has_rows%20= True
%20 %20 %20 for row in chain((first,),%20cursor):
%20 %20 %20 %20 %20 %20writer.writerow(value.hex() if isinstance(value,%20bytes) else value for value in row)
%20 return written_set,%20has_rows
def read_sql(args):
%20 if args.sql_file%20==%20Path(\"-\"):
%20 %20 %20 return sys.stdin.read()
%20 if args.sql_file isnotNone:
%20 %20 %20 return args.sql_file.read_text(encoding=\"utf-8-sig\")
%20 return args.sql
def list_columns(db,%20table,%20stream):
%20 %20relations%20=%20db.execute(
%20 %20 %20 \"\"\"SELECT%20name,%20type%20FROM%20sqlite_schema
%20 %20 %20 %20 %20 WHERE%20type%20IN%20('table',%20'view')%20AND%20(?%20IS%20NULL%20OR%20name%20=%20?%20COLLATE%20NOCASE)
%20 %20 %20 %20 %20 ORDER%20BY%20type,%20name\"\"\",
%20 %20 %20 %20(table,%20table),
%20 %20).fetchall()
%20 if table isnotNoneandnot relations:
%20 %20 %20 raise ValueError(f\"no%20table%20or%20view%20named {table!r} at%20this%20frame\")
%20 %20writer%20=%20csv.writer(stream,%20lineterminator=\"\
\")
%20 %20writer.writerow((\"table\", \"kind\", \"cid\", \"column\", \"type\", \"not_null\",
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 \"default\", \"primary_key_position\", \"hidden\"))
%20 for name,%20kind in relations:
%20 %20 %20 for row in db.execute(
%20 %20 %20 %20 %20 'SELECT%20cid,%20name,%20type,%20\"notnull\",%20dflt_value,%20pk,%20hidden%20'
%20 %20 %20 %20 %20 'FROM%20pragma_table_xinfo(?,%20\\'main\\')%20ORDER%20BY%20cid',%20(name,)
%20 %20 %20 %20):
%20 %20 %20 %20 %20 %20writer.writerow((name,%20kind,%20*row))
def scan_frames(args,%20wal_file,%20wal,%20folder,%20stream):
%20 %20warn_wal_tail(wal)
%20 %20limit%20=%20frame_limit(wal,%20args.start,%20args.end)
%20 %20sql%20=%20read_sql(args)
%20 ifnot sql.strip():
%20 %20 %20 raise ValueError(\"SQL%20is%20empty\")
%20 ifnot args.commits_only and limit%20> 0:
%20 %20 %20 %20print(\"Scanning%20all%20requested%20frames,%20including%20incomplete%20transactions.\",%20file=sys.stderr)
%20 %20replay%20=%20folder%20/ \"replay.sqlite\"
%20 %20snapshot%20=%20folder%20/ \"query.sqlite\"
%20 %20shutil.copyfile(args.database,%20replay)
%20 %20tested%20=%20matched%20=%20failed%20= 0
%20 %20failure_examples%20=%20[]
%20 with replay.open(\"r+b\") as db_file:
%20 %20 %20 %20page_size%20=%20database_page_size(db_file,%20wal)
%20 %20 %20 for number in range(1,%20limit%20+ 1):
%20 %20 %20 %20 %20 %20frame%20=%20wal.frames[number%20- 1]
%20 %20 %20 %20 %20 %20apply_frame(db_file,%20wal_file,%20frame,%20page_size)
%20 %20 %20 %20 %20 if number%20<%20args.start or (args.commits_only andnot frame.commit_pages):
%20 %20 %20 %20 %20 %20 %20 continue
%20 %20 %20 %20 %20 %20tested%20+= 1
%20 %20 %20 %20 %20 %20db_file.flush()
%20 %20 %20 %20 %20 #%20SQL%20can%20modify%20its%20private%20copy%20without%20affecting%20the%20next%20frame.
%20 %20 %20 %20 %20 for suffix in (\"-wal\", \"-shm\", \"-journal\"):
%20 %20 %20 %20 %20 %20 %20 %20snapshot.with_name(snapshot.name%20+%20suffix).unlink(missing_ok=True)
%20 %20 %20 %20 %20 %20shutil.copyfile(replay,%20snapshot)
%20 %20 %20 %20 %20 with SpooledTemporaryFile(mode=\"w+t\",%20encoding=\"utf-8\",%20newline=\"\",
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20max_size=1024 * 1024) as rows:
%20 %20 %20 %20 %20 %20 %20 try:
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20finalize_snapshot(snapshot,%20page_size,%20number)
%20 %20 %20 %20 %20 %20 %20 %20 %20 with closing(sqlite3.connect(snapshot,%20isolation_level=None)) as db:
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 if args.check:
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20check_snapshot(db)
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20_,%20has_rows%20=%20query_snapshot(db,%20sql,%20rows,%20args.include_empty)
%20 %20 %20 %20 %20 %20 %20 except (ValueError,%20sqlite3.Error) as exc:
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20failed%20+= 1
%20 %20 %20 %20 %20 %20 %20 %20 %20 if len(failure_examples)%20< 5:
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20failure_examples.append((number,%20str(exc)))
%20 %20 %20 %20 %20 %20 %20 %20 %20 continue
%20 %20 %20 %20 %20 %20 %20 %20matched%20+=%20has_rows
%20 %20 %20 %20 %20 %20 %20 if has_rows or args.include_empty:
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20label%20= \"commit\"if frame.commit_pages else\"uncommitted\"
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20print(f\"Frame {number} ({label})\",%20file=stream)
%20 %20 %20 %20 %20 %20 %20 %20 %20 if has_rows:
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20rows.seek(0)
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20shutil.copyfileobj(rows,%20stream)
%20 %20 %20 %20 %20 %20 %20 %20 %20 else:
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20print(\"(no%20rows)\",%20file=stream)
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20print(file=stream)
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20stream.flush()
%20 %20print(f\"Scan%20complete:%20tested {tested},%20matched {matched},%20\"
%20 %20 %20 %20 f\"empty {tested%20-%20matched%20-%20failed},%20failed {failed}.\",%20file=sys.stderr)
%20 for number,%20message in failure_examples:
%20 %20 %20 %20print(f\"Frame {number}: {message}\",%20file=sys.stderr)
%20 if failed%20>%20len(failure_examples):
%20 %20 %20 %20print(f\"{failed%20-%20len(failure_examples)} additional%20failures.\",%20file=sys.stderr)
%20 return int(tested%20> 0and failed%20==%20tested)
def positive(value):
%20 %20number%20=%20int(value)
%20 if number%20< 1:
%20 %20 %20 raise argparse.ArgumentTypeError(\"must%20be%20at%20least%201\")
%20 return number
def parser():
%20 %20cli%20=%20argparse.ArgumentParser(description=__doc__)
%20 %20command%20=%20cli.add_subparsers(dest=\"command\")
%20 %20info%20=%20command.add_parser(\"info\",%20help=\"show%20WAL%20sizes,%20frame%20counts%20and%20validation\")
%20 %20info.add_argument(\"wal\",%20type=Path)
%20 %20frames%20=%20command.add_parser(\"frames\",%20help=\"list%20valid%20WAL%20frames%20as%20CSV\")
%20 %20frames.add_argument(\"wal\",%20type=Path)
%20 %20snapshot%20=%20command.add_parser(\"snapshot\",%20help=\"export%20a%20standalone%20SQLite%20database\")
%20 %20schema%20=%20command.add_parser(\"schema\",%20help=\"list%20tables,%20views%20and%20fields%20at%20a%20frame\")
%20 %20schema.add_argument(\"--table\",%20help=\"list%20fields%20for%20just%20this%20table%20or%20view\")
%20 %20query%20=%20command.add_parser(\"query\",%20help=\"execute%20SQL%20on%20a%20temporary%20snapshot\")
%20 %20scan%20=%20command.add_parser(\"scan\",%20help=\"run%20the%20same%20SQL%20at%20each%20selected%20frame\")
%20 %20scan.add_argument(\"--commits-only\",%20action=\"store_true\",%20help=\"query%20only%20commit%20frames\")
%20 %20scan.add_argument(\"--include-empty\",%20action=\"store_true\",%20help=\"also%20show%20frames%20with%20no%20rows\")
%20 for item in (frames,%20scan):
%20 %20 %20 %20item.add_argument(\"--start\",%20type=positive,%20default=1,%20help=\"first%20frame,%20inclusive\")
%20 %20 %20 %20item.add_argument(\"--end\",%20type=positive,%20help=\"last%20frame,%20inclusive\")
%20 for item in (query,%20scan):
%20 %20 %20 %20sql%20=%20item.add_mutually_exclusive_group(required=True)
%20 %20 %20 %20sql.add_argument(\"--sql\",%20help=\"inline%20SQL\")
%20 %20 %20 %20sql.add_argument(\"--sql-file\",%20type=Path,%20help=\"UTF-8%20SQL%20file,%20or%20-%20for%20stdin\")
%20 for item in (snapshot,%20schema,%20query,%20scan):
%20 %20 %20 %20item.add_argument(\"database\",%20type=Path,%20help=\"original%20main%20database\")
%20 %20 %20 %20item.add_argument(\"--wal\",%20type=Path,%20help=\"default:%20DATABASE-wal\")
%20 %20 %20 %20item.add_argument(\"--check\",%20action=\"store_true\",%20help=\"require%20SQLite%20PRAGMA%20quick_check%20to%20pass\")
%20 for item in (snapshot,%20schema,%20query):
%20 %20 %20 %20item.add_argument(\"--frame\",%20default=\"latest\",%20help=\"1-based%20frame,%200%20for%20main%20file,%20or%20latest\")
%20 %20 %20 %20item.add_argument(\"--committed\",%20action=\"store_true\",%20help=\"use%20last%20commit%20at%20or%20before%20the%20frame\")
%20 for item in (info,%20frames,%20schema,%20query,%20scan):
%20 %20 %20 %20item.add_argument(\"-o\", \"--output\",%20type=Path,%20help=\"write%20results%20to%20a%20new%20UTF-8%20file\")
%20 %20snapshot.add_argument(\"output\",%20type=Path,%20help=\"new%20database%20file\")
%20 return cli
def run(args,%20stream):
%20 if args.command in (\"info\", \"frames\"):
%20 %20 %20 with args.wal.open(\"rb\") as file:
%20 %20 %20 %20 %20 %20wal%20=%20read_wal(file)
%20 %20 %20 if args.command%20== \"info\":
%20 %20 %20 %20 %20 %20report_wal(wal,%20stream)
%20 %20 %20 else:
%20 %20 %20 %20 %20 %20list_frames(wal,%20args.start,%20args.end,%20stream)
%20 %20 %20 return0
%20 %20source%20=%20args.database
%20 %20wal_path%20=%20args.wal or source.with_name(source.name%20+ \"-wal\")
%20 try:
%20 %20 %20 %20wal_context%20=%20wal_path.open(\"rb\")
%20 except FileNotFoundError:
%20 %20 %20 if args.wal isnotNone:
%20 %20 %20 %20 %20 raise
%20 %20 %20 %20print(f\"No%20WAL%20file%20at {wal_path};%20using%20the%20main%20database.\",%20file=sys.stderr)
%20 %20 %20 %20wal_context%20=%20nullcontext(None)
%20 with TemporaryDirectory() as folder,%20wal_context as file:
%20 %20 %20 %20wal%20=%20read_wal(file) if file isnotNoneelse Wal(0)
%20 %20 %20 if args.command%20== \"scan\":
%20 %20 %20 %20 %20 return scan_frames(args,%20file,%20wal,%20Path(folder),%20stream)
%20 %20 %20 %20frame%20=%20select_frame(wal,%20args.frame,%20args.committed)
%20 %20 %20 %20print(f\"Snapshot%20at%20frame {frame}\",%20file=sys.stderr)
%20 %20 %20 if frame andnot wal.frames[frame%20- 1].commit_pages:
%20 %20 %20 %20 %20 %20print(\"Warning:%20stopping%20inside%20a%20transaction;%20the%20database%20may%20be%20inconsistent.\",
%20 %20 %20 %20 %20 %20 %20 %20 %20file=sys.stderr)
%20 %20 %20 %20temp%20=%20Path(folder)%20/ \"snapshot.sqlite\"
%20 %20 %20 %20build_snapshot(source,%20temp,%20file,%20wal,%20frame)
%20 %20 %20 if args.command in (\"query\", \"schema\") or args.check:
%20 %20 %20 %20 %20 with closing(sqlite3.connect(temp,%20isolation_level=None)) as db:
%20 %20 %20 %20 %20 %20 %20 if args.check:
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20check_snapshot(db)
%20 %20 %20 %20 %20 %20 %20 if args.command%20== \"query\":
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20written_set,%20_%20=%20query_snapshot(db,%20read_sql(args),%20stream)
%20 %20 %20 %20 %20 %20 %20 %20 %20 ifnot written_set:
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20print(\"SQL%20completed%20(no%20result%20set)\",%20file=sys.stderr)
%20 %20 %20 %20 %20 %20 %20 elif args.command%20== \"schema\":
%20 %20 %20 %20 %20 %20 %20 %20 %20 %20list_columns(db,%20args.table,%20stream)
%20 %20 %20 if args.command%20== \"snapshot\":
%20 %20 %20 %20 %20 %20publish_snapshot(temp,%20args.output)
%20 %20 %20 %20 %20 %20print(f\"Saved: {args.output}\",%20file=stream)
%20 return0
def main():
%20 %20cli%20=%20parser()
%20 %20args%20=%20cli.parse_args()
%20 if args.command isNone:
%20 %20 %20 %20cli.print_help()
%20 %20 %20 return0
%20 try:
%20 %20 %20 if args.command%20== \"snapshot\"or args.output isNone:
%20 %20 %20 %20 %20 return run(args,%20sys.stdout)
%20 %20 %20 with args.output.open(\"x\",%20encoding=\"utf-8\",%20newline=\"\") as stream:
%20 %20 %20 %20 %20 %20status%20=%20run(args,%20stream)
%20 %20 %20 %20print(f\"Results%20written%20to {args.output}\",%20file=sys.stderr)
%20 %20 %20 return status
%20 except (OSError,%20ValueError,%20sqlite3.Error,%20OverflowError) as exc:
%20 %20 %20 %20print(f\"Error: {exc}\",%20file=sys.stderr)
%20 %20 %20 return1
if __name__%20== \"__main__\":
%20 %20sys.exit(main())
用法:
python%20scan_wal.py%20scan%20Photos.sqlite%20--sql-file%20query.sql
query.sql 的内容为:
select ZFILENAME,%20ZDATECREATED,%20ZTRASHEDDATE, round(ZTRASHEDDATE-ZDATECREATED,3) as seconds
from ZASSET not INDEXED
where ZTRASHEDSTATE=1 and seconds < 20;
使用 not%20INDEXED 是因为在部分帧中%20sqlite%20为 ZTRASHEDSTATE%20=%201 选用了索引 Z_Asset_compoundIndex8。完整性检查显示,这一帧里该索引的条目数与表数据对不上,原查询走这个索引时就报了 database%20disk%20image%20is%20malformed,因此使用 not%20INDEXED 让%20sqlite%20不走索引直接扫描数据表避免报错
扫描显示共查询%201553%20帧,其中有%20638%20帧存在被删除图片的信息
文件名为 IMG_0001.PNG,从创建到被删除的时间为 12.599 秒,满足题意
第10题【单选题】
请根据参赛材料 FC-01 回答以下问题: 承接上题,在涉案群组的视讯通话记录中,唯一被涉案装置成功接通的视讯通话,其所属组名、通话开始时间(以UTC+8计算)及通话持续时间分别为何?
A. Tronic Working Group, 2026-08-04 09:48:25, 135秒 B. Tronic Working Group, 2026-08-04 17:48:25, 135秒 C. Tronic Working Group, 2026-08-06 14:10:48, 54秒 D. IT Working Group, 2026-08-04 09:48:25, 135秒 E. IT Working Group, 2026-08-04 17:48:25, 135秒
A
看 Qiko 的 WhatsApp 通话记录
第12题【单选题】
请根据参赛材料 FC-01 回答以下问题: 调查人员在分析涉案人员冯程(Fung Ching)装置内的 WhatsApp 群组记录时,发现有一条讯息提及两名客户分别投资 HK和500,000。最早阅读该讯息的群组成员是谁?
A. Lap Chan B. Lik Lee C. Ching Fung D. Tronic\_Office
参考答案为 A,实际存疑,下面是官方解题思路
在 Tronic Working Group 群组中定位到相应消息

SELECT ZFILENAME FROM ZASSET NOT INDEXED ORDER BY ZDATECREATED ASC LIMIT 3;
选择 LIMIT 3 是因为开始用 LIMIT 1 时查询到了两个结果:IMG_0001.PNG 和 IMG_0002.JPG
修改为 LIMIT 3 发现 IMG_0001.PNG 总在 IMG_0002.JPG 上面(其实采用 LIMIT 2 也可以),因此创建时间更早的是 IMG_0001.PNG
第16题【填空题】
请根据镜像文件 FC-01 回答以下问题: 承接上题,经排查该相片已被删除。该相片被删除的准确时间是什么(以 UTC+8 表示)? (答案格式:请按 YYYY-MM-DD HH:mm:ss 格式作答,例如:2026-01-01 12:00:00)
2026-07-27 12:53:26
同上题,逐帧查询 ZTRASHEDDATE 字段
SELECT ZTRASHEDDATE FROM ZASSET NOT INDEXED WHERE ZFILENAME = 'IMG_0001.PNG';
查询到的删除时间戳为 806820806.599,转换一下即可拿到答案
第17题【填空题】
请根据镜像文件 FC-01 回答以下问题: 承接上题,请指出该相片的全局唯一标识符(ZUUID)是什么? (答案格式:请按标准 UUID 格式填写,英文字母大写并包含连字符,例如:12345678-ABCD-EF01-2345-6789ABCDEF01)
5C28BFF1-9751-4709-B0B1-B20C9ECF5D8F
同上题,逐帧查询 ZUUID 字段
SELECT ZUUID FROM ZASSET NOT INDEXED WHERE ZFILENAME = 'IMG_0001.PNG';
第18题【填空题】
请根据镜像文件 FC-01 回答以下问题: 承接上题,请指出该相片的原始文件大小是多少字节(Byte)? (答案格式:仅填写半角阿拉伯数字,例如:102400)
318970
同上题,逐帧查询 ZADDITIONALASSETATTRIBUTES 表的 ZORIGINALFILESIZE 字段
SELECT ZORIGINALFILESIZE FROM ZADDITIONALASSETATTRIBUTES NOT INDEXED WHERE ZORIGINALFILENAME = 'IMG_0001.PNG';
第19题【填空题】
请根据镜像文件 FC-01 回答以下问题: 承接上题,该已删除相片曾同步至 iCloud 的主资源记录,请指出其在数据表中所记录的云端主唯一标识符(ZCLOUDMASTERGUID)是什么? (答案格式:请严格区分英文字母大小写并完整填写字符串,包含加号“+”等特殊符号,不含空格,例如:Bq1adfkjadDSDFjkahdf+ljaljsfEdfa)
Aa1sazGmizbawcNL+g4HklK5aEqo
同上题,逐帧查询 ZCLOUDMASTER 表的 ZCLOUDMASTERGUID 字段
SELECT ZCLOUDMASTERGUID FROM ZCLOUDMASTER NOT INDEXED WHERE ZORIGINALFILENAME = 'IMG_0001.PNG';










评论