@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.
@@ -0,0 +1,259 @@
1
+ import * as i9 from '@angular/cdk/drag-drop';
2
+ import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
3
+ import * as i0 from '@angular/core';
4
+ import { Injectable, Component, ViewEncapsulation, Input, NgModule } from '@angular/core';
5
+ import * as i1 from '@angular/forms';
6
+ import { Validators, ReactiveFormsModule } from '@angular/forms';
7
+ import { from, Subject } from 'rxjs';
8
+ import { map, tap, reduce, takeUntil } from 'rxjs/operators';
9
+ import { product } from 'cartesian-product-generator';
10
+ import * as i3 from '@angular/material/button';
11
+ import { MatButtonModule } from '@angular/material/button';
12
+ import * as i4 from '@angular/material/menu';
13
+ import { MatMenuModule } from '@angular/material/menu';
14
+ import * as i5 from '@angular/material/form-field';
15
+ import * as i6 from '@angular/material/icon';
16
+ import { MatIconModule } from '@angular/material/icon';
17
+ import * as i7 from '@angular/common';
18
+ import { CommonModule } from '@angular/common';
19
+ import * as i8 from '@angular/material/input';
20
+ import { MatInputModule } from '@angular/material/input';
21
+ import { ClipboardModule } from '@angular/cdk/clipboard';
22
+ import { BrowserModule } from '@angular/platform-browser';
23
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
24
+
25
+ /* eslint-disable no-shadow */
26
+ var FileType;
27
+ (function (FileType) {
28
+ FileType["plaintext"] = "txt";
29
+ FileType["xml"] = "xml";
30
+ })(FileType || (FileType = {}));
31
+
32
+ const toPlaintext = (wordlist) => ({
33
+ wordlist,
34
+ contentType: 'text/plain'
35
+ });
36
+ const toXML = (wordlist) => {
37
+ const head = '<wordlist><word>';
38
+ const glue = '</word><word>';
39
+ const tail = '</word></wordlist>';
40
+ return {
41
+ wordlist: head + wordlist.replace(/\n/g, glue) + tail,
42
+ contentType: 'text/xml'
43
+ };
44
+ };
45
+
46
+ class WordlistGeneratorService {
47
+ constructor() {
48
+ //
49
+ }
50
+ generateWordlist(...charsets) {
51
+ return from(product(...charsets)).pipe(map((word) => {
52
+ return word.join('');
53
+ }));
54
+ }
55
+ }
56
+ WordlistGeneratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: WordlistGeneratorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
57
+ WordlistGeneratorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: WordlistGeneratorService, providedIn: 'root' });
58
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: WordlistGeneratorService, decorators: [{
59
+ type: Injectable,
60
+ args: [{
61
+ providedIn: 'root'
62
+ }]
63
+ }], ctorParameters: function () { return []; } });
64
+
65
+ /* eslint-disable @angular-eslint/component-selector */
66
+ class WordlistGeneratorComponent {
67
+ constructor(formBuilder, wordlistGenerator) {
68
+ this.formBuilder = formBuilder;
69
+ this.wordlistGenerator = wordlistGenerator;
70
+ this.buttonColor = '#cc7832';
71
+ this.textColor = '#cc7832';
72
+ this.displayWordlist = false;
73
+ this.fileType = FileType.plaintext;
74
+ this.fileTypes = Object.values(FileType);
75
+ this.filteredCharset = [];
76
+ this.prefix = '';
77
+ this.suffix = '';
78
+ this.unsubscribe$ = new Subject();
79
+ this.removeDuplicates = (unfiltered) => [...new Set(unfiltered)].join('');
80
+ }
81
+ ngOnInit() {
82
+ this.generateForm();
83
+ }
84
+ ngOnDestroy() {
85
+ this.unsubscribe$.next();
86
+ this.unsubscribe$.complete();
87
+ }
88
+ get charsets() {
89
+ if (this.charsetForm) {
90
+ return this.charsetForm.get('charsets');
91
+ }
92
+ return undefined;
93
+ }
94
+ addCharset() {
95
+ if (this.charsets) {
96
+ this.charsets.push(this.formBuilder.control('', Validators.required));
97
+ }
98
+ }
99
+ cloneCharset(index) {
100
+ if (this.charsets) {
101
+ const charset = this.charsets.value[index];
102
+ this.charsets.insert(index, this.formBuilder.control(charset, Validators.required));
103
+ }
104
+ }
105
+ downloadWordlist() {
106
+ if (this.charsets) {
107
+ if (this.filteredCharset !== this.filterCharset(this.charsets.value)) {
108
+ this.generateWordlist();
109
+ }
110
+ const filename = `wordlist_${this.wordsGenerated}_words_${this.charsets.length}_positions.${this.fileType}`;
111
+ this.getWordlist()
112
+ .pipe(tap((wordlist) => {
113
+ if (wordlist.length > 0) {
114
+ const parsed = this.parseWordlist(wordlist);
115
+ const file = new Blob([parsed.wordlist], {
116
+ type: parsed.contentType
117
+ });
118
+ if (window.navigator.msSaveOrOpenBlob) {
119
+ window.navigator.msSaveOrOpenBlob(file, filename);
120
+ }
121
+ else {
122
+ const a = document.createElement('a');
123
+ const url = URL.createObjectURL(file);
124
+ a.href = url;
125
+ a.download = filename;
126
+ document.body.appendChild(a);
127
+ a.click();
128
+ setTimeout(() => {
129
+ document.body.removeChild(a);
130
+ window.URL.revokeObjectURL(url);
131
+ }, 0);
132
+ }
133
+ }
134
+ }))
135
+ .subscribe();
136
+ }
137
+ }
138
+ drop(event) {
139
+ if (this.charsets) {
140
+ moveItemInArray(this.charsets.controls, event.previousIndex, event.currentIndex);
141
+ this.charsets.updateValueAndValidity();
142
+ }
143
+ }
144
+ generateForm() {
145
+ this.charsetForm = this.formBuilder.group({
146
+ charsets: this.formBuilder.array([
147
+ this.formBuilder.control('', Validators.required)
148
+ ]),
149
+ prefix: this.formBuilder.control(''),
150
+ suffix: this.formBuilder.control('')
151
+ });
152
+ }
153
+ generateWordlist() {
154
+ var _a, _b, _c, _d;
155
+ if (this.charsetForm && this.charsets && this.charsets.valid) {
156
+ this.filteredCharset = this.filterCharset(this.charsets.value);
157
+ this.prefix = ((_a = this.charsetForm.get('prefix')) === null || _a === void 0 ? void 0 : _a.value)
158
+ ? (_b = this.charsetForm.get('prefix')) === null || _b === void 0 ? void 0 : _b.value
159
+ : '';
160
+ this.suffix = ((_c = this.charsetForm.get('suffix')) === null || _c === void 0 ? void 0 : _c.value)
161
+ ? (_d = this.charsetForm.get('suffix')) === null || _d === void 0 ? void 0 : _d.value
162
+ : '';
163
+ this.wordsGenerated = this.filteredCharset
164
+ .map((charset) => charset.length)
165
+ .reduce((previousLength, currentLength) => previousLength * currentLength);
166
+ this.displayWordlist = this.wordsGenerated <= 100;
167
+ this.wordlist$ = this.getWordlist();
168
+ }
169
+ }
170
+ getWordlist() {
171
+ return this.wordlistGenerator
172
+ .generateWordlist(...this.filteredCharset)
173
+ .pipe(reduce((wordlist, word) => `${wordlist}${this.prefix}${word}${this.suffix}\n`, ''), takeUntil(this.unsubscribe$));
174
+ }
175
+ filterCharset(charsets) {
176
+ return charsets.map((charset) => this.removeDuplicates(charset));
177
+ }
178
+ parseWordlist(wordlist) {
179
+ switch (this.fileType) {
180
+ case FileType.plaintext:
181
+ return toPlaintext(wordlist);
182
+ case FileType.xml:
183
+ return toXML(wordlist);
184
+ }
185
+ }
186
+ removeCharset(i) {
187
+ if (this.charsets && this.charsets.length > 1) {
188
+ this.charsets.removeAt(i);
189
+ }
190
+ }
191
+ }
192
+ WordlistGeneratorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: WordlistGeneratorComponent, deps: [{ token: i1.FormBuilder }, { token: WordlistGeneratorService }], target: i0.ɵɵFactoryTarget.Component });
193
+ WordlistGeneratorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: WordlistGeneratorComponent, selector: "wordlist-generator", inputs: { buttonColor: "buttonColor", textColor: "textColor" }, ngImport: i0, 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.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.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i4.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i7.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.MatLabel, selector: "mat-label" }, { type: i8.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.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.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i9.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.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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }], pipes: { "async": i7.AsyncPipe }, encapsulation: i0.ViewEncapsulation.None });
194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: WordlistGeneratorComponent, decorators: [{
195
+ type: Component,
196
+ args: [{
197
+ selector: 'wordlist-generator',
198
+ templateUrl: './wordlist-generator.component.html',
199
+ styleUrls: ['./wordlist-generator.component.scss'],
200
+ encapsulation: ViewEncapsulation.None
201
+ }]
202
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: WordlistGeneratorService }]; }, propDecorators: { buttonColor: [{
203
+ type: Input
204
+ }], textColor: [{
205
+ type: Input
206
+ }] } });
207
+
208
+ class WordlistGeneratorModule {
209
+ }
210
+ WordlistGeneratorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: WordlistGeneratorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
211
+ WordlistGeneratorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: WordlistGeneratorModule, declarations: [WordlistGeneratorComponent], imports: [CommonModule,
212
+ BrowserModule,
213
+ BrowserAnimationsModule,
214
+ DragDropModule,
215
+ ReactiveFormsModule,
216
+ ClipboardModule,
217
+ MatIconModule,
218
+ MatInputModule,
219
+ MatMenuModule,
220
+ MatButtonModule], exports: [WordlistGeneratorComponent] });
221
+ WordlistGeneratorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: WordlistGeneratorModule, providers: [WordlistGeneratorService], imports: [[
222
+ CommonModule,
223
+ BrowserModule,
224
+ BrowserAnimationsModule,
225
+ DragDropModule,
226
+ ReactiveFormsModule,
227
+ ClipboardModule,
228
+ MatIconModule,
229
+ MatInputModule,
230
+ MatMenuModule,
231
+ MatButtonModule
232
+ ]] });
233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0, type: WordlistGeneratorModule, decorators: [{
234
+ type: NgModule,
235
+ args: [{
236
+ declarations: [WordlistGeneratorComponent],
237
+ imports: [
238
+ CommonModule,
239
+ BrowserModule,
240
+ BrowserAnimationsModule,
241
+ DragDropModule,
242
+ ReactiveFormsModule,
243
+ ClipboardModule,
244
+ MatIconModule,
245
+ MatInputModule,
246
+ MatMenuModule,
247
+ MatButtonModule
248
+ ],
249
+ exports: [WordlistGeneratorComponent],
250
+ providers: [WordlistGeneratorService]
251
+ }]
252
+ }] });
253
+
254
+ /**
255
+ * Generated bundle index. Do not edit.
256
+ */
257
+
258
+ export { WordlistGeneratorComponent, WordlistGeneratorModule };
259
+ //# sourceMappingURL=tehw0lf-wordlist-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tehw0lf-wordlist-generator.js","sources":["../../../../libs/wordlist-generator/src/lib/filetypes.ts","../../../../libs/wordlist-generator/src/lib/parsers.ts","../../../../libs/wordlist-generator/src/lib/wordlist-generator.service.ts","../../../../libs/wordlist-generator/src/lib/wordlist-generator.component.ts","../../../../libs/wordlist-generator/src/lib/wordlist-generator.component.html","../../../../libs/wordlist-generator/src/lib/wordlist-generator.module.ts","../../../../libs/wordlist-generator/src/tehw0lf-wordlist-generator.ts"],"sourcesContent":["/* eslint-disable no-shadow */\nexport enum FileType {\n plaintext = 'txt',\n xml = 'xml'\n}\n","export const toPlaintext = (\n wordlist: string\n): { wordlist: string; contentType: string } => ({\n wordlist,\n contentType: 'text/plain'\n});\n\nexport const toXML = (\n wordlist: string\n): { wordlist: string; contentType: string } => {\n const head = '<wordlist><word>';\n const glue = '</word><word>';\n const tail = '</word></wordlist>';\n return {\n wordlist: head + wordlist.replace(/\\n/g, glue) + tail,\n contentType: 'text/xml'\n };\n};\n","import { Injectable } from '@angular/core';\nimport { product } from 'cartesian-product-generator';\nimport { from, Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class WordlistGeneratorService {\n constructor() {\n //\n }\n\n generateWordlist(...charsets: string[]): Observable<string> {\n return from(product(...charsets)).pipe(\n map((word: string[]) => {\n return word.join('');\n })\n );\n }\n}\n","import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';\nimport { Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';\nimport { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';\nimport { Observable, Subject } from 'rxjs';\nimport { reduce, takeUntil, tap } from 'rxjs/operators';\n\nimport { FileType } from './filetypes';\nimport { toPlaintext, toXML } from './parsers';\nimport { WordlistGeneratorService } from './wordlist-generator.service';\n\n/* eslint-disable @angular-eslint/component-selector */\n@Component({\n selector: 'wordlist-generator',\n templateUrl: './wordlist-generator.component.html',\n styleUrls: ['./wordlist-generator.component.scss'],\n encapsulation: ViewEncapsulation.None\n})\nexport class WordlistGeneratorComponent implements OnInit, OnDestroy {\n @Input() buttonColor = '#cc7832';\n @Input() textColor = '#cc7832';\n\n charsetForm: FormGroup | undefined;\n wordsGenerated: number | undefined;\n wordlist$: Observable<string> | undefined;\n\n displayWordlist = false;\n fileType = FileType.plaintext;\n fileTypes = Object.values(FileType);\n filteredCharset: string[] = [];\n prefix = '';\n suffix = '';\n\n private unsubscribe$ = new Subject<void>();\n\n constructor(\n private formBuilder: FormBuilder,\n private wordlistGenerator: WordlistGeneratorService\n ) {}\n\n ngOnInit(): void {\n this.generateForm();\n }\n\n ngOnDestroy(): void {\n this.unsubscribe$.next();\n this.unsubscribe$.complete();\n }\n\n get charsets(): FormArray | undefined {\n if (this.charsetForm) {\n return this.charsetForm.get('charsets') as FormArray;\n }\n return undefined;\n }\n\n addCharset(): void {\n if (this.charsets) {\n this.charsets.push(this.formBuilder.control('', Validators.required));\n }\n }\n\n cloneCharset(index: number): void {\n if (this.charsets) {\n const charset = this.charsets.value[index];\n this.charsets.insert(\n index,\n this.formBuilder.control(charset, Validators.required)\n );\n }\n }\n\n downloadWordlist(): void {\n if (this.charsets) {\n if (this.filteredCharset !== this.filterCharset(this.charsets.value)) {\n this.generateWordlist();\n }\n const filename = `wordlist_${this.wordsGenerated}_words_${this.charsets.length}_positions.${this.fileType}`;\n this.getWordlist()\n .pipe(\n tap((wordlist: string) => {\n if (wordlist.length > 0) {\n const parsed = this.parseWordlist(wordlist);\n const file = new Blob([parsed.wordlist], {\n type: parsed.contentType\n });\n if ((window.navigator as any).msSaveOrOpenBlob) {\n (window.navigator as any).msSaveOrOpenBlob(file, filename);\n } else {\n const a = document.createElement('a');\n const url = URL.createObjectURL(file);\n a.href = url;\n a.download = filename;\n document.body.appendChild(a);\n a.click();\n setTimeout(() => {\n document.body.removeChild(a);\n window.URL.revokeObjectURL(url);\n }, 0);\n }\n }\n })\n )\n .subscribe();\n }\n }\n\n drop(event: CdkDragDrop<string[]>): void {\n if (this.charsets) {\n moveItemInArray(\n this.charsets.controls,\n event.previousIndex,\n event.currentIndex\n );\n this.charsets.updateValueAndValidity();\n }\n }\n\n generateForm(): void {\n this.charsetForm = this.formBuilder.group({\n charsets: this.formBuilder.array([\n this.formBuilder.control('', Validators.required)\n ]),\n prefix: this.formBuilder.control(''),\n suffix: this.formBuilder.control('')\n });\n }\n\n generateWordlist(): void {\n if (this.charsetForm && this.charsets && this.charsets.valid) {\n this.filteredCharset = this.filterCharset(this.charsets.value);\n this.prefix = this.charsetForm.get('prefix')?.value\n ? this.charsetForm.get('prefix')?.value\n : '';\n this.suffix = this.charsetForm.get('suffix')?.value\n ? this.charsetForm.get('suffix')?.value\n : '';\n\n this.wordsGenerated = this.filteredCharset\n .map((charset: string) => charset.length)\n .reduce(\n (previousLength: number, currentLength: number) =>\n previousLength * currentLength\n );\n this.displayWordlist = this.wordsGenerated <= 100;\n this.wordlist$ = this.getWordlist();\n }\n }\n\n getWordlist(): Observable<string> {\n return this.wordlistGenerator\n .generateWordlist(...this.filteredCharset)\n .pipe(\n reduce(\n (wordlist: string, word: string) =>\n `${wordlist}${this.prefix}${word}${this.suffix}\\n`,\n ''\n ),\n takeUntil(this.unsubscribe$)\n );\n }\n\n filterCharset(charsets: string[]): string[] {\n return charsets.map((charset: string) => this.removeDuplicates(charset));\n }\n\n parseWordlist(wordlist: string): { wordlist: string; contentType: string } {\n switch (this.fileType) {\n case FileType.plaintext:\n return toPlaintext(wordlist);\n case FileType.xml:\n return toXML(wordlist);\n }\n }\n\n removeCharset(i: number): void {\n if (this.charsets && this.charsets.length > 1) {\n this.charsets.removeAt(i);\n }\n }\n\n removeDuplicates = (unfiltered: string): string =>\n [...new Set(unfiltered)].join('');\n}\n","<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","import { ClipboardModule } from '@angular/cdk/clipboard';\nimport { DragDropModule } from '@angular/cdk/drag-drop';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations';\n\nimport { WordlistGeneratorComponent } from './wordlist-generator.component';\nimport { WordlistGeneratorService } from './wordlist-generator.service';\n\n@NgModule({\n declarations: [WordlistGeneratorComponent],\n imports: [\n CommonModule,\n BrowserModule,\n BrowserAnimationsModule,\n DragDropModule,\n ReactiveFormsModule,\n ClipboardModule,\n MatIconModule,\n MatInputModule,\n MatMenuModule,\n MatButtonModule\n ],\n exports: [WordlistGeneratorComponent],\n providers: [WordlistGeneratorService]\n})\nexport class WordlistGeneratorModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,uBAAW,CAAA;AACb,CAAC,EAHW,QAAQ,KAAR,QAAQ;;ACDb,MAAM,WAAW,GAAG,CACzB,QAAgB,MAC+B;IAC/C,QAAQ;IACR,WAAW,EAAE,YAAY;CAC1B,CAAC,CAAC;AAEI,MAAM,KAAK,GAAG,CACnB,QAAgB;IAEhB,MAAM,IAAI,GAAG,kBAAkB,CAAC;IAChC,MAAM,IAAI,GAAG,eAAe,CAAC;IAC7B,MAAM,IAAI,GAAG,oBAAoB,CAAC;IAClC,OAAO;QACL,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAI;QACrD,WAAW,EAAE,UAAU;KACxB,CAAC;AACJ,CAAC;;MCTY,wBAAwB;IACnC;;KAEC;IAED,gBAAgB,CAAC,GAAG,QAAkB;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CACpC,GAAG,CAAC,CAAC,IAAc;YACjB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACtB,CAAC,CACH,CAAC;KACH;;sHAXU,wBAAwB;0HAAxB,wBAAwB,cAFvB,MAAM;4FAEP,wBAAwB;k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AAC;oBACrC,SAAS,EAAE,CAAC,wBAAwB,CAAC;iBACtC;;;AC/BD;;;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './lib/wordlist-generator.component';
2
+ export * from './lib/wordlist-generator.module';
@@ -0,0 +1,4 @@
1
+ export declare enum FileType {
2
+ plaintext = "txt",
3
+ xml = "xml"
4
+ }
@@ -0,0 +1,8 @@
1
+ export declare const toPlaintext: (wordlist: string) => {
2
+ wordlist: string;
3
+ contentType: string;
4
+ };
5
+ export declare const toXML: (wordlist: string) => {
6
+ wordlist: string;
7
+ contentType: string;
8
+ };
@@ -0,0 +1,43 @@
1
+ import { CdkDragDrop } from '@angular/cdk/drag-drop';
2
+ import { OnDestroy, OnInit } from '@angular/core';
3
+ import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
4
+ import { Observable } from 'rxjs';
5
+ import { FileType } from './filetypes';
6
+ import { WordlistGeneratorService } from './wordlist-generator.service';
7
+ import * as i0 from "@angular/core";
8
+ export declare class WordlistGeneratorComponent implements OnInit, OnDestroy {
9
+ private formBuilder;
10
+ private wordlistGenerator;
11
+ buttonColor: string;
12
+ textColor: string;
13
+ charsetForm: FormGroup | undefined;
14
+ wordsGenerated: number | undefined;
15
+ wordlist$: Observable<string> | undefined;
16
+ displayWordlist: boolean;
17
+ fileType: FileType;
18
+ fileTypes: FileType[];
19
+ filteredCharset: string[];
20
+ prefix: string;
21
+ suffix: string;
22
+ private unsubscribe$;
23
+ constructor(formBuilder: FormBuilder, wordlistGenerator: WordlistGeneratorService);
24
+ ngOnInit(): void;
25
+ ngOnDestroy(): void;
26
+ get charsets(): FormArray | undefined;
27
+ addCharset(): void;
28
+ cloneCharset(index: number): void;
29
+ downloadWordlist(): void;
30
+ drop(event: CdkDragDrop<string[]>): void;
31
+ generateForm(): void;
32
+ generateWordlist(): void;
33
+ getWordlist(): Observable<string>;
34
+ filterCharset(charsets: string[]): string[];
35
+ parseWordlist(wordlist: string): {
36
+ wordlist: string;
37
+ contentType: string;
38
+ };
39
+ removeCharset(i: number): void;
40
+ removeDuplicates: (unfiltered: string) => string;
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<WordlistGeneratorComponent, never>;
42
+ static ɵcmp: i0.ɵɵComponentDeclaration<WordlistGeneratorComponent, "wordlist-generator", never, { "buttonColor": "buttonColor"; "textColor": "textColor"; }, {}, never, never>;
43
+ }
@@ -0,0 +1,17 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./wordlist-generator.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@angular/platform-browser";
5
+ import * as i4 from "@angular/platform-browser/animations";
6
+ import * as i5 from "@angular/cdk/drag-drop";
7
+ import * as i6 from "@angular/forms";
8
+ import * as i7 from "@angular/cdk/clipboard";
9
+ import * as i8 from "@angular/material/icon";
10
+ import * as i9 from "@angular/material/input";
11
+ import * as i10 from "@angular/material/menu";
12
+ import * as i11 from "@angular/material/button";
13
+ export declare class WordlistGeneratorModule {
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<WordlistGeneratorModule, never>;
15
+ static ɵmod: i0.ɵɵNgModuleDeclaration<WordlistGeneratorModule, [typeof i1.WordlistGeneratorComponent], [typeof i2.CommonModule, typeof i3.BrowserModule, typeof i4.BrowserAnimationsModule, typeof i5.DragDropModule, typeof i6.ReactiveFormsModule, typeof i7.ClipboardModule, typeof i8.MatIconModule, typeof i9.MatInputModule, typeof i10.MatMenuModule, typeof i11.MatButtonModule], [typeof i1.WordlistGeneratorComponent]>;
16
+ static ɵinj: i0.ɵɵInjectorDeclaration<WordlistGeneratorModule>;
17
+ }
@@ -0,0 +1,8 @@
1
+ import { Observable } from 'rxjs';
2
+ import * as i0 from "@angular/core";
3
+ export declare class WordlistGeneratorService {
4
+ constructor();
5
+ generateWordlist(...charsets: string[]): Observable<string>;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<WordlistGeneratorService, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<WordlistGeneratorService>;
8
+ }
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@tehw0lf/wordlist-generator",
3
+ "version": "0.0.1",
4
+ "license": "MIT",
5
+ "homepage": "https://github.com/tehw0lf/tehwol.fi.git",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/tehw0lf/tehwol.fi.git"
9
+ },
10
+ "peerDependencies": {
11
+ "@angular/common": "^12.2.11",
12
+ "@angular/core": "^12.2.11",
13
+ "@angular/cdk": "^12.2.11",
14
+ "@angular/forms": "^12.2.11",
15
+ "@angular/material": "^12.2.11",
16
+ "@angular/platform-browser": "^12.2.11"
17
+ },
18
+ "dependencies": {
19
+ "tslib": "^2.2.0"
20
+ },
21
+ "main": "bundles/tehw0lf-wordlist-generator.umd.js",
22
+ "module": "fesm2015/tehw0lf-wordlist-generator.js",
23
+ "es2015": "fesm2015/tehw0lf-wordlist-generator.js",
24
+ "esm2015": "esm2015/tehw0lf-wordlist-generator.js",
25
+ "fesm2015": "fesm2015/tehw0lf-wordlist-generator.js",
26
+ "typings": "tehw0lf-wordlist-generator.d.ts",
27
+ "sideEffects": false
28
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@tehw0lf/wordlist-generator" />
5
+ export * from './index';