@tehw0lf/wordlist-generator 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Robert Weyres
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.
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # wordlist-generator
2
+
3
+ A wordlist generator using the cartesian product to combine custom character sets into a wordlist.
4
+
5
+ Button and text color can be specified by input parameters buttonColor and textColor.
6
+ The default color for both is <font color='#cc7832'>#cc7832</font>.
@@ -0,0 +1,610 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/drag-drop'), require('@angular/core'), require('@angular/forms'), require('rxjs'), require('rxjs/operators'), require('cartesian-product-generator'), require('@angular/material/button'), require('@angular/material/menu'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/common'), require('@angular/material/input'), require('@angular/cdk/clipboard'), require('@angular/platform-browser'), require('@angular/platform-browser/animations')) :
3
+ typeof define === 'function' && define.amd ? define('@tehw0lf/wordlist-generator', ['exports', '@angular/cdk/drag-drop', '@angular/core', '@angular/forms', 'rxjs', 'rxjs/operators', 'cartesian-product-generator', '@angular/material/button', '@angular/material/menu', '@angular/material/form-field', '@angular/material/icon', '@angular/common', '@angular/material/input', '@angular/cdk/clipboard', '@angular/platform-browser', '@angular/platform-browser/animations'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.tehw0lf = global.tehw0lf || {}, global.tehw0lf['wordlist-generator'] = {}), global.ng.cdk.dragDrop, global.ng.core, global.ng.forms, global.rxjs, global.rxjs.operators, global.cartesianProductGenerator, global.ng.material.button, global.ng.material.menu, global.ng.material.formField, global.ng.material.icon, global.ng.common, global.ng.material.input, global.ng.cdk.clipboard, global.ng.platformBrowser, global.ng.platformBrowser.animations));
5
+ }(this, (function (exports, i9, i0, i1, rxjs, operators, cartesianProductGenerator, i3, i4, i5, i6, i7, i8, clipboard, platformBrowser, animations) { 'use strict';
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () {
17
+ return e[k];
18
+ }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n['default'] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
28
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
29
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
30
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
31
+ var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
32
+ var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
33
+ var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
34
+ var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
35
+ var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
36
+
37
+ /*! *****************************************************************************
38
+ Copyright (c) Microsoft Corporation.
39
+
40
+ Permission to use, copy, modify, and/or distribute this software for any
41
+ purpose with or without fee is hereby granted.
42
+
43
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
44
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
45
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
46
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
47
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
48
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
49
+ PERFORMANCE OF THIS SOFTWARE.
50
+ ***************************************************************************** */
51
+ /* global Reflect, Promise */
52
+ var extendStatics = function (d, b) {
53
+ extendStatics = Object.setPrototypeOf ||
54
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
55
+ function (d, b) { for (var p in b)
56
+ if (Object.prototype.hasOwnProperty.call(b, p))
57
+ d[p] = b[p]; };
58
+ return extendStatics(d, b);
59
+ };
60
+ function __extends(d, b) {
61
+ if (typeof b !== "function" && b !== null)
62
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
63
+ extendStatics(d, b);
64
+ function __() { this.constructor = d; }
65
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
66
+ }
67
+ var __assign = function () {
68
+ __assign = Object.assign || function __assign(t) {
69
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
70
+ s = arguments[i];
71
+ for (var p in s)
72
+ if (Object.prototype.hasOwnProperty.call(s, p))
73
+ t[p] = s[p];
74
+ }
75
+ return t;
76
+ };
77
+ return __assign.apply(this, arguments);
78
+ };
79
+ function __rest(s, e) {
80
+ var t = {};
81
+ for (var p in s)
82
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
83
+ t[p] = s[p];
84
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
85
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
86
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
87
+ t[p[i]] = s[p[i]];
88
+ }
89
+ return t;
90
+ }
91
+ function __decorate(decorators, target, key, desc) {
92
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
93
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
94
+ r = Reflect.decorate(decorators, target, key, desc);
95
+ else
96
+ for (var i = decorators.length - 1; i >= 0; i--)
97
+ if (d = decorators[i])
98
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
99
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
100
+ }
101
+ function __param(paramIndex, decorator) {
102
+ return function (target, key) { decorator(target, key, paramIndex); };
103
+ }
104
+ function __metadata(metadataKey, metadataValue) {
105
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
106
+ return Reflect.metadata(metadataKey, metadataValue);
107
+ }
108
+ function __awaiter(thisArg, _arguments, P, generator) {
109
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
110
+ return new (P || (P = Promise))(function (resolve, reject) {
111
+ function fulfilled(value) { try {
112
+ step(generator.next(value));
113
+ }
114
+ catch (e) {
115
+ reject(e);
116
+ } }
117
+ function rejected(value) { try {
118
+ step(generator["throw"](value));
119
+ }
120
+ catch (e) {
121
+ reject(e);
122
+ } }
123
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
124
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
125
+ });
126
+ }
127
+ function __generator(thisArg, body) {
128
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
129
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
130
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
131
+ function verb(n) { return function (v) { return step([n, v]); }; }
132
+ function step(op) {
133
+ if (f)
134
+ throw new TypeError("Generator is already executing.");
135
+ while (_)
136
+ try {
137
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
138
+ return t;
139
+ if (y = 0, t)
140
+ op = [op[0] & 2, t.value];
141
+ switch (op[0]) {
142
+ case 0:
143
+ case 1:
144
+ t = op;
145
+ break;
146
+ case 4:
147
+ _.label++;
148
+ return { value: op[1], done: false };
149
+ case 5:
150
+ _.label++;
151
+ y = op[1];
152
+ op = [0];
153
+ continue;
154
+ case 7:
155
+ op = _.ops.pop();
156
+ _.trys.pop();
157
+ continue;
158
+ default:
159
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
160
+ _ = 0;
161
+ continue;
162
+ }
163
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
164
+ _.label = op[1];
165
+ break;
166
+ }
167
+ if (op[0] === 6 && _.label < t[1]) {
168
+ _.label = t[1];
169
+ t = op;
170
+ break;
171
+ }
172
+ if (t && _.label < t[2]) {
173
+ _.label = t[2];
174
+ _.ops.push(op);
175
+ break;
176
+ }
177
+ if (t[2])
178
+ _.ops.pop();
179
+ _.trys.pop();
180
+ continue;
181
+ }
182
+ op = body.call(thisArg, _);
183
+ }
184
+ catch (e) {
185
+ op = [6, e];
186
+ y = 0;
187
+ }
188
+ finally {
189
+ f = t = 0;
190
+ }
191
+ if (op[0] & 5)
192
+ throw op[1];
193
+ return { value: op[0] ? op[1] : void 0, done: true };
194
+ }
195
+ }
196
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
197
+ if (k2 === undefined)
198
+ k2 = k;
199
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
200
+ }) : (function (o, m, k, k2) {
201
+ if (k2 === undefined)
202
+ k2 = k;
203
+ o[k2] = m[k];
204
+ });
205
+ function __exportStar(m, o) {
206
+ for (var p in m)
207
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
208
+ __createBinding(o, m, p);
209
+ }
210
+ function __values(o) {
211
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
212
+ if (m)
213
+ return m.call(o);
214
+ if (o && typeof o.length === "number")
215
+ return {
216
+ next: function () {
217
+ if (o && i >= o.length)
218
+ o = void 0;
219
+ return { value: o && o[i++], done: !o };
220
+ }
221
+ };
222
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
223
+ }
224
+ function __read(o, n) {
225
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
226
+ if (!m)
227
+ return o;
228
+ var i = m.call(o), r, ar = [], e;
229
+ try {
230
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
231
+ ar.push(r.value);
232
+ }
233
+ catch (error) {
234
+ e = { error: error };
235
+ }
236
+ finally {
237
+ try {
238
+ if (r && !r.done && (m = i["return"]))
239
+ m.call(i);
240
+ }
241
+ finally {
242
+ if (e)
243
+ throw e.error;
244
+ }
245
+ }
246
+ return ar;
247
+ }
248
+ /** @deprecated */
249
+ function __spread() {
250
+ for (var ar = [], i = 0; i < arguments.length; i++)
251
+ ar = ar.concat(__read(arguments[i]));
252
+ return ar;
253
+ }
254
+ /** @deprecated */
255
+ function __spreadArrays() {
256
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
257
+ s += arguments[i].length;
258
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
259
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
260
+ r[k] = a[j];
261
+ return r;
262
+ }
263
+ function __spreadArray(to, from, pack) {
264
+ if (pack || arguments.length === 2)
265
+ for (var i = 0, l = from.length, ar; i < l; i++) {
266
+ if (ar || !(i in from)) {
267
+ if (!ar)
268
+ ar = Array.prototype.slice.call(from, 0, i);
269
+ ar[i] = from[i];
270
+ }
271
+ }
272
+ return to.concat(ar || from);
273
+ }
274
+ function __await(v) {
275
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
276
+ }
277
+ function __asyncGenerator(thisArg, _arguments, generator) {
278
+ if (!Symbol.asyncIterator)
279
+ throw new TypeError("Symbol.asyncIterator is not defined.");
280
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
281
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
282
+ function verb(n) { if (g[n])
283
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
284
+ function resume(n, v) { try {
285
+ step(g[n](v));
286
+ }
287
+ catch (e) {
288
+ settle(q[0][3], e);
289
+ } }
290
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
291
+ function fulfill(value) { resume("next", value); }
292
+ function reject(value) { resume("throw", value); }
293
+ function settle(f, v) { if (f(v), q.shift(), q.length)
294
+ resume(q[0][0], q[0][1]); }
295
+ }
296
+ function __asyncDelegator(o) {
297
+ var i, p;
298
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
299
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
300
+ }
301
+ function __asyncValues(o) {
302
+ if (!Symbol.asyncIterator)
303
+ throw new TypeError("Symbol.asyncIterator is not defined.");
304
+ var m = o[Symbol.asyncIterator], i;
305
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
306
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
307
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
308
+ }
309
+ function __makeTemplateObject(cooked, raw) {
310
+ if (Object.defineProperty) {
311
+ Object.defineProperty(cooked, "raw", { value: raw });
312
+ }
313
+ else {
314
+ cooked.raw = raw;
315
+ }
316
+ return cooked;
317
+ }
318
+ ;
319
+ var __setModuleDefault = Object.create ? (function (o, v) {
320
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
321
+ }) : function (o, v) {
322
+ o["default"] = v;
323
+ };
324
+ function __importStar(mod) {
325
+ if (mod && mod.__esModule)
326
+ return mod;
327
+ var result = {};
328
+ if (mod != null)
329
+ for (var k in mod)
330
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
331
+ __createBinding(result, mod, k);
332
+ __setModuleDefault(result, mod);
333
+ return result;
334
+ }
335
+ function __importDefault(mod) {
336
+ return (mod && mod.__esModule) ? mod : { default: mod };
337
+ }
338
+ function __classPrivateFieldGet(receiver, state, kind, f) {
339
+ if (kind === "a" && !f)
340
+ throw new TypeError("Private accessor was defined without a getter");
341
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
342
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
343
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
344
+ }
345
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
346
+ if (kind === "m")
347
+ throw new TypeError("Private method is not writable");
348
+ if (kind === "a" && !f)
349
+ throw new TypeError("Private accessor was defined without a setter");
350
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
351
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
352
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
353
+ }
354
+
355
+ /* eslint-disable no-shadow */
356
+ var FileType;
357
+ (function (FileType) {
358
+ FileType["plaintext"] = "txt";
359
+ FileType["xml"] = "xml";
360
+ })(FileType || (FileType = {}));
361
+
362
+ var toPlaintext = function (wordlist) { return ({
363
+ wordlist: wordlist,
364
+ contentType: 'text/plain'
365
+ }); };
366
+ var toXML = function (wordlist) {
367
+ var head = '<wordlist><word>';
368
+ var glue = '</word><word>';
369
+ var tail = '</word></wordlist>';
370
+ return {
371
+ wordlist: head + wordlist.replace(/\n/g, glue) + tail,
372
+ contentType: 'text/xml'
373
+ };
374
+ };
375
+
376
+ var WordlistGeneratorService = /** @class */ (function () {
377
+ function WordlistGeneratorService() {
378
+ //
379
+ }
380
+ WordlistGeneratorService.prototype.generateWordlist = function () {
381
+ var charsets = [];
382
+ for (var _i = 0; _i < arguments.length; _i++) {
383
+ charsets[_i] = arguments[_i];
384
+ }
385
+ return rxjs.from(cartesianProductGenerator.product.apply(void 0, __spreadArray([], __read(charsets)))).pipe(operators.map(function (word) {
386
+ return word.join('');
387
+ }));
388
+ };
389
+ return WordlistGeneratorService;
390
+ }());
391
+ WordlistGeneratorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: WordlistGeneratorService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
392
+ WordlistGeneratorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: WordlistGeneratorService, providedIn: 'root' });
393
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: WordlistGeneratorService, decorators: [{
394
+ type: i0.Injectable,
395
+ args: [{
396
+ providedIn: 'root'
397
+ }]
398
+ }], ctorParameters: function () { return []; } });
399
+
400
+ /* eslint-disable @angular-eslint/component-selector */
401
+ var WordlistGeneratorComponent = /** @class */ (function () {
402
+ function WordlistGeneratorComponent(formBuilder, wordlistGenerator) {
403
+ this.formBuilder = formBuilder;
404
+ this.wordlistGenerator = wordlistGenerator;
405
+ this.buttonColor = '#cc7832';
406
+ this.textColor = '#cc7832';
407
+ this.displayWordlist = false;
408
+ this.fileType = FileType.plaintext;
409
+ this.fileTypes = Object.values(FileType);
410
+ this.filteredCharset = [];
411
+ this.prefix = '';
412
+ this.suffix = '';
413
+ this.unsubscribe$ = new rxjs.Subject();
414
+ this.removeDuplicates = function (unfiltered) { return __spreadArray([], __read(new Set(unfiltered))).join(''); };
415
+ }
416
+ WordlistGeneratorComponent.prototype.ngOnInit = function () {
417
+ this.generateForm();
418
+ };
419
+ WordlistGeneratorComponent.prototype.ngOnDestroy = function () {
420
+ this.unsubscribe$.next();
421
+ this.unsubscribe$.complete();
422
+ };
423
+ Object.defineProperty(WordlistGeneratorComponent.prototype, "charsets", {
424
+ get: function () {
425
+ if (this.charsetForm) {
426
+ return this.charsetForm.get('charsets');
427
+ }
428
+ return undefined;
429
+ },
430
+ enumerable: false,
431
+ configurable: true
432
+ });
433
+ WordlistGeneratorComponent.prototype.addCharset = function () {
434
+ if (this.charsets) {
435
+ this.charsets.push(this.formBuilder.control('', i1.Validators.required));
436
+ }
437
+ };
438
+ WordlistGeneratorComponent.prototype.cloneCharset = function (index) {
439
+ if (this.charsets) {
440
+ var charset = this.charsets.value[index];
441
+ this.charsets.insert(index, this.formBuilder.control(charset, i1.Validators.required));
442
+ }
443
+ };
444
+ WordlistGeneratorComponent.prototype.downloadWordlist = function () {
445
+ var _this = this;
446
+ if (this.charsets) {
447
+ if (this.filteredCharset !== this.filterCharset(this.charsets.value)) {
448
+ this.generateWordlist();
449
+ }
450
+ var filename_1 = "wordlist_" + this.wordsGenerated + "_words_" + this.charsets.length + "_positions." + this.fileType;
451
+ this.getWordlist()
452
+ .pipe(operators.tap(function (wordlist) {
453
+ if (wordlist.length > 0) {
454
+ var parsed = _this.parseWordlist(wordlist);
455
+ var file = new Blob([parsed.wordlist], {
456
+ type: parsed.contentType
457
+ });
458
+ if (window.navigator.msSaveOrOpenBlob) {
459
+ window.navigator.msSaveOrOpenBlob(file, filename_1);
460
+ }
461
+ else {
462
+ var a_1 = document.createElement('a');
463
+ var url_1 = URL.createObjectURL(file);
464
+ a_1.href = url_1;
465
+ a_1.download = filename_1;
466
+ document.body.appendChild(a_1);
467
+ a_1.click();
468
+ setTimeout(function () {
469
+ document.body.removeChild(a_1);
470
+ window.URL.revokeObjectURL(url_1);
471
+ }, 0);
472
+ }
473
+ }
474
+ }))
475
+ .subscribe();
476
+ }
477
+ };
478
+ WordlistGeneratorComponent.prototype.drop = function (event) {
479
+ if (this.charsets) {
480
+ i9.moveItemInArray(this.charsets.controls, event.previousIndex, event.currentIndex);
481
+ this.charsets.updateValueAndValidity();
482
+ }
483
+ };
484
+ WordlistGeneratorComponent.prototype.generateForm = function () {
485
+ this.charsetForm = this.formBuilder.group({
486
+ charsets: this.formBuilder.array([
487
+ this.formBuilder.control('', i1.Validators.required)
488
+ ]),
489
+ prefix: this.formBuilder.control(''),
490
+ suffix: this.formBuilder.control('')
491
+ });
492
+ };
493
+ WordlistGeneratorComponent.prototype.generateWordlist = function () {
494
+ var _a, _b, _c, _d;
495
+ if (this.charsetForm && this.charsets && this.charsets.valid) {
496
+ this.filteredCharset = this.filterCharset(this.charsets.value);
497
+ this.prefix = ((_a = this.charsetForm.get('prefix')) === null || _a === void 0 ? void 0 : _a.value)
498
+ ? (_b = this.charsetForm.get('prefix')) === null || _b === void 0 ? void 0 : _b.value
499
+ : '';
500
+ this.suffix = ((_c = this.charsetForm.get('suffix')) === null || _c === void 0 ? void 0 : _c.value)
501
+ ? (_d = this.charsetForm.get('suffix')) === null || _d === void 0 ? void 0 : _d.value
502
+ : '';
503
+ this.wordsGenerated = this.filteredCharset
504
+ .map(function (charset) { return charset.length; })
505
+ .reduce(function (previousLength, currentLength) { return previousLength * currentLength; });
506
+ this.displayWordlist = this.wordsGenerated <= 100;
507
+ this.wordlist$ = this.getWordlist();
508
+ }
509
+ };
510
+ WordlistGeneratorComponent.prototype.getWordlist = function () {
511
+ var _e;
512
+ var _this = this;
513
+ return (_e = this.wordlistGenerator)
514
+ .generateWordlist.apply(_e, __spreadArray([], __read(this.filteredCharset))).pipe(operators.reduce(function (wordlist, word) { return "" + wordlist + _this.prefix + word + _this.suffix + "\n"; }, ''), operators.takeUntil(this.unsubscribe$));
515
+ };
516
+ WordlistGeneratorComponent.prototype.filterCharset = function (charsets) {
517
+ var _this = this;
518
+ return charsets.map(function (charset) { return _this.removeDuplicates(charset); });
519
+ };
520
+ WordlistGeneratorComponent.prototype.parseWordlist = function (wordlist) {
521
+ switch (this.fileType) {
522
+ case FileType.plaintext:
523
+ return toPlaintext(wordlist);
524
+ case FileType.xml:
525
+ return toXML(wordlist);
526
+ }
527
+ };
528
+ WordlistGeneratorComponent.prototype.removeCharset = function (i) {
529
+ if (this.charsets && this.charsets.length > 1) {
530
+ this.charsets.removeAt(i);
531
+ }
532
+ };
533
+ return WordlistGeneratorComponent;
534
+ }());
535
+ WordlistGeneratorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: WordlistGeneratorComponent, deps: [{ token: i1__namespace.FormBuilder }, { token: WordlistGeneratorService }], target: i0__namespace.ɵɵFactoryTarget.Component });
536
+ WordlistGeneratorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: WordlistGeneratorComponent, selector: "wordlist-generator", inputs: { buttonColor: "buttonColor", textColor: "textColor" }, ngImport: i0__namespace, template: "<div class=\"meta-container\" fxLayout=\"row wrap\">\n <div class=\"form-container\" fxLayout=\"column\" fxFlex>\n <div fxLayout=\"row wrap\">\n <button\n class=\"generate-wordlist\"\n [ngStyle]=\"{ color: buttonColor }\"\n mat-raised-button\n (click)=\"generateWordlist()\"\n >\n Generate wordlist\n </button>\n <button\n class=\"choose-format\"\n [ngStyle]=\"{ color: buttonColor }\"\n mat-raised-button\n [matMenuTriggerFor]=\"menu\"\n *ngIf=\"wordlist$\"\n >\n Choose format\n </button>\n <mat-menu #menu=\"matMenu\">\n <button\n [ngStyle]=\"{ color: buttonColor }\"\n mat-menu-item\n *ngFor=\"let type of fileTypes\"\n (click)=\"fileType = type\"\n >\n {{ type }}\n </button>\n </mat-menu>\n <button\n class=\"download-wordlist\"\n [ngStyle]=\"{ color: buttonColor }\"\n mat-raised-button\n *ngIf=\"wordlist$\"\n (click)=\"downloadWordlist()\"\n >\n Download as\n <ng-container *ngIf=\"this.fileType\">{{ this.fileType }}</ng-container>\n </button>\n </div>\n <form *ngIf=\"charsetForm\" [formGroup]=\"charsetForm\">\n <mat-form-field class=\"fix\" appearance=\"outline\">\n <mat-label [ngStyle]=\"{ color: textColor }\"\n >prefix (optional)</mat-label\n >\n <input\n matInput\n type=\"text\"\n id=\"prefix\"\n formControlName=\"prefix\"\n (keydown.enter)=\"$event.preventDefault()\"\n />\n </mat-form-field>\n <div formArrayName=\"charsets\">\n <div class=\"charset\"></div>\n <div cdkDropList (cdkDropListDropped)=\"drop($event)\">\n <div\n class=\"charset-container\"\n cdkDrag\n *ngFor=\"let charset of charsets?.controls; let i = index\"\n >\n <mat-icon class=\"drag-indicator\" [ngStyle]=\"{ color: buttonColor }\"\n >drag_indicator</mat-icon\n >\n <mat-form-field class=\"charset\" appearance=\"outline\">\n <mat-label [ngStyle]=\"{ color: textColor }\">\n character set for string position {{ i }}\n </mat-label>\n <input\n matInput\n type=\"text\"\n id=\"position-{{ i }}\"\n [formControlName]=\"i\"\n (keydown.enter)=\"$event.preventDefault()\"\n required\n />\n </mat-form-field>\n <button\n mat-raised-button\n class=\"clone-charset\"\n [ngStyle]=\"{ color: buttonColor }\"\n (click)=\"cloneCharset(i)\"\n >\n <mat-icon>content_copy</mat-icon>\n </button>\n <button\n mat-raised-button\n class=\"remove-charset\"\n [ngStyle]=\"{ color: buttonColor }\"\n (click)=\"removeCharset(i)\"\n [disabled]=\"this.charsets?.value.length === 1\"\n >\n <mat-icon>remove</mat-icon>\n </button>\n <button\n mat-raised-button\n [ngStyle]=\"{ color: buttonColor }\"\n (click)=\"addCharset()\"\n >\n <mat-icon>add</mat-icon>\n </button>\n </div>\n </div>\n </div>\n <mat-form-field class=\"fix\" appearance=\"outline\">\n <mat-label [ngStyle]=\"{ color: textColor }\"\n >suffix (optional)</mat-label\n >\n <input\n matInput\n type=\"text\"\n id=\"suffix\"\n formControlName=\"suffix\"\n (keydown.enter)=\"$event.preventDefault()\"\n />\n </mat-form-field>\n </form>\n </div>\n <div class=\"wordlist-container\" *ngIf=\"wordlist$\" fxLayout=\"column\" fxFlex>\n <ng-container *ngIf=\"displayWordlist; else wordlistTooLarge\">\n <h3 class=\"wordlist-header\">Generated wordlist:</h3>\n <code class=\"wordlist\">\n {{ wordlist$ | async }}\n </code></ng-container\n >\n <ng-template #wordlistTooLarge>\n The generated wordlist is too large to be displayed. You can still\n download it.\n </ng-template>\n </div>\n</div>\n", styles: [".meta-container{max-width:100vw}.meta-container .form-container{float:left}.meta-container .form-container .charset-container .drag-indicator{margin-right:10px}.meta-container .form-container .charset-container .clone-charset{margin:0 10px}.meta-container .form-container .charset-container .remove-charset{margin-right:10px}.meta-container .form-container .charset{width:18.875em}.meta-container .form-container .charset-container:not(:last-child) .add-charset{display:none}.meta-container .form-container .choose-format{margin:0 34px 10px;width:150px}.meta-container .form-container .generate-wordlist{margin:0 0 10px;width:150px}.meta-container .form-container .download-wordlist{margin:0 0 10px;width:150px}.meta-container .wordlist-container{max-height:80vh}.meta-container .wordlist-container .wordlist-header{margin-top:0}.meta-container .wordlist-container .wordlist{margin-left:1em;overflow-wrap:normal;width:1%}.mat-menu-panel{width:150px}.mat-form-field-appearance-outline .mat-form-field-infix{border:0;padding:1em 0 .5em}.mat-form-field-appearance-outline .mat-form-field-wrapper{padding-bottom:.25em}.mat-form-field-label{transition:none!important}.mat-form-field-should-float .mat-form-field-label-wrapper{top:-.1em;padding-top:.1em}.mat-form-field-should-float .mat-form-field-label{transition:none!important}.fix{width:21em}\n"], components: [{ type: i3__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4__namespace.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i4__namespace.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i5__namespace.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i6__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i7__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5__namespace.MatLabel, selector: "mat-label" }, { type: i8__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i1__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i1__namespace.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i9__namespace.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "id", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListAutoScrollDisabled", "cdkDropListOrientation", "cdkDropListLockAxis", "cdkDropListData", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i9__namespace.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragPreviewContainer", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i1__namespace.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }], pipes: { "async": i7__namespace.AsyncPipe }, encapsulation: i0__namespace.ViewEncapsulation.None });
537
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: WordlistGeneratorComponent, decorators: [{
538
+ type: i0.Component,
539
+ args: [{
540
+ selector: 'wordlist-generator',
541
+ templateUrl: './wordlist-generator.component.html',
542
+ styleUrls: ['./wordlist-generator.component.scss'],
543
+ encapsulation: i0.ViewEncapsulation.None
544
+ }]
545
+ }], ctorParameters: function () { return [{ type: i1__namespace.FormBuilder }, { type: WordlistGeneratorService }]; }, propDecorators: { buttonColor: [{
546
+ type: i0.Input
547
+ }], textColor: [{
548
+ type: i0.Input
549
+ }] } });
550
+
551
+ var WordlistGeneratorModule = /** @class */ (function () {
552
+ function WordlistGeneratorModule() {
553
+ }
554
+ return WordlistGeneratorModule;
555
+ }());
556
+ WordlistGeneratorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: WordlistGeneratorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
557
+ WordlistGeneratorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: WordlistGeneratorModule, declarations: [WordlistGeneratorComponent], imports: [i7.CommonModule,
558
+ platformBrowser.BrowserModule,
559
+ animations.BrowserAnimationsModule,
560
+ i9.DragDropModule,
561
+ i1.ReactiveFormsModule,
562
+ clipboard.ClipboardModule,
563
+ i6.MatIconModule,
564
+ i8.MatInputModule,
565
+ i4.MatMenuModule,
566
+ i3.MatButtonModule], exports: [WordlistGeneratorComponent] });
567
+ WordlistGeneratorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: WordlistGeneratorModule, providers: [WordlistGeneratorService], imports: [[
568
+ i7.CommonModule,
569
+ platformBrowser.BrowserModule,
570
+ animations.BrowserAnimationsModule,
571
+ i9.DragDropModule,
572
+ i1.ReactiveFormsModule,
573
+ clipboard.ClipboardModule,
574
+ i6.MatIconModule,
575
+ i8.MatInputModule,
576
+ i4.MatMenuModule,
577
+ i3.MatButtonModule
578
+ ]] });
579
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: WordlistGeneratorModule, decorators: [{
580
+ type: i0.NgModule,
581
+ args: [{
582
+ declarations: [WordlistGeneratorComponent],
583
+ imports: [
584
+ i7.CommonModule,
585
+ platformBrowser.BrowserModule,
586
+ animations.BrowserAnimationsModule,
587
+ i9.DragDropModule,
588
+ i1.ReactiveFormsModule,
589
+ clipboard.ClipboardModule,
590
+ i6.MatIconModule,
591
+ i8.MatInputModule,
592
+ i4.MatMenuModule,
593
+ i3.MatButtonModule
594
+ ],
595
+ exports: [WordlistGeneratorComponent],
596
+ providers: [WordlistGeneratorService]
597
+ }]
598
+ }] });
599
+
600
+ /**
601
+ * Generated bundle index. Do not edit.
602
+ */
603
+
604
+ exports.WordlistGeneratorComponent = WordlistGeneratorComponent;
605
+ exports.WordlistGeneratorModule = WordlistGeneratorModule;
606
+
607
+ Object.defineProperty(exports, '__esModule', { value: true });
608
+
609
+ })));
610
+ //# sourceMappingURL=tehw0lf-wordlist-generator.umd.js.map