{"_id":"postject","_rev":"3373603","name":"postject","description":"Easily inject arbitrary read-only resources into executable formats (Mach-O, PE, ELF) and use it at runtime.","dist-tags":{"latest":"1.0.0-alpha.6"},"maintainers":[{"name":"darshan.sen","email":""},{"name":"dsanders11","email":""},{"name":"nodejs-foundation","email":""},{"name":"raisinten","email":""}],"time":{"modified":"2024-08-26T02:58:07.000Z","created":"2022-09-28T06:50:35.564Z","1.0.0-alpha.6":"2023-05-19T06:25:32.487Z","1.0.0-alpha.5":"2023-03-03T11:13:44.999Z","1.0.0-alpha.4":"2023-01-10T06:36:25.138Z","1.0.0-alpha.3":"2022-10-13T08:08:26.877Z","1.0.0-alpha.1":"2022-09-28T06:50:35.564Z","1.0.0-alpha.2":"2022-09-30T12:53:19.102Z"},"users":{},"repository":{"type":"git","url":"git+ssh://git@github.com/nodejs/postject.git"},"versions":{"1.0.0-alpha.6":{"name":"postject","version":"1.0.0-alpha.6","description":"Easily inject arbitrary read-only resources into executable formats (Mach-O, PE, ELF) and use it at runtime.","license":"MIT","engines":{"node":">=14.0.0"},"repository":{"type":"git","url":"git+ssh://git@github.com/nodejs/postject.git"},"homepage":"https://github.com/nodejs/postject#readme","bin":{"postject":"dist/cli.js"},"main":"dist/api.js","scripts":{"build":"zx ./scripts/build.mjs","clean":"rimraf ./build","format":"npm run format:cpp && npm run format:js","format:cpp":"clang-format -style=chromium -i postject-api.h src/**.cpp test/**.c test/**.cpp","format:js":"prettier --write src/**.js scripts/**.mjs test/**.mjs","lint":"npm run lint:cpp && npm run lint:js","lint:cpp":"clang-format -style=chromium --dry-run --Werror postject-api.h src/**.cpp test/**.c test/**.cpp","lint:js":"prettier --check src/**.js scripts/**.mjs test/**.mjs","test":"mocha"},"dependencies":{"commander":"^9.4.0"},"devDependencies":{"chai":"^4.3.6","chai-as-promised":"^7.1.1","clang-format":"^1.8.0","esbuild":"^0.15.10","fs-extra":"^10.1.0","mocha":"^10.0.0","mocha-junit-reporter":"^2.0.2","prettier":"^2.7.1","rimraf":"^3.0.2","tempy":"^3.0.0","zx":"^7.1.1"},"gitHead":"3c4f2080ee56025716c3add0f6c03b16e2af54ff","bugs":{"url":"https://github.com/nodejs/postject/issues"},"_id":"postject@1.0.0-alpha.6","_nodeVersion":"20.1.0","_npmVersion":"9.6.4","dist":{"shasum":"9d022332272e2cfce8dea4cfce1ee6dd1b2ee135","size":1405830,"noattachment":false,"key":"/postject/-/postject-1.0.0-alpha.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/postject/download/postject-1.0.0-alpha.6.tgz"},"_npmUser":{"name":"raisinten","email":"raisinten@gmail.com"},"directories":{},"maintainers":[{"name":"darshan.sen","email":""},{"name":"dsanders11","email":""},{"name":"nodejs-foundation","email":""},{"name":"raisinten","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postject_1.0.0-alpha.6_1684477532183_0.23171243535463026"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-19T06:25:32.487Z","publish_time":1684477532487,"_source_registry_name":"default","_cnpm_publish_time":1684477532487},"1.0.0-alpha.5":{"name":"postject","version":"1.0.0-alpha.5","description":"Easily inject arbitrary read-only resources into executable formats (Mach-O, PE, ELF) and use it at runtime.","license":"MIT","engines":{"node":">=14.0.0"},"repository":{"type":"git","url":"git+ssh://git@github.com/nodejs/postject.git"},"homepage":"https://github.com/nodejs/postject#readme","bin":{"postject":"dist/cli.js"},"main":"dist/api.js","scripts":{"build":"zx ./scripts/build.mjs","clean":"rimraf ./build","format":"npm run format:cpp && npm run format:js","format:cpp":"clang-format -style=chromium -i postject-api.h src/**.cpp test/**.c test/**.cpp","format:js":"prettier --write src/**.js scripts/**.mjs test/**.mjs","lint":"npm run lint:cpp && npm run lint:js","lint:cpp":"clang-format -style=chromium --dry-run --Werror postject-api.h src/**.cpp test/**.c test/**.cpp","lint:js":"prettier --check src/**.js scripts/**.mjs test/**.mjs","test":"mocha"},"dependencies":{"commander":"^9.4.0"},"devDependencies":{"chai":"^4.3.6","chai-as-promised":"^7.1.1","clang-format":"^1.8.0","esbuild":"^0.15.10","fs-extra":"^10.1.0","mocha":"^10.0.0","mocha-junit-reporter":"^2.0.2","prettier":"^2.7.1","rimraf":"^3.0.2","tempy":"^3.0.0","zx":"^7.0.8"},"gitHead":"3edd1dd1e0690167d7db0f502620e41888b2f82e","bugs":{"url":"https://github.com/nodejs/postject/issues"},"_id":"postject@1.0.0-alpha.5","_nodeVersion":"14.18.2","_npmVersion":"6.14.15","dist":{"shasum":"d6d6195381e910e59023b496e9163bc406c71317","size":1412536,"noattachment":false,"key":"/postject/-/postject-1.0.0-alpha.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/postject/download/postject-1.0.0-alpha.5.tgz"},"_npmUser":{"name":"raisinten","email":"raisinten@gmail.com"},"directories":{},"maintainers":[{"name":"darshan.sen","email":""},{"name":"dsanders11","email":""},{"name":"nodejs-foundation","email":""},{"name":"raisinten","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postject_1.0.0-alpha.5_1677842024738_0.4803164254412884"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-03-03T11:13:44.999Z","publish_time":1677842024999,"_cnpm_publish_time":1677842024999},"1.0.0-alpha.4":{"name":"postject","version":"1.0.0-alpha.4","description":"Easily inject arbitrary read-only resources into executable formats (Mach-O, PE, ELF) and use it at runtime.","license":"MIT","engines":{"node":">=14.0.0"},"repository":{"type":"git","url":"git+ssh://git@github.com/postmanlabs/postject.git"},"homepage":"https://github.com/postmanlabs/postject#readme","author":{"name":"Postman Labs","email":"help@postman.com","url":"="},"bin":{"postject":"dist/cli.js"},"main":"dist/api.js","scripts":{"build":"zx ./scripts/build.mjs","clean":"rimraf ./build","format":"npm run format:cpp && npm run format:js","format:cpp":"clang-format -style=chromium -i postject-api.h src/**.cpp test/**.c test/**.cpp","format:js":"prettier --write src/**.js scripts/**.mjs test/**.mjs","lint":"npm run lint:cpp && npm run lint:js","lint:cpp":"clang-format -style=chromium --dry-run --Werror postject-api.h src/**.cpp test/**.c test/**.cpp","lint:js":"prettier --check src/**.js scripts/**.mjs test/**.mjs","test":"mocha"},"dependencies":{"commander":"^9.4.0"},"devDependencies":{"chai":"^4.3.6","chai-as-promised":"^7.1.1","clang-format":"^1.8.0","esbuild":"^0.15.10","fs-extra":"^10.1.0","mocha":"^10.0.0","mocha-junit-reporter":"^2.0.2","prettier":"^2.7.1","rimraf":"^3.0.2","tempy":"^3.0.0","zx":"^7.0.8"},"gitHead":"35343439cac8c488f2596d7c4c1dddfec1fddcae","bugs":{"url":"https://github.com/postmanlabs/postject/issues"},"_id":"postject@1.0.0-alpha.4","_nodeVersion":"14.18.2","_npmVersion":"6.14.15","dist":{"shasum":"a275053a6ba832351a47dbc5eb0b94e3eee0a537","size":1412402,"noattachment":false,"key":"/postject/-/postject-1.0.0-alpha.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/postject/download/postject-1.0.0-alpha.4.tgz"},"_npmUser":{"name":"raisinten","email":"raisinten@gmail.com"},"directories":{},"maintainers":[{"name":"darshan.sen","email":""},{"name":"dsanders11","email":""},{"name":"nodejs-foundation","email":""},{"name":"raisinten","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postject_1.0.0-alpha.4_1673332584868_0.27629113721278586"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-01-10T06:36:25.138Z","publish_time":1673332585138,"_cnpm_publish_time":1673332585138},"1.0.0-alpha.3":{"name":"postject","version":"1.0.0-alpha.3","description":"Easily inject arbitrary read-only resources into executable formats (Mach-O, PE, ELF) and use it at runtime.","license":"MIT","engines":{"node":">=14.0.0"},"repository":{"type":"git","url":"git+ssh://git@github.com/postmanlabs/postject.git"},"homepage":"https://github.com/postmanlabs/postject#readme","author":{"name":"Postman Labs","email":"help@postman.com","url":"="},"bin":{"postject":"dist/cli.js"},"main":"dist/api.js","scripts":{"build":"zx ./scripts/build.mjs","clean":"rimraf ./build","format":"npm run format:cpp && npm run format:js","format:cpp":"clang-format -style=chromium -i postject-api.h src/**.cpp test/**.c test/**.cpp","format:js":"prettier --write src/**.js scripts/**.mjs test/**.mjs","lint":"npm run lint:cpp && npm run lint:js","lint:cpp":"clang-format -style=chromium --dry-run --Werror postject-api.h src/**.cpp test/**.c test/**.cpp","lint:js":"prettier --check src/**.js scripts/**.mjs test/**.mjs","test":"mocha"},"dependencies":{"commander":"^9.4.0"},"devDependencies":{"chai":"^4.3.6","chai-as-promised":"^7.1.1","clang-format":"^1.8.0","esbuild":"^0.15.10","fs-extra":"^10.1.0","mocha":"^10.0.0","mocha-junit-reporter":"^2.0.2","prettier":"^2.7.1","rimraf":"^3.0.2","tempy":"^3.0.0","zx":"^7.0.8"},"gitHead":"c8e096a29a8dac2ffa8ab6cedf4ebbb2a0e9812a","bugs":{"url":"https://github.com/postmanlabs/postject/issues"},"_id":"postject@1.0.0-alpha.3","_nodeVersion":"14.18.2","_npmVersion":"6.14.15","dist":{"shasum":"6d20a9ce18279587e0ac024756c7f75070d0fef6","size":1407376,"noattachment":false,"key":"/postject/-/postject-1.0.0-alpha.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/postject/download/postject-1.0.0-alpha.3.tgz"},"_npmUser":{"name":"raisinten","email":"raisinten@gmail.com"},"directories":{},"maintainers":[{"name":"darshan.sen","email":""},{"name":"dsanders11","email":""},{"name":"nodejs-foundation","email":""},{"name":"raisinten","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postject_1.0.0-alpha.3_1665648506607_0.14133944446028535"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-13T08:51:11.391Z","publish_time":1665648506877,"_cnpm_publish_time":1665648506877},"1.0.0-alpha.1":{"name":"postject","version":"1.0.0-alpha.1","description":"Easily inject arbitrary read-only resources into executable formats (Mach-O, PE, ELF) and use it at runtime.","license":"MIT","engines":{"node":">=14.0.0"},"repository":{"type":"git","url":"git+ssh://git@github.com/postmanlabs/postject.git"},"homepage":"https://github.com/postmanlabs/postject#readme","author":{"name":"Postman Labs","email":"help@postman.com","url":"="},"bin":{"postject":"dist/main.js"},"main":"dist/main.js","scripts":{"build":"zx ./scripts/build.mjs","clean":"rimraf ./build","format":"npm run format:cpp && npm run format:js","format:cpp":"clang-format -style=chromium -i postject-api.h src/**.cpp test/**.c test/**.cpp","format:js":"prettier --write src/**.js scripts/**.mjs test/**.mjs","lint":"npm run lint:cpp && npm run lint:js","lint:cpp":"clang-format -style=chromium --dry-run --Werror postject-api.h src/**.cpp test/**.c test/**.cpp","lint:js":"prettier --check src/**.js scripts/**.mjs test/**.mjs","test":"mocha"},"dependencies":{"commander":"^9.4.0"},"devDependencies":{"chai":"^4.3.6","chai-as-promised":"^7.1.1","clang-format":"^1.8.0","fs-extra":"^10.1.0","mocha":"^10.0.0","mocha-junit-reporter":"^2.0.2","prettier":"^2.7.1","rimraf":"^3.0.2","tempy":"^3.0.0","zx":"^7.0.8"},"gitHead":"0035c074f43185546dd65a6bffcfe78ccc96382b","bugs":{"url":"https://github.com/postmanlabs/postject/issues"},"_id":"postject@1.0.0-alpha.1","_nodeVersion":"14.18.2","_npmVersion":"6.14.15","dist":{"shasum":"8af191ee0cc9cab7d14313834fe1eaeb3b2d24a1","size":966080,"noattachment":false,"key":"/postject/-/postject-1.0.0-alpha.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/postject/download/postject-1.0.0-alpha.1.tgz"},"_npmUser":{"name":"raisinten","email":"raisinten@gmail.com"},"directories":{},"maintainers":[{"name":"darshan.sen","email":""},{"name":"dsanders11","email":""},{"name":"nodejs-foundation","email":""},{"name":"raisinten","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postject_1.0.0-alpha.1_1664347835330_0.24774752904541564"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-09-28T06:56:09.983Z","publish_time":1664347835564,"_cnpm_publish_time":1664347835564},"1.0.0-alpha.2":{"name":"postject","version":"1.0.0-alpha.2","description":"Easily inject arbitrary read-only resources into executable formats (Mach-O, PE, ELF) and use it at runtime.","license":"MIT","engines":{"node":">=14.0.0"},"repository":{"type":"git","url":"git+ssh://git@github.com/postmanlabs/postject.git"},"homepage":"https://github.com/postmanlabs/postject#readme","author":{"name":"Postman Labs","email":"help@postman.com","url":"="},"bin":{"postject":"dist/main.js"},"main":"dist/main.js","scripts":{"build":"zx ./scripts/build.mjs","clean":"rimraf ./build","format":"npm run format:cpp && npm run format:js","format:cpp":"clang-format -style=chromium -i postject-api.h src/**.cpp test/**.c test/**.cpp","format:js":"prettier --write src/**.js scripts/**.mjs test/**.mjs","lint":"npm run lint:cpp && npm run lint:js","lint:cpp":"clang-format -style=chromium --dry-run --Werror postject-api.h src/**.cpp test/**.c test/**.cpp","lint:js":"prettier --check src/**.js scripts/**.mjs test/**.mjs","test":"mocha"},"dependencies":{"commander":"^9.4.0"},"devDependencies":{"chai":"^4.3.6","chai-as-promised":"^7.1.1","clang-format":"^1.8.0","fs-extra":"^10.1.0","mocha":"^10.0.0","mocha-junit-reporter":"^2.0.2","prettier":"^2.7.1","rimraf":"^3.0.2","tempy":"^3.0.0","zx":"^7.0.8"},"gitHead":"4fe587c34f57eb7cb5d86ad627f6a3ecad2481dd","bugs":{"url":"https://github.com/postmanlabs/postject/issues"},"_id":"postject@1.0.0-alpha.2","_nodeVersion":"14.18.2","_npmVersion":"6.14.15","dist":{"shasum":"042452091aa75246b14be6daef0cf2b79115f14f","size":966409,"noattachment":false,"key":"/postject/-/postject-1.0.0-alpha.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/postject/download/postject-1.0.0-alpha.2.tgz"},"_npmUser":{"name":"raisinten","email":"raisinten@gmail.com"},"directories":{},"maintainers":[{"name":"darshan.sen","email":""},{"name":"dsanders11","email":""},{"name":"nodejs-foundation","email":""},{"name":"raisinten","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/postject_1.0.0-alpha.2_1664542398860_0.3458220934079692"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-09-30T12:54:50.898Z","publish_time":1664542399102,"_cnpm_publish_time":1664542399102}},"readme":"# postject\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/postmanlabs/postject/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/postmanlabs/postject/tree/main)\n[![npm version](http://img.shields.io/npm/v/postject.svg)](https://npmjs.org/package/postject)\n\nEasily inject arbitrary read-only resources into executable formats\n(Mach-O, PE, ELF) and use it at runtime.\n\n## Install\n\n```sh\nnpm i -g postject\n```\n\n## Usage\n\n### Command line utility\n\n```sh\n$ postject -h\nUsage: postject [options] <filename> <resource_name> <resource>\n\nInject arbitrary read-only resources into an executable for use at runtime\n\nArguments:\n  filename                             The executable to inject into\n  resource_name                        The resource name to use (section name on Mach-O and ELF, resource name for PE)\n  resource                             The resource to inject\n\nOptions:\n  --macho-segment-name <segment_name>  Name for the Mach-O segment (default: \"__POSTJECT\")\n  --output-api-header                  Output the API header to stdout\n  --overwrite                          Overwrite the resource if it already exists\n  -h, --help                           display help for command\n```\n\n### Using Programatically\n\n```js\nconst { inject } = require('postject');\n\nawait inject('a.out', 'lol', Buffer.from('Hello, world!'));\n```\n\n## Building\n\n### Prerequisites\n\n* CMake\n* Ninja\n* [Emscripten (emsdk)](https://emscripten.org/docs/getting_started/downloads.html)\n\n### Build Command\n\n```sh\n$ npm run build\n```\n\nThe final output is placed in `dist/`, with `main.js` being the\nentrypoint.\n\n### Testing\n\n```sh\n$ npm test\n```\n\n## Design\n\nTo ensure maximum capatibility and head off unforeseen issues, the\nimplementation for each format tries to use that format's standard\npractices for embedding binary data. As such, it should be possible\nto embed the binary data at build-time as well. The CLI provides the\nability to inject the resources into pre-built executables, with the\ngoal that the end result should be as close as possible to what is\nobtained by embedding them at build-time.\n\nNote: Other runtime injection implementers should search the binary\ncompiled with `postject-api.h` for the\n`POSTJECT_SENTINEL_fce680ab2cc467b6e072b8b5df1996b2:0` fuse and\nflip the last character to `1` to indicate that a resource has been\ninjected. A different fuse can also be used by defining the\n`POSTJECT_SENTINEL_FUSE` macro before including `postject-api.h` and\npassing the same string to postject with\n`--sentinel-fuse <sentinel_fuse>`.\n\n### Windows\n\nFor PE executables, the resources are added into the `.rsrc` section,\nwith the `RT_RCDATA` (raw data) type.\n\nThe build-time equivalent is adding the binary data as a resource in\nthe usual manner, such as the Resource Compiler, and marking it as\n`RT_RCDATA`.\n\nThe run-time lookup uses the `FindResource` and `LoadResource` APIs.\n\n### macOS\n\nFor Mach-O executables, the resources are added as sections inside a\nnew segment.\n\nThe build-time equivalent of embedding binary data with this approach\nuses a linker flag: `-sectcreate,__FOO,__foo,content.txt`\n\nThe run-time lookup uses APIs from `<mach-o/getsect.h>`.\n\n### Linux\n\nFor ELF executables, the resources are added as notes.\n\nThe build-time equivalent is to use a linker script.\n","_attachments":{},"homepage":"https://github.com/nodejs/postject#readme","bugs":{"url":"https://github.com/nodejs/postject/issues"},"license":"MIT"}