Files
reverse-engineering-anything/src/cli/ntfsJournalCommand.ts
T

55 lines
1.7 KiB
TypeScript

import type { Logger } from "pino";
import { NTFS_JOURNAL_TOOL_CONTRACTS } from "../contracts/ntfsJournalToolContracts.js";
import {
NTFS_JOURNAL_OPERATION as operation,
NTFS_JOURNAL_PROVIDER,
} from "../domain/windows/ntfsJournalQuery.js";
import { contractNamed } from "./contractCliDescription.js";
import { registerContractCommand } from "./contractCommand.js";
import {
inspectWithService,
createArtifactInspectionService,
} from "./contractCommandRunners.js";
import type { CliInstance } from "./types.js";
export const registerNtfsJournalCommand = (
cli: CliInstance,
logger: Logger,
): void =>
registerContractCommand(
cli,
logger,
contractNamed(NTFS_JOURNAL_TOOL_CONTRACTS, operation),
{
description:
"Inspect paired offline NTFS MFT and USN journal acquisitions",
positionals: ["mft_path", "journal_path"],
callerPaths: ["mft_path", "journal_path"],
fields: {
mft_path: { description: "Acquired NTFS Master File Table stream" },
journal_path: {
description: "Acquired NTFS change journal data stream",
},
},
},
// The journal is the inspected input; the MFT is its caller-paired companion.
inspectWithService(
createNtfsJournalService,
NTFS_JOURNAL_PROVIDER.id,
"journal_path",
),
);
/** One-shot journal inspection that owns the acquisition files it opens. */
const createNtfsJournalService = () =>
createArtifactInspectionService(
NTFS_JOURNAL_PROVIDER,
operation,
async (input, resources, signal) => {
const { inspectNtfsJournalEvidence } =
await import("../application/ntfs/NtfsJournalService.js");
return inspectNtfsJournalEvidence(input, resources, signal);
},
);