Beispiel
resedit 1.7.2: NtExecutableResource
Verifiziertes Beispiel für npm resedit 1.7.2: NtExecutableResource. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.
sha256:66cda3559ffdf967654d642303f17b9f8ece882b310fcdeb3b1fcc6bd7265e55
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify resedit.NtExecutableResource in pkg:npm/resedit@1.7.2
- Pakete
- Symbole
-
- resedit.NtExecutableResource
- Umgebung
- node 22.23.2
- Erstellt
- 2026-09-06T10:27:19Z
Contract
- NtExecutableResource parses resource entries from an NtExecutable instance
- NtExecutableResource replaces and retrieves UTF-8 string resources by type, id, and language
- NtExecutableResource adds and updates raw binary resource entries
- NtExecutableResource writes modified resources into an executable and round-trips through binary generation
- NtExecutableResource removes existing resource entries by type, id, and language
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Quelltext
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.NtExecutableResource 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.NtExecutableResource
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:7650bb67fae8b1b9d25f98a0d8c0fc89ca7a1f3c3dda5b4f102bb22443b21c40","contract":["NtExecutableResource parses resource entries from an NtExecutable instance","NtExecutableResource replaces and retrieves UTF-8 string resources by type, id, and language","NtExecutableResource adds and updates raw binary resource entries","NtExecutableResource writes modified resources into an executable and round-trips through binary generation","NtExecutableResource removes existing resource entries by type, id, and language"],"goal":"verify resedit.NtExecutableResource in pkg:npm/resedit@1.7.2","kind":"HOW","packages":["pkg:npm/resedit@1.7.2"],"schemaVersion":1,"symbols":["resedit.NtExecutableResource"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/resedit@1.7.2"],"schemaVersion":1,"subject":"pkg:npm/resedit@1.7.2","symbols":["resedit.NtExecutableResource"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-resedit-nt-executable-resource",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-resedit-nt-executable-resource",
"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-nt-executable-resource",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for resedit NtExecutableResource",
"type": "module",
"main": "src/index.mjs",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"resedit": "1.7.2"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify resedit.NtExecutableResource in pkg:npm/resedit@1.7.2",
"kind": "HOW",
"packages": [
"pkg:npm/resedit@1.7.2"
],
"symbols": [
"resedit.NtExecutableResource"
]
}
import { NtExecutable, NtExecutableResource } from 'resedit';
/**
* Creates an NtExecutableResource instance from an NtExecutable.
* @param {NtExecutable} exe
* @returns {NtExecutableResource}
*/
export function createExecutableResource(exe) {
return NtExecutableResource.from(exe);
}
/**
* Sets or replaces a UTF-8 string resource entry.
* @param {NtExecutableResource} res
* @param {string | number} type
* @param {string | number} id
* @param {string | number} lang
* @param {string} value
*/
export function setStringResource(res, type, id, lang, value) {
res.replaceResourceEntryFromString(type, id, lang, value);
}
/**
* Retrieves string resources for given type and id.
* @param {NtExecutableResource} res
* @param {string | number} type
* @param {string | number} id
* @returns {Array<[string | number, string]>}
*/
export function getStringResources(res, type, id) {
return res.getResourceEntriesAsString(type, id);
}
/**
* Sets or replaces a binary resource entry.
* @param {NtExecutableResource} res
* @param {string | number} type
* @param {string | number} id
* @param {string | number} lang
* @param {ArrayBuffer | ArrayBufferView} data
*/
export function setBinaryResource(res, type, id, lang, data) {
const bin = data instanceof ArrayBuffer ? data : data.buffer;
res.replaceResourceEntry({ type, id, lang, bin });
}
/**
* Removes a resource entry by type, id, and optional lang.
* @param {NtExecutableResource} res
* @param {string | number} type
* @param {string | number} id
* @param {string | number} [lang]
*/
export function removeResource(res, type, id, lang) {
res.removeResourceEntry(type, id, lang);
}
/**
* Writes the resource section back into the executable.
* @param {NtExecutableResource} res
* @param {NtExecutable} exe
*/
export function commitResource(res, exe) {
res.outputResource(exe);
}
export { NtExecutable, NtExecutableResource };
import assert from 'node:assert';
import {
NtExecutable,
NtExecutableResource,
createExecutableResource,
setStringResource,
getStringResources,
setBinaryResource,
removeResource,
commitResource
} from '../src/index.mjs';
// 1. NtExecutableResource parses resource entries from an NtExecutable instance
{
const exe = NtExecutable.createEmpty(false, false);
assert.ok(exe, 'NtExecutable instance should be created');
const res = createExecutableResource(exe);
assert.ok(res instanceof NtExecutableResource, 'res should be an instance of NtExecutableResource');
assert.ok(Array.isArray(res.entries), 'res.entries should be an array');
}
// 2. NtExecutableResource replaces and retrieves UTF-8 string resources by type, id, and language
{
const exe = NtExecutable.createEmpty(false, false);
const res = createExecutableResource(exe);
const type = 'CUSTOM_STRING';
const id = 101;
const lang = 1033;
const text = 'Verified CodeSampleX contract string';
setStringResource(res, type, id, lang, text);
const results = getStringResources(res, type, id);
assert.strictEqual(results.length, 1, 'Should find exactly one matching string resource');
assert.strictEqual(results[0][0], lang, 'Resource language ID should match');
assert.strictEqual(results[0][1], text, 'Resource string content should match');
}
// 3. NtExecutableResource adds and updates raw binary resource entries
{
const exe = NtExecutable.createEmpty(false, false);
const res = createExecutableResource(exe);
const type = 10; // RT_RCDATA
const id = 200;
const lang = 0;
const payload = new Uint8Array([0xCA, 0xFE, 0xBA, 0xBE]);
setBinaryResource(res, type, id, lang, payload);
const entry = res.entries.find((e) => e.type === type && e.id === id && e.lang === lang);
assert.ok(entry, 'Binary resource entry should exist in entries array');
assert.deepStrictEqual(new Uint8Array(entry.bin), payload, 'Binary content should match payload');
}
// 4. NtExecutableResource writes modified resources into an executable and round-trips through binary generation
{
const exe = NtExecutable.createEmpty(false, false);
const res = createExecutableResource(exe);
const stringType = 'CONFIG';
const stringId = 301;
const lang = 1033;
const stringVal = 'persistent-configuration-value';
const binType = 10; // RT_RCDATA
const binId = 401;
const binPayload = new Uint8Array([1, 2, 3, 4, 5]);
setStringResource(res, stringType, stringId, lang, stringVal);
setBinaryResource(res, binType, binId, lang, binPayload);
commitResource(res, exe);
const binary = exe.generate();
assert.ok(binary.byteLength > 0, 'Generated PE binary should have non-zero size');
// Reload from generated binary
const reloadedExe = NtExecutable.from(binary);
const reloadedRes = createExecutableResource(reloadedExe);
const reloadedStrings = getStringResources(reloadedRes, stringType, stringId);
assert.strictEqual(reloadedStrings.length, 1);
assert.strictEqual(reloadedStrings[0][0], lang);
assert.strictEqual(reloadedStrings[0][1], stringVal);
const reloadedBinEntry = reloadedRes.entries.find((e) => e.type === binType && e.id === binId && e.lang === lang);
assert.ok(reloadedBinEntry, 'Reloaded binary resource should exist');
assert.deepStrictEqual(new Uint8Array(reloadedBinEntry.bin), binPayload);
}
// 5. NtExecutableResource removes existing resource entries by type, id, and language
{
const exe = NtExecutable.createEmpty(false, false);
const res = createExecutableResource(exe);
const type = 'TEMP_DATA';
const id = 501;
const lang = 1033;
setStringResource(res, type, id, lang, 'temporary payload');
assert.strictEqual(getStringResources(res, type, id).length, 1);
removeResource(res, type, id, lang);
assert.strictEqual(getStringResources(res, type, id).length, 0, 'Resource should be removed');
}
console.log('Contract tests passed successfully.');
Ursprungs-Seeder
anonym