mirror of
https://github.com/morluto/rea
synced 2026-10-26 06:16:17 -04:00
933af60eba
* feat(native): read PE and ELF export tables Add a host-independent export-table reader on the shared native container layer. PE images report each used export-address-table slot with its ordinal, one row per name, its address or forwarder text, and the export directory identity; the PE image reader now exposes its data directories. ELF images report defined default/protected global, weak and unique .dynsym symbols with type, binding and .gnu.version_d version (hidden versions kept distinct, unreadable version tables "unknown"). Unreadable entries are counted in issues and make coverage partial; an ELF without section headers is unsupported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(native): inspect native export tables through CLI and MCP Expose the reader as inspect_native_exports / inspect-native-exports: one stable, digest-bound read of an explicit file with a caller-selected input budget, typed failures for malformed, unsupported, oversized and cancelled reads, and observed Evidence bound to the file path and SHA-256. Mach-O inputs point to inspect_macho. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(native): describe portable PE and ELF export inventories Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(native): bound export inventories and read header-backed PE tables Address review of the export-table reader: - Charge every retained row and its name, forwarder and version text against shared 262144-row and 16 MiB allowances before storing it, so repeated long names or PE aliases cannot exhaust memory. - Map PE RVAs through the headers as well as sections; the PE image reader now exposes its SizeOfHeaders mapping. - Keep ELF exports with version "unknown" when .gnu.version lies outside the file, and report an empty version-definition name as unresolved. - Reject a .dynsym without its mandatory null entry as malformed. - Decode the ELF section directory once. - Correct the docs on which gaps drop rows and which keep them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
2.4 KiB
TypeScript
41 lines
2.4 KiB
TypeScript
import { ByteEntropyService } from "../application/binaryDiagnostics/ByteEntropyService.js";
|
|
import { RecordedCrashService } from "../application/binaryDiagnostics/RecordedCrashService.js";
|
|
import { PwntoolsRecordedCrashProvider } from "../native/pwntools/PwntoolsRecordedCrashProvider.js";
|
|
import { BinaryLayoutService } from "../application/binaryDiagnostics/BinaryLayoutService.js";
|
|
import { PwntoolsLayoutProvider } from "../native/pwntools/PwntoolsLayoutProvider.js";
|
|
import { PeResourcesService } from "../application/binaryDiagnostics/PeResourcesService.js";
|
|
import { PeResourcesProvider } from "../native/pe/PeResourcesProvider.js";
|
|
import { ElfNotesService } from "../application/binaryDiagnostics/ElfNotesService.js";
|
|
import { ElfNotesProvider } from "../native/elf/ElfNotesProvider.js";
|
|
import type { ArtifactResourceScope } from "../artifacts/ArtifactResourceScope.js";
|
|
import { NativeExportsService } from "../application/binaryDiagnostics/NativeExportsService.js";
|
|
import { NativeExportsProvider } from "../native/exports/NativeExportsProvider.js";
|
|
|
|
/** Portable PE inspection with no engine, installation or target acquisition. */
|
|
export const createPeResourcesService = (): PeResourcesService =>
|
|
new PeResourcesService(new PeResourcesProvider());
|
|
|
|
/** Portable PE/ELF export tables with no engine, toolchain or target acquisition. */
|
|
export const createNativeExportsService = (): NativeExportsService =>
|
|
new NativeExportsService(new NativeExportsProvider());
|
|
/** Portable ELF note-table inspection with no engine or package catalog. */
|
|
export const createElfNotesService = (): ElfNotesService =>
|
|
new ElfNotesService(new ElfNotesProvider());
|
|
|
|
/** Compose the offline adapter without import-time I/O or dependency acquisition. */
|
|
export const createBinaryLayoutService = (
|
|
environment: Readonly<NodeJS.ProcessEnv> = process.env,
|
|
): BinaryLayoutService =>
|
|
new BinaryLayoutService(new PwntoolsLayoutProvider(environment));
|
|
|
|
/** Compose recorded-core inspection without acquiring a debugger or toolchain. */
|
|
export const createRecordedCrashService = (
|
|
environment: Readonly<NodeJS.ProcessEnv> = process.env,
|
|
): RecordedCrashService =>
|
|
new RecordedCrashService(new PwntoolsRecordedCrashProvider(environment));
|
|
|
|
/** Provider-free local byte analysis. */
|
|
export const createByteEntropyService = (
|
|
resources?: ArtifactResourceScope,
|
|
): ByteEntropyService => new ByteEntropyService(undefined, resources);
|