diff --git a/app/console.py b/app/console.py index 8e1da55..5eba78c 100644 --- a/app/console.py +++ b/app/console.py @@ -960,15 +960,13 @@ async def test_page(request: Request, current=Depends(require_login)): index = json.loads(index_path.read_text(encoding="utf-8")) meta_map = {s["filename"]: s for s in index.get("samples", [])} - # 收集所有样本文件 - for fpath in sorted(samples_dir.iterdir()): - if not fpath.is_file(): - continue - if fpath.name == "index.json" or fpath.name.startswith("_"): - continue - if fpath.suffix == ".json" and fpath.name.startswith("_scan_results"): - continue - samples_list.append(fpath) + # ★ 只展示 index.json 里登记的样本(不遍历目录,避免临时/调试文件混入) + # 每个样本必须: index.json 有登记 + 磁盘上确实存在 + for s in index.get("samples", []): + fname = s["filename"] + fpath = samples_dir / fname + if fpath.is_file(): + samples_list.append(fpath) results: list[dict] = [] pass_cnt = fail_cnt = 0 diff --git a/tests/samples/L4-005_hotreload.txt b/tests/samples/L4-005_hotreload.txt deleted file mode 100644 index 00af789..0000000 --- a/tests/samples/L4-005_hotreload.txt +++ /dev/null @@ -1 +0,0 @@ -meshsafe-hot-reload-test-string present here \ No newline at end of file diff --git a/tests/samples/L4-007_meta_rule.txt b/tests/samples/L4-007_meta_rule.txt deleted file mode 100644 index f578307..0000000 --- a/tests/samples/L4-007_meta_rule.txt +++ /dev/null @@ -1 +0,0 @@ -trojan-metadata-test payload here \ No newline at end of file diff --git a/tests/samples/L4-010_regex_pattern.txt b/tests/samples/L4-010_regex_pattern.txt deleted file mode 100644 index 09f8c76..0000000 --- a/tests/samples/L4-010_regex_pattern.txt +++ /dev/null @@ -1 +0,0 @@ -powershell -enc ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx+/== \ No newline at end of file diff --git a/tests/samples/L4-012_size_condition.txt b/tests/samples/L4-012_size_condition.txt deleted file mode 100644 index 7abaf37..0000000 --- a/tests/samples/L4-012_size_condition.txt +++ /dev/null @@ -1 +0,0 @@ -size_condition_test_payload small file \ No newline at end of file