{"id":14978559,"url":"https://github.com/etiktin/generate-evb","last_synced_at":"2025-10-28T11:30:25.450Z","repository":{"id":34712755,"uuid":"38689301","full_name":"etiktin/generate-evb","owner":"etiktin","description":":memo: :package: Generate an \"Enigma Virtual Box\" project file","archived":false,"fork":false,"pushed_at":"2022-02-11T18:19:53.000Z","size":94,"stargazers_count":21,"open_issues_count":4,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-01T14:13:54.662Z","etag":null,"topics":["enigma-virtual-box","evb","nodejs","npm-package","windows"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/etiktin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-07T13:26:13.000Z","updated_at":"2024-10-23T21:12:59.000Z","dependencies_parsed_at":"2022-08-28T11:11:06.941Z","dependency_job_id":null,"html_url":"https://github.com/etiktin/generate-evb","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etiktin%2Fgenerate-evb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etiktin%2Fgenerate-evb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etiktin%2Fgenerate-evb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etiktin%2Fgenerate-evb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/etiktin","download_url":"https://codeload.github.com/etiktin/generate-evb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238638154,"owners_count":19505546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["enigma-virtual-box","evb","nodejs","npm-package","windows"],"created_at":"2024-09-24T13:57:54.457Z","updated_at":"2025-10-28T11:30:20.173Z","avatar_url":"https://github.com/etiktin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# generate-evb\n\n[![npm version](https://img.shields.io/npm/v/generate-evb.svg)](https://www.npmjs.com/package/generate-evb)\n[![david dependencies](https://img.shields.io/david/etiktin/generate-evb.svg)](https://raw.githubusercontent.com/etiktin/generate-evb/master/package.json)\n[![node engine](https://img.shields.io/node/v/generate-evb.svg)](https://raw.githubusercontent.com/etiktin/generate-evb/master/package.json)\n[![npm license](https://img.shields.io/npm/l/generate-evb.svg)](https://raw.githubusercontent.com/etiktin/generate-evb/master/LICENSE)\n\n## Goal\nTo help you automate the process of generating an 'Enigma Virtual Box' project file (*.evb) as part of your normal build\nstage.\n\n## Overview\n[Enigma Virtual Box](http://enigmaprotector.com/en/aboutvb.html) (EVB) is a tool that lets you package a Windows \nexecutable with all of the data and dependencies it needs in-order to run (dll files, assets, registry entries\netc.). The tool takes care of all the virtualization, so you usually don't need to change your code in any way. The\npackaged executable can read/execute files that were packed with it as if they were really in the file system and not\nvirtualized (e.g. if you packed `./images/logo.png`, you can read the file from that path).\n\nTo create a packaged executable you need to create a project file that describes what needs to be packaged along with\nsome other virtualization attributes. The tool offers only a GUI for creating the project and there's no built-in\nsupport for recursively packing an entire directory. In other words, if files were changed in one of the packed folders,\nyou have to update the project manually using the GUI.\n\nWe offer an alternative. You can use `generate-evb` in your node build script, to pack an entire directory structure. To\nupdate the project file, you just re-run your build script. You can also wrap your code in a `gulp`/`grunt` task if you\nwish.\n\n## Usage\nStart by installing `generate-evb` locally:\n```sh\nnpm install generate-evb --save-dev\n```\n\nLoad the `generateEvb` function:\n```javascript\nvar generateEvb = require('generate-evb');\n```\n\nThe signature of `generateEvb` is:\n```javascript\ngenerateEvb(projectName, inputExe, outputExe, path2Pack, options);\n```\nWhere:\n- *projectName* (String) - the file path to which we want to save the generated evb file (e.g. `build/myProject.evb`)\n- *inputExe* (String) - the input executable file path. Enigma packs the files from *path2Pack* into a copy of this\nexecutable\n- *outputExe* (String) - the output executable file path. Enigma saves the packed file to this path\n- *path2Pack* (String) - the path to the directory with the content that we want to pack into the copy of *inputExe*\n- *options* (Object) - optional\n    - *filter* (Function) - optional, this function is called with the following parameters: fullPath (String), name\n    (String), isDir (Boolean) for each directory and file in *path2Pack*. The function should return `true` for any file\n    or directory you want to pack, and `false` for anything else\n    - *templatePath* (Object) - optional, will default to the templates in the `generate-evb/templates`\n        - *project* (String) - path to a project template\n        - *dir* (String) - path to a directory template\n        - *file* (String) - path to a file template\n    - *evbOptions* (Object) - optional:\n        - *deleteExtractedOnExit* (Boolean) - same as Enigma's \"File Options \u003e Delete Extracted On Exit\". defaults to\n        true\n        - *compressFiles* (Boolean) - same as Enigma's \"File Options \u003e Compress Files\". defaults to true\n        - *shareVirtualSystem* (Boolean) - same as Enigma's \"Options Tab \u003e Share virtual system to child processes\".\n        defaults to false\n        - *mapExecutableWithTemporaryFile* (Boolean) - same as Enigma's \"Options Tab \u003e Map executable files using\n        temporary file\". defaults to true\n        - *allowRunningOfVirtualExeFiles* (Boolean) - same as Enigma's \"Options Tab \u003e Allow running of virtual\n        executable files\". defaults to true\n\n## Usage example\n\nLet's say that we want to pack a Node.js project into `node.exe`. Our copy of `node.exe` is located at\n`C:/Program Files (x86)/nodejs/node.exe`, so that will be our *inputExe*. The Node.js project is located at `../foo`\n(all paths can be relative or absolute), so that's our *path2Pack*. We want to save the packaged executable to\n`build/node.exe` so that will be our *outputExe*. And we will save the evb project to `build/packedNode.evb`, so that's\nthe *projectName*.\n\nSo our script will look like this:\n\n```javascript\nvar generateEvb = require('generate-evb');\n\ngenerateEvb('build/packedNode.evb', 'C:/Program Files (x86)/nodejs/node.exe', 'build/node.exe', '../foo');\n```\nAfter we run this script we'll have the evb project file at `build/packedNode.evb`.\n\nTo pack it, we can either open the project in `enigmavb.exe` (Enigma's GUI) and click on `Process`, or we can use\n`enigmavbconsole.exe` (Enigma's CLI) to pack it (example below).\n\nHere's an example of packing the evb project using Node.js:\n```javascript\nvar fs = require('fs');\nvar child_process = require('child_process');\n\n// Change the following paths to the actual paths used in your project\nvar evbCliPath = 'C:/Program Files (x86)/Enigma Virtual Box/enigmavbconsole.exe';\nvar projectName = 'build/packedNode.evb';\nvar inputExe = 'C:/Program Files (x86)/nodejs/node.exe';\nvar outputExe = 'build/node.exe';\n\nchild_process.execFile(evbCliPath, [projectName], function (err, stdout, stderr) {\n    var success = false;\n    if (!err) {\n        // Sanity check (change this to what works for you):\n        // Check if the output file exists and if it's bigger than the input file\n        if (fs.existsSync(outputExe)) {\n            success = fs.statSync(outputExe).size \u003e fs.statSync(inputExe).size;\n        }\n\n        if (!success) {\n            err = new Error('Failed to pack EVB project!\\nEVB stdout:\\n' + stdout + '\\nEVB stderr:\\n' + stderr);\n        }\n    }\n    if (err) {\n    \tthrow err;\n    }\n});\n```\n\nIf *path2Pack* contains some files or directories you don't want to pack, you should provide a filter function. This is\nespecially true, if *path2Pack* contains *inputExe* (this is common when packing an [Electron](http://electron.atom.io/)\napp). Here's an example of how to filter out all png files:\n\n```javascript\nvar generateEvb = require('generate-evb');\n\ngenerateEvb('build/packedNode.evb', 'C:/Program Files (x86)/nodejs/node.exe', 'build/node.exe', '../foo', {\n    filter: function (fullPath, name, isDir) {\n        var pngRegexp = /.*\\.png$/i;\n        // Any directory or any file that isn't a png file, is approved\n        return isDir || !pngRegexp.test(name);\n    }\n});\n```\n\n## Customization\n\nYou can customize the generated project using *options.evbOptions*. If an option/setting you are looking for is not\navailable there (e.g. you want to add virtual registry entries), you can use custom templates.\nThe default template files are located at `generate-evb/templates`.\nBefore you change them, copy the templates to a location outside of `node_modules`.\n\nThe templates are xml files that are pretty descriptive, so for most options it should be easy to figure our what needs\nchanging. If you can't find the option, I suggest that you generate the project file using the default options and\nuse `enigmavb.exe` (Enigma's GUI) to change the options as you see fit. Then you should do a `diff` between the before\nand after, so you will see what options need changing. Then you can go back to the templates copy, and modify\naccordingly.\n\nTo make `generateEvb` use the updated templates just pass it the optional *options.templatePath* object. We will use the\ndefault templates for any missing template, so you don't have to replace all of them.\n\n## Alternatives\n\n[enigmavirtualbox](https://www.npmjs.com/package/enigmavirtualbox) is a Node.js module and CLI, that offers the\nfollowing capabilities:\n- Download and install EVB\n- Generate a project file (currently this is very limited and not customizable)\n- Pack the project file\n\nYou can use this module along with `generate-evb`, where `enigmavirtualbox` takes care of installing, packing and\n`generate-evb` takes care of generating the project file.\n\n## Problems?\n\nIf you encounter a bug, please file an [issue](https://github.com/etiktin/generate-evb/issues).\n\nSuggestions and PRs are welcome :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetiktin%2Fgenerate-evb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fetiktin%2Fgenerate-evb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetiktin%2Fgenerate-evb/lists"}