샘플
resedit 1.7.2: Format
검증된 샘플 — npm resedit 1.7.2: Format. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: assert resedit.Format.getImageDosHeader parses DOS header…
sha256:625d561b38f561d4dc1ce4dc1f505741f9b2bdfce6d5a1dce9aff76b97963e40
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-06 |
케이스
HOW- 목표
- verify resedit.Format in pkg:npm/resedit@1.7.2
- 패키지
- 심벌
-
- resedit.Format
- 생성일
- 2026-09-06T11:46:12Z
컨트랙트
- assert resedit.Format.getImageDosHeader parses DOS header from PE binary returning valid ImageDosHeader with MZ magic
- assert resedit.Format.getImageNtHeadersByDosHeader parses NT headers returning valid ImageNtHeaders with PE signature and 64-bit detection
- assert resedit.Format.getImageNtHeadersByDosHeader correctly identifies 32-bit PE binaries with PE32 magic 267 and is32bit true
- assert resedit.Format.getImageSectionHeadersByNtHeaders returns ImageSectionHeaderArray matching numberOfSections
- assert resedit.Format.findImageSectionBlockByDirectoryEntry returns null for unpopulated directory entries
파일
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify resedit.Format in pkg:npm/resedit@1.7.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/resedit@1.7.2
Demonstrate these symbols/APIs:
- resedit.Format
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:1c295398fb3e261768511bc9448a1c4db1c5e3ec9550136e3bfe806e04ab4369","contract":["assert resedit.Format.getImageDosHeader parses DOS header from PE binary returning valid ImageDosHeader with MZ magic","assert resedit.Format.getImageNtHeadersByDosHeader parses NT headers returning valid ImageNtHeaders with PE signature and 64-bit detection","assert resedit.Format.getImageNtHeadersByDosHeader correctly identifies 32-bit PE binaries with PE32 magic 267 and is32bit true","assert resedit.Format.getImageSectionHeadersByNtHeaders returns ImageSectionHeaderArray matching numberOfSections","assert resedit.Format.findImageSectionBlockByDirectoryEntry returns null for unpopulated directory entries"],"goal":"verify resedit.Format in pkg:npm/resedit@1.7.2","kind":"HOW","packages":["pkg:npm/resedit@1.7.2"],"schemaVersion":1,"symbols":["resedit.Format"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/resedit@1.7.2"],"schemaVersion":1,"subject":"pkg:npm/resedit@1.7.2","symbols":["resedit.Format"],"verifierAdapter":"node-typescript@1"}
const { NtExecutable, Format } = require('resedit');
function parseDosHeader(bin) {
const dos = Format.getImageDosHeader(bin);
return {
isValid: dos.isValid(),
magic: dos.magic,
newHeaderAddress: dos.newHeaderAddress,
};
}
function parseNtHeaders(bin, dosHeader) {
const nt = Format.getImageNtHeadersByDosHeader(bin, dosHeader);
return {
isValid: nt.isValid(),
is32bit: nt.is32bit(),
signature: nt.signature,
machine: nt.fileHeader.machine,
numberOfSections: nt.fileHeader.numberOfSections,
optionalMagic: nt.optionalHeader.magic,
dataDirectoryCount: nt.optionalHeaderDataDirectory.length,
};
}
function getSectionHeaders(bin, dosHeader, ntHeaders) {
return Format.getImageSectionHeadersByNtHeaders(bin, dosHeader, ntHeaders);
}
function findSectionByEntry(bin, dosHeader, ntHeaders, entryType) {
return Format.findImageSectionBlockByDirectoryEntry(bin, dosHeader, ntHeaders, entryType);
}
module.exports = {
NtExecutable,
Format,
parseDosHeader,
parseNtHeaders,
getSectionHeaders,
findSectionByEntry,
};
{
"name": "sample-resedit-format",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-resedit-format",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"resedit": "1.7.2"
}
},
"node_modules/pe-library": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/pe-library/-/pe-library-0.4.1.tgz",
"integrity": "sha512-eRWB5LBz7PpDu4PUlwT0PhnQfTQJlDDdPa35urV4Osrm0t0AqQFGn+UIkU3klZvwJ8KPO3VbBFsXquA6p6kqZw==",
"license": "MIT",
"engines": {
"node": ">=12",
"npm": ">=6"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/jet2jet"
}
},
"node_modules/resedit": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/resedit/-/resedit-1.7.2.tgz",
"integrity": "sha512-vHjcY2MlAITJhC0eRD/Vv8Vlgmu9Sd3LX9zZvtGzU5ZImdTN3+d6e/4mnTyV8vEbyf1sgNIrWxhWlrys52OkEA==",
"license": "MIT",
"dependencies": {
"pe-library": "^0.4.1"
},
"engines": {
"node": ">=12",
"npm": ">=6"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/jet2jet"
}
}
}
}
{
"name": "sample-resedit-format",
"version": "1.0.0",
"description": "Minimal clean-room sample verifying resedit.Format in resedit",
"main": "index.js",
"license": "MIT-0",
"dependencies": {
"resedit": "1.7.2"
}
}
{
"schemaVersion": 1,
"goal": "verify resedit.Format in pkg:npm/resedit@1.7.2",
"kind": "HOW",
"packages": [
"pkg:npm/resedit@1.7.2"
],
"symbols": [
"resedit.Format"
]
}
import assert from 'node:assert';
import {
NtExecutable,
Format,
parseDosHeader,
parseNtHeaders,
getSectionHeaders,
findSectionByEntry,
} from '../index.js';
// ---------------------------------------------------------------------------
// 1. assert resedit.Format.getImageDosHeader parses DOS header from PE binary returning valid ImageDosHeader with MZ magic
// ---------------------------------------------------------------------------
const exe64 = NtExecutable.createEmpty(false, false);
const bin64 = exe64.generate();
const dos64 = Format.getImageDosHeader(bin64);
assert.strictEqual(dos64.isValid(), true, 'DOS header must be valid for PE executable');
assert.strictEqual(dos64.magic, Format.ImageDosHeader.DEFAULT_MAGIC, 'DOS header magic must be 0x5A4D (23117)');
assert(dos64.newHeaderAddress > 0, 'newHeaderAddress must point to NT headers offset');
const parsedDos = parseDosHeader(bin64);
assert.strictEqual(parsedDos.isValid, true, 'parsedDos must be valid');
assert.strictEqual(parsedDos.magic, 23117, 'parsedDos magic must be 23117');
// ---------------------------------------------------------------------------
// 2. assert resedit.Format.getImageNtHeadersByDosHeader parses NT headers returning valid ImageNtHeaders with PE signature and 64-bit detection
// ---------------------------------------------------------------------------
const nt64 = Format.getImageNtHeadersByDosHeader(bin64, dos64);
assert.strictEqual(nt64.isValid(), true, 'NT headers must be valid');
assert.strictEqual(nt64.signature, Format.ImageNtHeaders.DEFAULT_SIGNATURE, 'NT headers signature must be 0x4550 (17744)');
assert.strictEqual(nt64.is32bit(), false, 'is32bit() must return false for 64-bit executable');
assert.strictEqual(nt64.fileHeader.machine, 34404, 'Machine type must be IMAGE_FILE_MACHINE_AMD64 (0x8664 / 34404)');
assert.strictEqual(nt64.optionalHeader.magic, Format.ImageOptionalHeader64.DEFAULT_MAGIC, 'Optional header magic must be 523 (PE32+)');
assert.strictEqual(nt64.optionalHeaderDataDirectory.length, 16, 'Standard PE executable must have 16 data directory entries');
const parsedNt64 = parseNtHeaders(bin64, dos64);
assert.strictEqual(parsedNt64.isValid, true, 'parsedNt64 must be valid');
assert.strictEqual(parsedNt64.is32bit, false, 'parsedNt64 must be 64-bit');
assert.strictEqual(parsedNt64.signature, 17744, 'parsedNt64 signature must be 17744');
assert.strictEqual(parsedNt64.optionalMagic, 523, 'parsedNt64 optionalMagic must be 523');
assert.strictEqual(parsedNt64.dataDirectoryCount, 16, 'parsedNt64 directory count must be 16');
// ---------------------------------------------------------------------------
// 3. assert resedit.Format.getImageNtHeadersByDosHeader correctly identifies 32-bit PE binaries with PE32 magic 267 and is32bit true
// ---------------------------------------------------------------------------
const exe32 = NtExecutable.createEmpty(true, false);
const bin32 = exe32.generate();
const dos32 = Format.getImageDosHeader(bin32);
const nt32 = Format.getImageNtHeadersByDosHeader(bin32, dos32);
assert.strictEqual(nt32.isValid(), true, '32-bit NT headers must be valid');
assert.strictEqual(nt32.is32bit(), true, 'is32bit() must return true for 32-bit executable');
assert.strictEqual(nt32.fileHeader.machine, 332, 'Machine type must be IMAGE_FILE_MACHINE_I386 (0x14c / 332)');
assert.strictEqual(nt32.optionalHeader.magic, Format.ImageOptionalHeader.DEFAULT_MAGIC, 'Optional header magic must be 267 (PE32)');
const parsedNt32 = parseNtHeaders(bin32, dos32);
assert.strictEqual(parsedNt32.isValid, true, 'parsedNt32 must be valid');
assert.strictEqual(parsedNt32.is32bit, true, 'parsedNt32 must be 32-bit');
assert.strictEqual(parsedNt32.machine, 332, 'parsedNt32 machine must be 332');
assert.strictEqual(parsedNt32.optionalMagic, 267, 'parsedNt32 optionalMagic must be 267');
// ---------------------------------------------------------------------------
// 4. assert resedit.Format.getImageSectionHeadersByNtHeaders returns ImageSectionHeaderArray matching numberOfSections
// ---------------------------------------------------------------------------
const sections = getSectionHeaders(bin64, dos64, nt64);
assert.strictEqual(typeof sections.length, 'number', 'sections must have length property');
assert.strictEqual(sections.length, nt64.fileHeader.numberOfSections, 'Section count must match numberOfSections');
// ---------------------------------------------------------------------------
// 5. assert resedit.Format.findImageSectionBlockByDirectoryEntry returns null for unpopulated directory entries
// ---------------------------------------------------------------------------
const resourceSection = findSectionByEntry(bin64, dos64, nt64, Format.ImageDirectoryEntry.Resource);
assert.strictEqual(resourceSection, null, 'Unpopulated resource directory entry must return null block');
const exportSection = findSectionByEntry(bin64, dos64, nt64, Format.ImageDirectoryEntry.Export);
assert.strictEqual(exportSection, null, 'Unpopulated export directory entry must return null block');
console.log('All resedit.Format contract assertions passed successfully.');
오리진 시더
익명