@corellium/corellium-cli 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. package/.gitlab-ci.yml +46 -1
  2. package/ci/gitlab-build.sh +1 -1
  3. package/coverage/cobertura-coverage.xml +9 -0
  4. package/coverage/lcov-report/base.css +224 -0
  5. package/coverage/lcov-report/block-navigation.js +87 -0
  6. package/coverage/lcov-report/favicon.png +0 -0
  7. package/coverage/lcov-report/index.html +101 -0
  8. package/coverage/lcov-report/prettify.css +1 -0
  9. package/coverage/lcov-report/prettify.js +2 -0
  10. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  11. package/coverage/lcov-report/sorter.js +196 -0
  12. package/coverage/lcov.info +0 -0
  13. package/index.js +2 -0
  14. package/node_modules/@babel/cli/node_modules/commander/package.json +22 -57
  15. package/node_modules/@babel/cli/node_modules/make-dir/package.json +57 -92
  16. package/node_modules/@babel/cli/node_modules/pify/package.json +49 -84
  17. package/node_modules/@babel/cli/node_modules/semver/package.json +15 -50
  18. package/node_modules/@babel/cli/node_modules/slash/package.json +32 -67
  19. package/node_modules/@babel/cli/package.json +33 -69
  20. package/node_modules/@corellium/client-api/package.json +10 -39
  21. package/node_modules/@jridgewell/resolve-uri/package.json +35 -74
  22. package/node_modules/@jridgewell/sourcemap-codec/package.json +38 -73
  23. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +91 -57
  24. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +1 -1
  25. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +90 -56
  26. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +1 -1
  27. package/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +5 -5
  28. package/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts +12 -5
  29. package/node_modules/@jridgewell/trace-mapping/package.json +34 -71
  30. package/node_modules/@nicolo-ribaudo/chokidar-2/package.json +17 -54
  31. package/node_modules/ansi-regex/package.json +53 -88
  32. package/node_modules/ansi-styles/package.json +54 -94
  33. package/node_modules/anymatch/package.json +23 -55
  34. package/node_modules/asynckit/package.json +40 -73
  35. package/node_modules/axios/package.json +41 -71
  36. package/node_modules/balanced-match/package.json +17 -48
  37. package/node_modules/binary-extensions/package.json +36 -72
  38. package/node_modules/brace-expansion/package.json +18 -49
  39. package/node_modules/braces/package.json +25 -75
  40. package/node_modules/call-bind/package.json +78 -124
  41. package/node_modules/chokidar/package.json +35 -73
  42. package/node_modules/cliui/package.json +48 -86
  43. package/node_modules/color-convert/package.json +20 -58
  44. package/node_modules/color-name/package.json +28 -60
  45. package/node_modules/combined-stream/package.json +14 -51
  46. package/node_modules/component-emitter/package.json +12 -44
  47. package/node_modules/concat-map/package.json +40 -88
  48. package/node_modules/convert-source-map/package.json +23 -54
  49. package/node_modules/cookiejar/package.json +11 -43
  50. package/node_modules/debug/package.json +32 -86
  51. package/node_modules/delayed-stream/package.json +14 -52
  52. package/node_modules/dotenv/package.json +32 -63
  53. package/node_modules/emoji-regex/package.json +27 -57
  54. package/node_modules/escalade/package.json +23 -58
  55. package/node_modules/fast-safe-stringify/package.json +28 -72
  56. package/node_modules/fill-range/package.json +23 -71
  57. package/node_modules/follow-redirects/package.json +37 -76
  58. package/node_modules/form-data/package.json +37 -73
  59. package/node_modules/formidable/package.json +17 -51
  60. package/node_modules/fs-readdir-recursive/package.json +15 -49
  61. package/node_modules/fs.realpath/package.json +16 -52
  62. package/node_modules/function-bind/package.json +23 -60
  63. package/node_modules/get-caller-file/package.json +22 -52
  64. package/node_modules/get-intrinsic/package.json +86 -123
  65. package/node_modules/glob/package.json +29 -67
  66. package/node_modules/glob-parent/package.json +22 -69
  67. package/node_modules/has/package.json +21 -54
  68. package/node_modules/has-symbols/package.json +99 -132
  69. package/node_modules/inflight/package.json +15 -47
  70. package/node_modules/inherits/package.json +12 -53
  71. package/node_modules/is-binary-path/package.json +38 -74
  72. package/node_modules/is-extglob/package.json +17 -51
  73. package/node_modules/is-fullwidth-code-point/package.json +40 -78
  74. package/node_modules/is-glob/package.json +21 -67
  75. package/node_modules/is-number/package.json +21 -64
  76. package/node_modules/lru-cache/package.json +22 -60
  77. package/node_modules/methods/package.json +17 -63
  78. package/node_modules/mime/package.json +15 -47
  79. package/node_modules/mime-db/package.json +20 -66
  80. package/node_modules/mime-types/package.json +15 -63
  81. package/node_modules/minimatch/package.json +20 -60
  82. package/node_modules/ms/package.json +19 -57
  83. package/node_modules/multi-progress/package.json +15 -45
  84. package/node_modules/normalize-path/package.json +20 -62
  85. package/node_modules/object-inspect/package.json +48 -80
  86. package/node_modules/once/package.json +14 -55
  87. package/node_modules/path-is-absolute/package.json +11 -46
  88. package/node_modules/picomatch/package.json +23 -59
  89. package/node_modules/progress/package.json +16 -64
  90. package/node_modules/qs/package.json +73 -104
  91. package/node_modules/readdirp/package.json +42 -82
  92. package/node_modules/require-directory/package.json +24 -56
  93. package/node_modules/safe-buffer/package.json +5 -37
  94. package/node_modules/semver/package.json +31 -69
  95. package/node_modules/side-channel/package.json +65 -97
  96. package/node_modules/string-width/package.json +54 -96
  97. package/node_modules/string_decoder/package.json +13 -46
  98. package/node_modules/strip-ansi/package.json +52 -93
  99. package/node_modules/superagent/node_modules/form-data/package.json +37 -73
  100. package/node_modules/superagent/node_modules/readable-stream/package.json +27 -59
  101. package/node_modules/superagent/package.json +8 -58
  102. package/node_modules/to-regex-range/package.json +20 -60
  103. package/node_modules/util-deprecate/package.json +14 -48
  104. package/node_modules/uuid/package.json +69 -101
  105. package/node_modules/wrap-ansi/package.json +60 -96
  106. package/node_modules/wrappy/package.json +16 -49
  107. package/node_modules/y18n/package.json +38 -72
  108. package/node_modules/yallist/package.json +15 -54
  109. package/node_modules/yargs/package.json +67 -98
  110. package/node_modules/yargs-parser/package.json +47 -82
  111. package/package.json +62 -64
  112. package/src/clients/Instance.js +4 -0
  113. package/src/commands/extensions/delete.js +2 -1
  114. package/src/commands/extensions/list.js +3 -2
  115. package/src/commands/firmware/list.js +3 -2
  116. package/src/commands/images/create.js +2 -2
  117. package/src/commands/images/delete.js +1 -0
  118. package/src/commands/images/list.js +3 -2
  119. package/src/commands/index.js +0 -2
  120. package/src/commands/{agent → instances}/apps/index.js +3 -3
  121. package/src/commands/instances/create.js +9 -3
  122. package/src/commands/{agent → instances}/file.js +2 -2
  123. package/src/commands/instances/index.js +6 -1
  124. package/src/commands/instances/input.js +52 -0
  125. package/src/commands/instances/list.js +3 -2
  126. package/src/commands/instances/upgrade.js +2 -2
  127. package/src/commands/projects/create.js +2 -2
  128. package/src/commands/projects/delete.js +2 -1
  129. package/src/commands/projects/list.js +3 -2
  130. package/src/commands/webplayer/create.js +2 -2
  131. package/src/commands/webplayer/list.js +2 -2
  132. package/src/error.js +12 -6
  133. package/src/table.js +1 -1
  134. package/src/utils.js +19 -40
  135. package/node_modules/@jridgewell/trace-mapping/src/any-map.ts +0 -166
  136. package/node_modules/@jridgewell/trace-mapping/src/binary-search.ts +0 -115
  137. package/node_modules/@jridgewell/trace-mapping/src/by-source.ts +0 -64
  138. package/node_modules/@jridgewell/trace-mapping/src/resolve.ts +0 -10
  139. package/node_modules/@jridgewell/trace-mapping/src/sort.ts +0 -45
  140. package/node_modules/@jridgewell/trace-mapping/src/sourcemap-segment.ts +0 -23
  141. package/node_modules/@jridgewell/trace-mapping/src/strip-filename.ts +0 -8
  142. package/node_modules/@jridgewell/trace-mapping/src/trace-mapping.ts +0 -405
  143. package/node_modules/@jridgewell/trace-mapping/src/types.ts +0 -90
  144. package/node_modules/generate-password/.eslintrc.yml +0 -18
  145. package/node_modules/generate-password/.github/workflows/nodejs.yml +0 -33
  146. package/node_modules/generate-password/CHANGELOG.md +0 -79
  147. package/node_modules/generate-password/LICENSE +0 -21
  148. package/node_modules/generate-password/README.md +0 -61
  149. package/node_modules/generate-password/example.js +0 -28
  150. package/node_modules/generate-password/main.js +0 -1
  151. package/node_modules/generate-password/package.json +0 -68
  152. package/node_modules/generate-password/src/generate.d.ts +0 -51
  153. package/node_modules/generate-password/src/generate.js +0 -152
  154. package/node_modules/generate-password/test/coverage.sh +0 -17
  155. package/node_modules/generate-password/test/esm.mjs +0 -13
  156. package/node_modules/generate-password/test/generator.js +0 -164
  157. package/src/clients/TrialAccount.js +0 -76
  158. package/src/commands/agent/index.js +0 -27
  159. package/src/commands/signup.js +0 -104
  160. package/test.sh +0 -2
  161. /package/src/commands/{agent → instances}/apps/install.js +0 -0
  162. /package/src/commands/{agent → instances}/ready.js +0 -0
@@ -1,79 +0,0 @@
1
- # 1.7.0 / 2021-9-9
2
- Support for named exports
3
-
4
- #### Notable Changes
5
- - [`b8c61418`](https://github.com/brendanashworth/generate-password/commit/b8c61418d69c8c90870250ef7562f34cdbe5e749) - Add support for named exports (Julian Grinblat)
6
-
7
- # 1.6.1 / 2021-7-21
8
- Fix TypeScript documentation to include string for symbols.
9
-
10
- #### Notable Changes
11
- - [`d95f213dd`](https://github.com/brendanashworth/generate-password/commit/d95f213dd27a397f9e1db6f44f180421cef09eb1) - Added string type to symbols option (Bart in 't Veld)
12
-
13
- # 1.6.0 / 2021-1-14
14
- Add specifying a list of symbols to substitute defaults.
15
-
16
- #### Notable Changes
17
- - [`f0db9f29d`](https://github.com/brendanashworth/generate-password/commit/f0db9f29d932162a6cb2d24e98297d987c1ae6d9) - respect list of symbols (Dillon Streator)
18
- - [`c1946ea44`](https://github.com/brendanashworth/generate-password/commit/c1946ea444cb632d9b507615312dfa08ef908902) - feat: Add jsdoc to ts types and export Options interface (Eddie CooRo)
19
-
20
- # 1.5.1 / 2020-2-10
21
- Add lowercase option to TypeScript file.
22
-
23
- #### Notable Changes
24
- - [`0eb0f498b`](https://github.com/brendanashworth/generate-password/commit/0eb0f498be34d98c72dd78d4423f9980ca83878a) - Add lowercase property into Options (Sunjoong Kim)
25
-
26
- # 1.5.0 / 2020-1-18
27
- Add option to disable lowercase characters in generated passwords.
28
-
29
- #### Notable Changes
30
- - [`960858c1c`](https://github.com/brendanashworth/generate-password/commit/960858c1cc7784b259c7d403ab5e26da7f5f32c0) - Document usage of lowercase, make lowercase optional, add tests (Edgardo Carreras)
31
-
32
- # 1.4.2 / 2019-6-16
33
- Includes a performance improvement in the random number generator.
34
-
35
- #### Notable Changes
36
- - [`ea642553c`](https://github.com/brendanashworth/generate-password/commit/ea642553c5ba327989f36d0b0f2d4e80ff25b45a) - Optimized fetch of random values using cache (Sebastien ROBERT)
37
-
38
- # 1.4.1 / 2018-10-28
39
- Bug fix to `randomNumber()` function that reduced entropy, resulting in a bias towards letters, generally.
40
-
41
- #### Notable Changes
42
- - [`21a12d0fd`](https://github.com/brendanashworth/generate-password/commit/21a12d0fd47c1b8f63a310da052cedf29ba5c00d) - fixed randomNumber's frontwards bias (Starkteetje)
43
-
44
- # 1.4.0 / 2018-1-20
45
- Release that includes TypeScript definitions.
46
-
47
- #### Notable Changes
48
- - [`ef2ded619`](https://github.com/brendanashworth/generate-password/commit/ef2ded6195ef72ee364172d1ff2c4d107ffe2821) - typescript definition file (Carlos Gonzales)
49
-
50
- # 1.3.0 / 2016-12-28
51
- Release with two new features.
52
-
53
- One can now pass `{ 'exclude': 'abc' }` to exclude various characters from password
54
- generation. This can be used to blacklist certain symbols, remove alike characters,
55
- etc by giving a string with all the characters to be removed.
56
-
57
- The options parameter is now optional — it is now unnecessary to pass an empty object
58
- when the defaults are desired.
59
-
60
- #### Notable Changes
61
- - [`38d4ae0b8`](https://github.com/brendanashworth/generate-password/commit/38d4ae0b8d27db7f3fef897db30143aedc530f1f) - add `exclude` option to restrict passwords (Michael Kimpton)
62
- - [`d16c95369`](https://github.com/brendanashworth/generate-password/commit/d16c9536914df599751589f6721ec506cdfbd95c) - Accept generate() when called without the options parameter (Alexandre Perrin)
63
-
64
- # 1.2.0 / 2016-9-25
65
- Release with a new feature and various improvements.
66
-
67
- `strict` is now an option that can be passed to password generation. When this is `true`,
68
- each other option will be required — for example, if you generate a password with numbers,
69
- lowercase letters, and uppercase letters, the password will have *at least one* number, one
70
- lowercase letter, and one uppercase letter.
71
-
72
- #### Notable Changes
73
- - [`98f923c0c`](https://github.com/brendanashworth/generate-password/commit/98f923c0c9af4fd7f3010b3d40c85233de437eef) - fix strict password generation (Brendan Ashworth)
74
- - [`c69e2ef6b`](https://github.com/brendanashworth/generate-password/commit/c69e2ef6bb876ba58e6b27bc1f460d6ff18cb877) - adds eslint (Brendan Ashworth)
75
- - [`a798e846c`](https://github.com/brendanashworth/generate-password/commit/a798e846c70210f6c88cbc062d8f1d4f8b808f8b) - add code coverage (Brendan Ashworth)
76
- - [`aa5e13edf`](https://github.com/brendanashworth/generate-password/commit/aa5e13edfee35852fb3a31414cbf2e8fa101e257) - Adds strict password generation (Algimantas Krasauskas)
77
-
78
- # 1.1.1 / 2014-12-23
79
- - Add `excludeSimilarCharacters` option
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014 Brendan Ashworth
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,61 +0,0 @@
1
- # Generate Password [![Build Status](https://travis-ci.org/brendanashworth/generate-password.svg?branch=master)](https://travis-ci.org/brendanashworth/generate-password) [![codecov](https://codecov.io/gh/brendanashworth/generate-password/branch/master/graph/badge.svg)](https://codecov.io/gh/brendanashworth/generate-password)
2
-
3
- [![Generate-Password NPM](https://nodei.co/npm/generate-password.png?downloads=true&downloadRank=true)](http://npmjs.org/package/generate-password)
4
-
5
- > Generate Password is a (relatively) extensive library for generating random and unique passwords.
6
-
7
- ## Install
8
-
9
- ```bash
10
- $ npm install generate-password --save
11
- ```
12
-
13
- ## Usage
14
-
15
- #### `generate([options])`
16
-
17
- Generate one password with the given options. Returns a string.
18
-
19
- ```javascript
20
- var generator = require('generate-password');
21
-
22
- var password = generator.generate({
23
- length: 10,
24
- numbers: true
25
- });
26
-
27
- // 'uEyMTw32v9'
28
- console.log(password);
29
- ```
30
-
31
- #### `generateMultiple(amount[, options])`
32
-
33
- Bulk generate multiple passwords at once, with the same options for all. Returns an array.
34
-
35
- ```javascript
36
- var generator = require('generate-password');
37
-
38
- var passwords = generator.generateMultiple(3, {
39
- length: 10,
40
- uppercase: false
41
- });
42
-
43
- // [ 'hnwulsekqn', 'qlioullgew', 'kosxwabgjv' ]
44
- console.log(passwords);
45
- ```
46
-
47
- ### Available options
48
- Any of these can be passed into the options object for each function.
49
-
50
- | Name | Description | Default Value |
51
- |--------------------------|-----------------------------------------------------------------------|---------------|
52
- | length | Integer, length of password. | 10 |
53
- | numbers* | Boolean, put numbers in password. | false |
54
- | symbols* | Boolean or String, put symbols in password. | false |
55
- | lowercase* | Boolean, put lowercase in password | true |
56
- | uppercase* | Boolean, use uppercase letters in password. | true |
57
- | excludeSimilarCharacters | Boolean, exclude similar chars, like 'i' and 'l'. | false |
58
- | exclude | String, characters to be excluded from password. | '' |
59
- | strict | Boolean, password must include at least one character from each pool. | false |
60
-
61
- *At least one should be true.
@@ -1,28 +0,0 @@
1
- /*eslint no-unused-vars: "off"*/
2
- var generator = require('./main');
3
-
4
- // Generate one password.
5
- var password = generator.generate({
6
- length: 15, // defaults to 10
7
- numbers: true, // defaults to false
8
- symbols: true, // defaults to false
9
- uppercase: true, // defaults to true
10
- strict: true // defaults to false
11
- });
12
-
13
- // Generate one password with provided list of symbols.
14
- password = generator.generate({
15
- length: 15, // defaults to 10
16
- numbers: true, // defaults to false
17
- symbols: '!@#$%&*', // defaults to false
18
- uppercase: true, // defaults to true
19
- strict: true // defaults to false
20
- });
21
-
22
- // Generate ten bulk.
23
- var passwords = generator.generateMultiple(10, {
24
- length: 15,
25
- numbers: true,
26
- symbols: true,
27
- uppercase: true
28
- });
@@ -1 +0,0 @@
1
- module.exports = require('./src/generate');
@@ -1,68 +0,0 @@
1
- {
2
- "_args": [
3
- [
4
- "generate-password@1.7.0",
5
- "/home/sam/source/corellium/corellium-cli"
6
- ]
7
- ],
8
- "_from": "generate-password@1.7.0",
9
- "_id": "generate-password@1.7.0",
10
- "_inBundle": false,
11
- "_integrity": "sha512-WPCtlfy0jexf7W5IbwxGUgpIDvsZIohbI2DAq2Q6TSlKKis+G4GT9sxvPxrZUGL8kP6WUXMWNqYnxY6DDKAdFA==",
12
- "_location": "/generate-password",
13
- "_phantomChildren": {},
14
- "_requested": {
15
- "type": "version",
16
- "registry": true,
17
- "raw": "generate-password@1.7.0",
18
- "name": "generate-password",
19
- "escapedName": "generate-password",
20
- "rawSpec": "1.7.0",
21
- "saveSpec": null,
22
- "fetchSpec": "1.7.0"
23
- },
24
- "_requiredBy": [
25
- "/"
26
- ],
27
- "_resolved": "https://registry.npmjs.org/generate-password/-/generate-password-1.7.0.tgz",
28
- "_spec": "1.7.0",
29
- "_where": "/home/sam/source/corellium/corellium-cli",
30
- "author": {
31
- "name": "Brendan Ashworth"
32
- },
33
- "bugs": {
34
- "url": "https://github.com/brendanashworth/generate-password/issues"
35
- },
36
- "description": "Easy library for generating unique passwords.",
37
- "devDependencies": {
38
- "chai": "^1.10.0",
39
- "codecov": "^3.8.3",
40
- "eslint": "^6.5.1",
41
- "jscover": "^0.1.1",
42
- "mocha": "^7.0.0",
43
- "mocha-lcov-reporter": "^1.2.0",
44
- "underscore": "^1.7.0"
45
- },
46
- "exports": "./main.js",
47
- "homepage": "https://github.com/brendanashworth/generate-password",
48
- "keywords": [
49
- "generate",
50
- "password",
51
- "generator",
52
- "unique"
53
- ],
54
- "license": "MIT",
55
- "main": "main.js",
56
- "name": "generate-password",
57
- "repository": {
58
- "type": "git",
59
- "url": "git+https://github.com/brendanashworth/generate-password.git"
60
- },
61
- "scripts": {
62
- "coverage": "sh ./test/coverage.sh",
63
- "lint": "eslint src test main.js example.js",
64
- "test": "mocha"
65
- },
66
- "types": "src/generate.d.ts",
67
- "version": "1.7.0"
68
- }
@@ -1,51 +0,0 @@
1
- export interface GenerateOptions {
2
- /**
3
- * Length of the generated password.
4
- * @default 10
5
- */
6
- length?: number;
7
- /**
8
- * Should the password include numbers
9
- * @default false
10
- */
11
- numbers?: boolean;
12
- /**
13
- * Should the password include symbols, or symbols to include
14
- * @default false
15
- */
16
- symbols?: boolean | string;
17
- /**
18
- * Should the password include lowercase characters
19
- * @default true
20
- */
21
- lowercase?: boolean;
22
- /**
23
- * Should the password include uppercase characters
24
- * @default true
25
- */
26
- uppercase?: boolean;
27
- /**
28
- * Should exclude visually similar characters like 'i' and 'I'
29
- * @default false
30
- */
31
- excludeSimilarCharacters?: boolean;
32
- /**
33
- * List of characters to be excluded from the password
34
- * @default ""
35
- */
36
- exclude?: string;
37
- /**
38
- * Password should include at least one character from each pool
39
- * @default false
40
- */
41
- strict?: boolean;
42
- }
43
-
44
- /**
45
- * Generate one password with the given options.
46
- */
47
- export function generate(options?: GenerateOptions): string;
48
- /**
49
- * Bulk generate multiple passwords at once, with the same options for all.
50
- */
51
- export function generateMultiple(count: number, options?: GenerateOptions): string[];
@@ -1,152 +0,0 @@
1
- var crypto = require('crypto');
2
-
3
- const RANDOM_BATCH_SIZE = 256;
4
-
5
- var randomIndex;
6
- var randomBytes;
7
-
8
- var getNextRandomValue = function() {
9
- if (randomIndex === undefined || randomIndex >= randomBytes.length) {
10
- randomIndex = 0;
11
- randomBytes = crypto.randomBytes(RANDOM_BATCH_SIZE);
12
- }
13
-
14
- var result = randomBytes[randomIndex];
15
- randomIndex += 1;
16
-
17
- return result;
18
- };
19
-
20
- // Generates a random number
21
- var randomNumber = function(max) {
22
- // gives a number between 0 (inclusive) and max (exclusive)
23
- var rand = getNextRandomValue();
24
- while (rand >= 256 - (256 % max)) {
25
- rand = getNextRandomValue();
26
- }
27
- return rand % max;
28
- };
29
-
30
- // Possible combinations
31
- var lowercase = 'abcdefghijklmnopqrstuvwxyz',
32
- uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
33
- numbers = '0123456789',
34
- symbols = '!@#$%^&*()+_-=}{[]|:;"/?.><,`~',
35
- similarCharacters = /[ilLI|`oO0]/g,
36
- strictRules = [
37
- { name: 'lowercase', rule: /[a-z]/ },
38
- { name: 'uppercase', rule: /[A-Z]/ },
39
- { name: 'numbers', rule: /[0-9]/ },
40
- { name: 'symbols', rule: /[!@#$%^&*()+_\-=}{[\]|:;"/?.><,`~]/ }
41
- ];
42
-
43
- var generate = function(options, pool) {
44
- var password = '',
45
- optionsLength = options.length,
46
- poolLength = pool.length;
47
-
48
- for (var i = 0; i < optionsLength; i++) {
49
- password += pool[randomNumber(poolLength)];
50
- }
51
-
52
- if (options.strict) {
53
- // Iterate over each rule, checking to see if the password works.
54
- var fitsRules = strictRules.every(function(rule) {
55
- // If the option is not checked, ignore it.
56
- if (options[rule.name] == false) return true;
57
-
58
- // Treat symbol differently if explicit string is provided
59
- if (rule.name === 'symbols' && typeof options[rule.name] === 'string') {
60
- // Create a regular expression from the provided symbols
61
- var re = new RegExp('['+options[rule.name]+']');
62
- return re.test(password);
63
- }
64
-
65
- // Run the regex on the password and return whether
66
- // or not it matches.
67
- return rule.rule.test(password);
68
- });
69
-
70
- // If it doesn't fit the rules, generate a new one (recursion).
71
- if (!fitsRules) return generate(options, pool);
72
- }
73
-
74
- return password;
75
- };
76
-
77
- // Generate a random password.
78
- module.exports.generate = function(options) {
79
- // Set defaults.
80
- options = options || {};
81
- if (!Object.prototype.hasOwnProperty.call(options, 'length')) options.length = 10;
82
- if (!Object.prototype.hasOwnProperty.call(options, 'numbers')) options.numbers = false;
83
- if (!Object.prototype.hasOwnProperty.call(options, 'symbols')) options.symbols = false;
84
- if (!Object.prototype.hasOwnProperty.call(options, 'exclude')) options.exclude = '';
85
- if (!Object.prototype.hasOwnProperty.call(options, 'uppercase')) options.uppercase = true;
86
- if (!Object.prototype.hasOwnProperty.call(options, 'lowercase')) options.lowercase = true;
87
- if (!Object.prototype.hasOwnProperty.call(options, 'excludeSimilarCharacters')) options.excludeSimilarCharacters = false;
88
- if (!Object.prototype.hasOwnProperty.call(options, 'strict')) options.strict = false;
89
-
90
- if (options.strict) {
91
- var minStrictLength = 1 + (options.numbers ? 1 : 0) + (options.symbols ? 1 : 0) + (options.uppercase ? 1 : 0);
92
- if (minStrictLength > options.length) {
93
- throw new TypeError('Length must correlate with strict guidelines');
94
- }
95
- }
96
-
97
- // Generate character pool
98
- var pool = '';
99
-
100
- // lowercase
101
- if (options.lowercase) {
102
- pool += lowercase;
103
- }
104
-
105
- // uppercase
106
- if (options.uppercase) {
107
- pool += uppercase;
108
- }
109
- // numbers
110
- if (options.numbers) {
111
- pool += numbers;
112
- }
113
- // symbols
114
- if (options.symbols) {
115
- if (typeof options.symbols === 'string') {
116
- pool += options.symbols;
117
- } else {
118
- pool += symbols;
119
- }
120
- }
121
-
122
- // Throw error if pool is empty.
123
- if (!pool) {
124
- throw new TypeError('At least one rule for pools must be true');
125
- }
126
-
127
- // similar characters
128
- if (options.excludeSimilarCharacters) {
129
- pool = pool.replace(similarCharacters, '');
130
- }
131
-
132
- // excludes characters from the pool
133
- var i = options.exclude.length;
134
- while (i--) {
135
- pool = pool.replace(options.exclude[i], '');
136
- }
137
-
138
- var password = generate(options, pool);
139
-
140
- return password;
141
- };
142
-
143
- // Generates multiple passwords at once with the same options.
144
- module.exports.generateMultiple = function(amount, options) {
145
- var passwords = [];
146
-
147
- for (var i = 0; i < amount; i++) {
148
- passwords[i] = module.exports.generate(options);
149
- }
150
-
151
- return passwords;
152
- };
@@ -1,17 +0,0 @@
1
- #!/bin/sh
2
- set -x
3
-
4
- ROOT=$PWD
5
-
6
- # Make a copy of src into src-cov, with the coverage code.
7
- $ROOT/node_modules/.bin/jscover $ROOT/src $ROOT/src-cov
8
-
9
- # Run the tests.
10
- JSCOV=1 $ROOT/node_modules/.bin/mocha -R mocha-lcov-reporter > $ROOT/coverage.lcov
11
-
12
- # Update the server with the results.
13
- $ROOT/node_modules/.bin/codecov
14
-
15
- # Clean up.
16
- rm -f $ROOT/coverage.lcov
17
- rm -rf $ROOT/src-cov
@@ -1,13 +0,0 @@
1
- import chai from 'chai';
2
- import { generate, generateMultiple } from 'generate-password';
3
-
4
- const { assert } = chai;
5
-
6
- describe('generate-password', function() {
7
- describe('import()', function() {
8
- it('should correctly import with named exports', function() {
9
- assert.isFunction(generate);
10
- assert.isFunction(generateMultiple);
11
- });
12
- });
13
- });
@@ -1,164 +0,0 @@
1
- var assert = require('chai').assert,
2
- _ = require('underscore');
3
-
4
- // We use a different require path for code coverage.
5
- var generator = process.env.JSCOV ? require('../src-cov/generate') : require('../main');
6
-
7
- describe('generate-password', function() {
8
- describe('generate()', function() {
9
- it('should accept to be called without the options parameter', function() {
10
- assert.doesNotThrow(function () {
11
- generator.generate();
12
- });
13
- });
14
- it('should give password of correct length', function() {
15
- var length = 12;
16
-
17
- var password = generator.generate({length: length});
18
-
19
- assert.equal(password.length, length);
20
- });
21
-
22
- it('should generate strict random sequence that is correct length', function() {
23
- var length = 12;
24
-
25
- var password = generator.generate({length: length, strict: true});
26
-
27
- assert.equal(password.length, length);
28
- });
29
-
30
- it('should remove possible similar characters from the sequences', function() {
31
- var password = generator.generate({length: 10000, excludeSimilarCharacters: true});
32
-
33
- assert.notMatch(password, /[ilLI|`oO0]/, 'password does not contain similar characters');
34
- });
35
-
36
- describe('strict mode', function() {
37
- // Testing randomly generated passwords and entropy isn't perfect,
38
- // thus in order to get a good sample of whether or not a rule
39
- // is passing correctly, we generate lots of passwords and check
40
- // each individually. If we're seeing spotty tests, this number should
41
- // be increased accordingly.
42
- var amountToGenerate = 500;
43
-
44
- it('should generate strict random sequence that has strictly at least one number', function() {
45
- var passwords = generator.generateMultiple(amountToGenerate, {length: 4, strict: true, uppercase: false, numbers: true});
46
-
47
- passwords.forEach(function(password) {
48
- assert.match(password, /[0-9]/, 'password has a number');
49
- });
50
- assert.equal(passwords.length, amountToGenerate);
51
- });
52
-
53
- it('should generate strict random sequence that has strictly at least one lowercase letter', function() {
54
- var passwords = generator.generateMultiple(amountToGenerate, {length: 4, strict: true, uppercase: false});
55
-
56
- passwords.forEach(function(password) {
57
- assert.match(password, /[a-z]/, 'password has a lowercase letter');
58
- });
59
- assert.equal(passwords.length, amountToGenerate);
60
- });
61
-
62
- it('should generate strict random sequence that has strictly at least one uppercase letter', function() {
63
- var passwords = generator.generateMultiple(amountToGenerate, {length: 4, strict: true, uppercase: true});
64
-
65
- passwords.forEach(function(password) {
66
- assert.match(password, /[A-Z]/, 'password has an uppercase letter');
67
- });
68
- assert.equal(passwords.length, amountToGenerate);
69
- });
70
-
71
- it('should generate strict random sequence that has strictly at least one special symbol', function() {
72
- var passwords = generator.generateMultiple(amountToGenerate, {length: 4, strict: true, symbols: true});
73
-
74
- passwords.forEach(function(password) {
75
- assert.match(password, /[!@#$%^&*()+_\-=}{[\]|:;"/?.><,`~]/, 'password has a symbol');
76
- });
77
- assert.equal(passwords.length, amountToGenerate);
78
- });
79
-
80
- it('should generate strict random sequence that avoids all excluded characters', function() {
81
- var passwords = generator.generateMultiple(amountToGenerate, {length: 4, strict: true, symbols: true, exclude: 'abcdefg+_-=}{[]|:;"/?.><,`~'});
82
-
83
- passwords.forEach(function(password) {
84
- assert.match(password, /[!@#$%^&*()]/, 'password uses normal symbols');
85
- assert.notMatch(password, /[abcdefg+_\-=}{[\]|:;"/?.><,`~]/, 'password avoids excluded characters from the full pool');
86
- });
87
- assert.equal(passwords.length, amountToGenerate);
88
- });
89
-
90
- it('should generate strict random sequence that has has no lowercase letter', function () {
91
- var passwords = generator.generateMultiple(amountToGenerate, { length: 10, strict: true, lowercase: false });
92
-
93
- passwords.forEach(function (password) {
94
- assert.notMatch(password, /[a-z]/, 'password has no lowercase letters');
95
- });
96
- assert.equal(passwords.length, amountToGenerate);
97
- });
98
-
99
- it('should generate strict random sequence that has strictly at least one lowercase, one symbol, and one uppercase letter', function () {
100
- var passwords = generator.generateMultiple(amountToGenerate, { length: 10, strict: true, uppercase: true, lowercase: true, symbols: true, numbers: true });
101
-
102
- passwords.forEach(function (password) {
103
- assert.match(password, /[a-z]/, 'password has a lowercase letter');
104
- assert.match(password, /[A-Z]/, 'password has a uppercase letter');
105
- assert.match(password, /[!@#$%^&*()+_\-=}{[\]|:;"/?.><,`~]/, 'password has a symbol');
106
- assert.match(password, /[0-9]/, 'password has a number');
107
- });
108
- assert.equal(passwords.length, amountToGenerate);
109
- });
110
-
111
- it('should respect explicit list of symbols when provided', function() {
112
- var passwords = generator.generateMultiple(amountToGenerate, { length: 10, strict: true, symbols: '!', lowercase: true });
113
-
114
- passwords.forEach(function (password) {
115
- assert.notMatch(password, /[@#$%^&*()+_\-=}{[\]|:;"/?.><,`~]/, 'password does not have default symbols');
116
- assert.match(password, /[!]/, 'password has provided symbol');
117
- });
118
- assert.equal(passwords.length, amountToGenerate);
119
- });
120
-
121
- it('should throw an error if rules don\'t correlate with length', function() {
122
- assert.throws(function() {
123
- generator.generate({length: 2, strict: true, symbols: true, numbers: true});
124
- }, TypeError, 'Length must correlate with strict guidelines');
125
- });
126
-
127
- it('should throw an error if no rules are applied', function() {
128
- assert.throws(function() {
129
- generator.generate({ length: 10, uppercase: false, lowercase: false, symbols: false, numbers: false });
130
- }, TypeError, 'At least one rule for pools must be true');
131
- });
132
-
133
- it('should generate short strict passwords without stack overflow', function(){
134
- assert.doesNotThrow(function() {
135
- generator.generate({length: 4, strict: true, uppercase: true, numbers: true, symbols: true});
136
- }, Error);
137
- });
138
- });
139
- });
140
-
141
- describe('generateMultiple()', function() {
142
- it('should accept to be called without the options parameter', function() {
143
- assert.doesNotThrow(function () {
144
- generator.generateMultiple(1);
145
- });
146
- });
147
- // should give right amount
148
- it('should give right amount of passwords', function() {
149
- var amount = 34;
150
-
151
- var passwords = generator.generateMultiple(amount);
152
-
153
- assert.equal(passwords.length, amount);
154
- });
155
-
156
- // shouldn't give duplicates in pool of 250 (extremely rare)
157
- it('should not give duplicates in pool', function() {
158
- var passwords = generator.generateMultiple(250, {length: 10, numbers: true, symbols: true});
159
-
160
- var unique = _.uniq(passwords);
161
- assert.equal(unique.length, passwords.length);
162
- });
163
- });
164
- });