Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

575 B
Raw Blame
import { createAsarHeaderSignatureProbe } from "../../src/artifacts/AsarHeader.js";
import { classifyArtifactContent } from "../../src/artifacts/inventory/ArtifactGraphConstruction.js";

/** Observe a supplied byte prefix before assigning an inventory path role. */
export const classifyArtifactBytesAtPath = (
  path: string,
  bytes: Buffer,
  fileSize = bytes.length,
) => {
  const probe = createAsarHeaderSignatureProbe();
  probe.write(bytes);
  return classifyArtifactContent(
    path,
    { prefix: bytes, asarHeader: probe.finish(fileSize) },
    fileSize,
  );
};