mirror of
https://github.com/Momoko-Ayase/Senbei.git
synced 2026-11-24 18:52:47 +08:00
chore: spell the product name CrackProof
Match the capitalization the research documentation uses, in comments, messages, tests, and the web app. Lowercase identifiers and URLs are unchanged.
This commit is contained in:
1 parent
7fde1809c7
commit
4d211166bf
21 files changed
+69
-69
No files matched your search
@@ -76,7 +76,7 @@ pub fn default_out_root_for_file(input: &Path) -> PathBuf {
|
||||
parent.join("unpack")
|
||||
}
|
||||
|
||||
/// Unpack all Crackproof-protected files under `root`, writing results into
|
||||
/// Unpack all CrackProof-protected files under `root`, writing results into
|
||||
/// a mirrored subtree under `out_dir` (or `root/unpack` if None).
|
||||
///
|
||||
/// Each file is processed independently: a panic or error in one file is
|
||||
@@ -215,7 +215,7 @@ fn run_folder_inner(
|
||||
log.step(&format!("out {}", out_root.display()));
|
||||
Some(log)
|
||||
};
|
||||
// Single merged directory walk: returns Crackproof unpack candidates, il2cpp
|
||||
// Single merged directory walk: returns CrackProof unpack candidates, il2cpp
|
||||
// metadata blobs, and Android targets from one traversal (see
|
||||
// [`crate::scan::find_targets_opts`]). Files the free directory metadata
|
||||
// already rules out are never opened — on asset-heavy trees the per-file
|
||||
@@ -1264,7 +1264,7 @@ fn unsupported_version(e: &anyhow::Error) -> Option<u32> {
|
||||
|
||||
/// De-obfuscate an il2cpp `global-metadata.dat` to `dest`.
|
||||
///
|
||||
/// Crackproof's `-GMD` option scrambles each `Il2CppMethodDefinition`'s token
|
||||
/// CrackProof's `-GMD` option scrambles each `Il2CppMethodDefinition`'s token
|
||||
/// into a sparse, original-metadata-style value; il2cpp expects the contiguous
|
||||
/// per-module index it indexes its codegen tables with, so a statically-unpacked
|
||||
/// il2cpp game assembly reads garbage and crashes during init. This rewrites
|
||||
|
||||
+12
-12
@@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
|
||||
use walkdir::WalkDir;
|
||||
|
||||
/// Bytes read per file for content detection. `detect` inspects the DOS/PE
|
||||
/// header and the Crackproof key table at offset 4096; its deepest read is the
|
||||
/// header and the CrackProof key table at offset 4096; its deepest read is the
|
||||
/// key-table dword at 4124 (so a candidate must be ≥ 4128 bytes) or the PE
|
||||
/// data-directory field at `e_lfanew + 252`, which is far below 8 KiB for any
|
||||
/// real PE (`e_lfanew` is a few hundred bytes). `is_metadata` needs only the
|
||||
@@ -16,7 +16,7 @@ const DETECT_PREFIX: u64 = 8 * 1024;
|
||||
/// Smallest file that can possibly be a target, so anything shorter is skipped
|
||||
/// without ever being opened.
|
||||
///
|
||||
/// A Crackproof module needs ≥ 4128 bytes for [`senbei_engine::detect`]'s key
|
||||
/// A CrackProof module needs ≥ 4128 bytes for [`senbei_engine::detect`]'s key
|
||||
/// table (it reads the dword at 4124), so the bound is exact for the unpack
|
||||
/// path. An il2cpp `global-metadata.dat` only needs 4 bytes to match its magic,
|
||||
/// but its header alone runs to offset 0xB0 and the images/types/methods tables
|
||||
@@ -34,10 +34,10 @@ fn is_metadata_name(path: &Path) -> bool {
|
||||
/// Content classification of a single file.
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
enum Class {
|
||||
/// Neither a Crackproof module nor il2cpp metadata — left untouched.
|
||||
/// Neither a CrackProof module nor il2cpp metadata — left untouched.
|
||||
None,
|
||||
/// A Crackproof-protected PE (unpack target).
|
||||
Crackproof,
|
||||
/// A CrackProof-protected PE (unpack target).
|
||||
CrackProof,
|
||||
/// An il2cpp `global-metadata.dat` (de-obfuscation target).
|
||||
Metadata,
|
||||
/// A protected AArch64 shared library (Android restore target).
|
||||
@@ -50,7 +50,7 @@ enum Class {
|
||||
/// Everything one [`find_targets_opts`] walk found, plus non-target tallies.
|
||||
#[derive(Default)]
|
||||
pub struct ScanResult {
|
||||
/// Crackproof-protected PE files.
|
||||
/// CrackProof-protected PE files.
|
||||
pub crackproof: Vec<PathBuf>,
|
||||
/// il2cpp `global-metadata.dat` blobs.
|
||||
pub metadata: Vec<PathBuf>,
|
||||
@@ -62,7 +62,7 @@ pub struct ScanResult {
|
||||
}
|
||||
|
||||
/// Walk `root` recursively (skipping any directory literally named `"unpack"`)
|
||||
/// and return, **in walk order**, the Crackproof candidates and the il2cpp
|
||||
/// and return, **in walk order**, the CrackProof candidates and the il2cpp
|
||||
/// metadata blobs found — from a *single* traversal that opens each file at
|
||||
/// most once.
|
||||
///
|
||||
@@ -213,7 +213,7 @@ pub fn find_targets_with_limits(
|
||||
};
|
||||
for (p, c) in paths.into_iter().zip(class) {
|
||||
match c {
|
||||
Some(Class::Crackproof) => result.crackproof.push(p),
|
||||
Some(Class::CrackProof) => result.crackproof.push(p),
|
||||
Some(Class::Metadata) => result.metadata.push(p),
|
||||
Some(Class::AndroidSo) => result.android_so.push(p),
|
||||
Some(Class::AndroidPackage) => result.android_packages.push(p),
|
||||
@@ -247,7 +247,7 @@ pub fn scan_all_env() -> bool {
|
||||
/// re-raises on join, before any per-file isolation exists). The default panic
|
||||
/// hook still prints the message, keeping the bug diagnosable.
|
||||
///
|
||||
/// A Crackproof PE never matches the metadata magic (it is a PE, not a
|
||||
/// A CrackProof PE never matches the metadata magic (it is a PE, not a
|
||||
/// metadata blob) and vice versa, so the order is immaterial.
|
||||
///
|
||||
/// The Android library probe needs more than the prefix: the protection
|
||||
@@ -264,7 +264,7 @@ fn classify(path: &Path, limits: &senbei_engine::android::ResourceLimits) -> Opt
|
||||
return Class::Metadata;
|
||||
}
|
||||
if crate::windows::is_pe_extension(path) && detect(&head).is_some() {
|
||||
return Class::Crackproof;
|
||||
return Class::CrackProof;
|
||||
}
|
||||
if crate::android::is_so_name(path)
|
||||
&& crate::android::is_elf64_aarch64(&head)
|
||||
@@ -337,7 +337,7 @@ mod tests {
|
||||
assert!(exhaustive.metadata.is_empty());
|
||||
}
|
||||
|
||||
/// A selected file below the Crackproof key-table bound is skipped without
|
||||
/// A selected file below the CrackProof key-table bound is skipped without
|
||||
/// being opened, while `scan_all` probes it.
|
||||
#[test]
|
||||
fn prefilter_skips_small_selected_files_only() {
|
||||
@@ -347,7 +347,7 @@ mod tests {
|
||||
std::fs::write(root.join("assets.ab"), vec![0u8; 100_000]).unwrap();
|
||||
std::fs::write(root.join("plain.dll"), vec![0u8; 100_000]).unwrap();
|
||||
|
||||
// None of them are Crackproof, so both modes find nothing; the point is
|
||||
// None of them are CrackProof, so both modes find nothing; the point is
|
||||
// that only the selected names are considered and `scan_all` controls
|
||||
// the size floor.
|
||||
let scan = find_targets_opts(root, false);
|
||||
|
||||
@@ -44,7 +44,7 @@ pub(crate) fn is_reparse_point(_entry: &walkdir::DirEntry) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// Crackproof header key table lives at this fixed file offset. For the
|
||||
/// CrackProof header key table lives at this fixed file offset. For the
|
||||
/// external-companion layout, the companion payload aligns to the stub here.
|
||||
const HEADER_OFF: usize = 4096;
|
||||
|
||||
@@ -54,10 +54,10 @@ const HEADER_OFF: usize = 4096;
|
||||
/// In that layout a protected module is split into a thin on-disk loader stub
|
||||
/// (`Foo.dll`, whose code sections are stripped to one page) plus an encrypted
|
||||
/// `Foo.dll._` companion holding the real payload. The companion is byte-for-byte
|
||||
/// the stub's payload region starting at the Crackproof header (offset 4096), so
|
||||
/// the stub's payload region starting at the CrackProof header (offset 4096), so
|
||||
/// `stub[..4096] ++ companion` reconstructs the ordinary embedded-payload file
|
||||
/// the existing pipelines already unpack. The runtime loader does exactly this:
|
||||
/// it maps `Foo.dll._` and feeds it through the standard Crackproof unpack.
|
||||
/// it maps `Foo.dll._` and feeds it through the standard CrackProof unpack.
|
||||
///
|
||||
/// The splice fires only when a sibling `<input>._` exists *and* its first 32
|
||||
/// bytes equal the stub's header at offset 4096 — a precise signal that the
|
||||
@@ -107,7 +107,7 @@ pub(crate) fn read_unpacker_input(input: &Path) -> anyhow::Result<UnpackerInput>
|
||||
|
||||
/// The bytes fed to the unpacker, plus the original loader stub when the input
|
||||
/// was reconstructed from an external companion. The stub is retained because
|
||||
/// the crackproof loader rebuilds the PE export table at runtime from data kept
|
||||
/// the CrackProof loader rebuilds the PE export table at runtime from data kept
|
||||
/// in the stub — that table is *not* present in the encrypted companion, so the
|
||||
/// unpacked image needs it overlaid from the stub afterwards
|
||||
/// (see [`overlay_exports_from_stub`]).
|
||||
@@ -120,7 +120,7 @@ pub(crate) struct UnpackerInput {
|
||||
/// `out`, for the external-companion layout.
|
||||
///
|
||||
/// In that layout the encrypted companion carries the real `.text`/`il2cpp`
|
||||
/// payload but **not** a usable export directory: the crackproof loader rebuilds
|
||||
/// payload but **not** a usable export directory: the CrackProof loader rebuilds
|
||||
/// exports at runtime from the plaintext copy retained in the stub's `.rdata`.
|
||||
/// Statically, the spliced input therefore decrypts to a garbage export
|
||||
/// directory (`NumberOfFunctions` etc. are ciphertext), which makes downstream
|
||||
@@ -245,7 +245,7 @@ fn restore_managed_from_stub(out: &mut [u8], stub: &[u8]) -> Result<(), unpacker
|
||||
/// Restore the TLS directory from the loader `stub` onto the unpacked image
|
||||
/// `out`, for the external-companion layout.
|
||||
///
|
||||
/// Crackproof strips the whole `IMAGE_TLS_DIRECTORY` from the encrypted payload
|
||||
/// CrackProof strips the whole `IMAGE_TLS_DIRECTORY` from the encrypted payload
|
||||
/// — the data-directory entry, the directory struct, the raw-data template, and
|
||||
/// the base relocations for the struct's four 64-bit pointer fields — and
|
||||
/// re-installs TLS itself from data kept in the stub when it loads the module.
|
||||
@@ -419,7 +419,7 @@ fn write_u32_at(buf: &mut [u8], off: usize, val: u32) {
|
||||
/// Splice a stub and its external-companion payload into the embedded-payload
|
||||
/// form the pipelines expect, or `None` if `comp` is not this stub's payload.
|
||||
///
|
||||
/// The companion is byte-for-byte the stub's payload region from the Crackproof
|
||||
/// The companion is byte-for-byte the stub's payload region from the CrackProof
|
||||
/// header (offset 4096) onward, so the result is `stub[..4096] ++ comp`. The
|
||||
/// splice fires only when the first 32 bytes of `comp` equal the stub's header
|
||||
/// at offset 4096 — a 32-byte match on the key-table/magic region that confirms
|
||||
@@ -450,7 +450,7 @@ pub(crate) fn unpack_spliced_or_auto(
|
||||
verbose: bool,
|
||||
) -> Result<(unpacker::Kind, Vec<u8>), unpacker::UnpackError> {
|
||||
if spliced || force_exe {
|
||||
let detected = unpacker::detect(bytes).ok_or(unpacker::UnpackError::NotCrackproof)?;
|
||||
let detected = unpacker::detect(bytes).ok_or(unpacker::UnpackError::NotCrackProof)?;
|
||||
let out = unpacker::unpack_exe_v(bytes, verbose)?;
|
||||
return Ok((detected.kind, out));
|
||||
}
|
||||
@@ -631,7 +631,7 @@ fn unpack_bytes_profiled_impl(
|
||||
let kind = match profile.observed.kind {
|
||||
Some(kind) => kind,
|
||||
None => {
|
||||
let error = unpacker::UnpackError::NotCrackproof;
|
||||
let error = unpacker::UnpackError::NotCrackProof;
|
||||
profile.push_error(error.to_string());
|
||||
return (profile, Err(error));
|
||||
}
|
||||
@@ -660,7 +660,7 @@ pub fn unpack_one_v(
|
||||
// the encrypted companion does not carry (the loader rebuilds it at runtime).
|
||||
if let Some(stub) = stub {
|
||||
overlay_exports_from_stub(&mut out, &stub);
|
||||
// ...and the TLS directory, which Crackproof strips from the payload and
|
||||
// ...and the TLS directory, which CrackProof strips from the payload and
|
||||
// re-installs at runtime; the ordinary loader needs it or thread_local
|
||||
// access crashes (see [`restore_tls_from_stub`]).
|
||||
restore_tls_from_stub(&mut out, &stub);
|
||||
@@ -947,7 +947,7 @@ mod tests {
|
||||
#[test]
|
||||
fn profiled_unknown_input_is_not_recognized() {
|
||||
let (profile, result) = unpack_bytes_profiled(&[], None);
|
||||
assert!(matches!(result, Err(unpacker::UnpackError::NotCrackproof)));
|
||||
assert!(matches!(result, Err(unpacker::UnpackError::NotCrackProof)));
|
||||
assert_eq!(
|
||||
profile.recognition,
|
||||
unpacker::RecognitionStatus::NotRecognized
|
||||
|
||||
Reference in new issue
Block a user