Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #326

Merged
merged 6 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,89 +1,100 @@
<mat-card appearance="outlined">
<mat-card-header>

<mat-icon mat-card-avatar class="vertical-align-middle padding-bottom-3 size-45">add_circle</mat-icon>
<mat-card-title>VULNRΞPO</mat-card-title>
<mat-card-subtitle>Add custom template</mat-card-subtitle>
<h2 mat-dialog-title>
<mat-icon class="vertical-align-middle padding-bottom-3">add</mat-icon>Report Templates
</h2>

<div style="margin-left: auto;margin-right: 0;">
<button mat-raised-button color="accent" (click)="addtomaster()"><mat-icon>link</mat-icon>Save to community</button>
</div>

</mat-card-header>

<mat-card-content>
<mat-dialog-content class="mat-typography">

<div fxLayout="column" fxLayoutGap="10px grid">
<div fxLayoutAlign="start center">
<div fxLayout="column" fxLayoutGap="10px grid">
<div fxLayoutAlign="start center">
<mat-form-field class="example-full-width" color="accent">
<mat-label>Template name</mat-label>
<input matInput [formControl]="templatename" placeholder="e.g: [FPD] Full Path Disclosure">
</mat-form-field>
</div>
<div fxLayoutAlign="start center">
<mat-form-field class="example-full-width" color="accent">
<mat-label>Description</mat-label>
<textarea matInput [formControl]="description" placeholder="e.g: Full Path Disclosure (FPD) vulnerabilities enable the attacker to see the path to the webroot/file. e.g.: /home/omg/htdocs/file/. Certain vulnerabilities, such as using the load_file() (within a SQL Injection) query to view the page source, require the attacker to have the full path to the file they wish to view."></textarea>
</mat-form-field>
</div>
<div fxLayoutAlign="start center">
<mat-form-field class="example-full-width" color="accent">
<mat-label>References</mat-label>
<textarea matInput [formControl]="references" placeholder="e.g: https://owasp.org/www-community/attacks/Full_Path_Disclosure"></textarea>
</mat-form-field>
</div>
<div fxLayout="column" fxLayoutAlign="start">

<div fxLayout="row wrap" fxLayoutGap="10px grid">
<div fxLayoutAlign="start" fxFlex="50%" fxFlex.sm="50%" fxFlex.xs="100%">
<mat-form-field class="example-full-width" color="accent">
<mat-label>Template name</mat-label>
<input matInput [formControl]="templatename" placeholder="e.g: [FPD] Full Path Disclosure">
<mat-label>Select an severity</mat-label>
<mat-select [formControl]="severity">
@for (sev of tablecon; track sev) {
<mat-option [value]="sev.name">{{sev.name}}</mat-option>
}
</mat-select>
</mat-form-field>
</div>
<div fxLayoutAlign="start center">
<div fxLayoutAlign="start" fxFlex="50%" fxFlex.sm="50%" fxFlex.xs="100%">
<mat-form-field class="example-full-width" color="accent">
<mat-label>Description</mat-label>
<textarea matInput [formControl]="description" placeholder="e.g: Full Path Disclosure (FPD) vulnerabilities enable the attacker to see the path to the webroot/file. e.g.: /home/omg/htdocs/file/. Certain vulnerabilities, such as using the load_file() (within a SQL Injection) query to view the page source, require the attacker to have the full path to the file they wish to view."></textarea>
<mat-label>CVE</mat-label>
<input matInput [formControl]="cve" placeholder="CVE">
</mat-form-field>
</div>
<div fxLayoutAlign="start center">
</div>
<div fxLayout="row wrap" fxLayoutGap="10px grid">
<div fxLayoutAlign="end center" fxFlex="50%" fxFlex.sm="50%" fxFlex.xs="100%">
<mat-form-field class="example-full-width" color="accent">
<mat-label>References</mat-label>
<textarea matInput [formControl]="references" placeholder="e.g: https://owasp.org/www-community/attacks/Full_Path_Disclosure"></textarea>
<mat-label>CVSS base score</mat-label>
<input [formControl]="cvss" matInput placeholder="e.g: 5">
<button mat-button (click)="openDialogCVSS()" style="line-height: 25px;" color="accent" matSuffix>
CVSS
</button>
</mat-form-field>
</div>
<div fxLayoutAlign="end center" fxFlex="50%" fxFlex.sm="50%" fxFlex.xs="100%">
<mat-form-field class="example-full-width" color="accent">
<mat-label>CVSS vector</mat-label>
<input [formControl]="cvss_vector" matInput placeholder="CVSS:3.1/AV:_/AC:_/PR:_/UI:_/S:_/C:_/I:_/A:_">
</mat-form-field>
</div>
<div fxLayout="column" fxLayoutAlign="start">

<div fxLayout="row wrap" fxLayoutGap="10px grid">
<div fxLayoutAlign="start" fxFlex="50%" fxFlex.sm="50%" fxFlex.xs="100%">
<mat-form-field class="example-full-width" color="accent">
<mat-label>Select an severity</mat-label>
<mat-select [formControl]="severity">
@for (sev of tablecon; track sev) {
<mat-option [value]="sev.name">{{sev.name}}</mat-option>
}
</mat-select>
</mat-form-field>
</div>
<div fxLayoutAlign="start" fxFlex="50%" fxFlex.sm="50%" fxFlex.xs="100%">
<mat-form-field class="example-full-width" color="accent">
<mat-label>CVE</mat-label>
<input matInput [formControl]="cve" placeholder="CVE">
</mat-form-field>
</div>
</div>
<div fxLayout="row wrap" fxLayoutGap="10px grid">
<div fxLayoutAlign="end center" fxFlex="50%" fxFlex.sm="50%" fxFlex.xs="100%">
<mat-form-field class="example-full-width" color="accent">
<mat-label>CVSS base score</mat-label>
<input [formControl]="cvss" matInput placeholder="e.g: 5">
<button mat-button (click)="openDialogCVSS()" style="line-height: 25px;" color="accent" matSuffix>
CVSS
</button>
</mat-form-field>
</div>
<div fxLayoutAlign="end center" fxFlex="50%" fxFlex.sm="50%" fxFlex.xs="100%">
<mat-form-field class="example-full-width" color="accent">
<mat-label>CVSS vector</mat-label>
<input [formControl]="cvss_vector" matInput placeholder="CVSS:3.1/AV:_/AC:_/PR:_/UI:_/S:_/C:_/I:_/A:_">
</mat-form-field>
</div>
</div>

</div>
<div fxLayoutAlign="start center">

</div>
<mat-form-field appearance="outline" class="example-full-width" color="accent">
<mat-label>TAGs</mat-label>
<mat-chip-grid #tagList aria-label="Tags">
<mat-chip-row *ngFor="let tag of tags" [(ngModel)]="tags" [selectable]="selectable"
[removable]="removable" (removed)="TAGremove(tag)" ngDefaultControl>
{{tag.name}}
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
</mat-chip-row>
<input placeholder="New tag..." [matChipInputFor]="tagList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes" [matChipInputAddOnBlur]="addOnBlur"
(matChipInputTokenEnd)="TAGadd($event)">
</mat-chip-grid>
</mat-form-field>

</div>

<div fxLayout="row" fxLayoutGap="10px grid">
<div fxLayoutAlign="start center" fxFlex="50%" fxFlex.sm="100%" fxFlex.xs="100%">
<button mat-raised-button color="primary" (click)="cancel()">Close</button>
</div>
<div fxLayoutAlign="end center" fxFlex="50%" fxFlex.sm="100%" fxFlex.xs="100%">
<button mat-raised-button color="accent" (click)="savelocally()"><mat-icon>save_as</mat-icon>Save locally</button>
</div>
</div>
</div>

</div>



</mat-dialog-content>
<mat-dialog-actions align="start">
<div fxLayout="row">
<div fxLayoutAlign="start center" fxFlex="100%" fxFlex.sm="100%" fxFlex.xs="100%">
<button mat-raised-button color="accent" *ngIf="data.length == 0" (click)="savelocally()"><mat-icon>save_as</mat-icon> Save locally</button>
<button mat-raised-button color="accent" *ngIf="data.length > 0" (click)="edit(data)"><mat-icon>save_as</mat-icon> Save</button>
&nbsp;
<button mat-raised-button color="primary" (click)="cancel()"><mat-icon>cancel</mat-icon> Cancel</button>
</div>
</div>
</mat-dialog-actions>


</mat-card-content>
</mat-card>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { UtilsService } from '../utils.service';
import { UntypedFormControl } from '@angular/forms';
import { IndexeddbService } from '../indexeddb.service';
import { DialogCvssComponent } from '../dialog-cvss/dialog-cvss.component';
import { COMMA, ENTER } from '@angular/cdk/keycodes';
import { MatChipInputEvent } from '@angular/material/chips';

export interface Tags {
name: string;
}

@Component({
selector: 'app-dialog-add-custom-template',
Expand All @@ -21,24 +27,29 @@ export class DialogAddCustomTemplateComponent implements OnInit {
cvss = new UntypedFormControl();
cvss_vector = new UntypedFormControl();
cve = new UntypedFormControl();
tags = [];
readonly separatorKeysCodes = [ENTER, COMMA] as const;
visible = true;
selectable = true;
removable = true;
addOnBlur = true;

constructor(public dialogRef: MatDialogRef<DialogAddCustomTemplateComponent>, private utilsService: UtilsService, private indexeddbService: IndexeddbService,
@Inject(MAT_DIALOG_DATA) public data: any, public dialog: MatDialog){

}
@Inject(MAT_DIALOG_DATA) public data: any, public dialog: MatDialog){}

ngOnInit() {

this.tablecon = this.utilsService.severitytable;

if(this.data){
this.templatename.setValue(this.data.title);
this.description.setValue(this.data.desc);
this.references.setValue(this.data.ref);
this.severity.setValue(this.data.severity);
this.cvss.setValue(this.data.cvss);
this.cvss_vector.setValue(this.data.cvss_vector);
this.cve.setValue(this.data.cve);
if(this.data[0]){
this.templatename.setValue(this.data[0].title);
this.description.setValue(this.data[0].desc);
this.references.setValue(this.data[0].ref);
this.severity.setValue(this.data[0].severity);
this.cvss.setValue(this.data[0].cvss);
this.cvss_vector.setValue(this.data[0].cvss_vector);
this.cve.setValue(this.data[0].cve);
this.tags = this.data[0].tags || [];
}

};
Expand All @@ -53,16 +64,23 @@ export class DialogAddCustomTemplateComponent implements OnInit {
const cvss_vector = this.cvss_vector.value || '';
const cve = this.cve.value || '';

this.dialogRef.close({"title": templatename,"poc": "","desc": description,"severity": severity,"ref": references,"cvss": cvss,"cvss_vector": cvss_vector,"cve": cve, "tags": this.tags});
}

this.indexeddbService.saveReportTemplateinDB({"title": templatename,"poc": "","desc": description,"severity": severity,"ref": references,"cvss": cvss,"cvss_vector": cvss_vector,"cve": cve}).then(ret => {
if (ret) {
console.log("custom template added");
}
});
edit(item): void {

this.dialogRef.close();
const templatename = this.templatename.value || '';
const description = this.description.value || '';
const severity = this.severity.value || '';
const references = this.references.value || '';
const cvss = this.cvss.value || '';
const cvss_vector = this.cvss_vector.value || '';
const cve = this.cve.value || '';

this.dialogRef.close([{"title": templatename,"poc": "","desc": description,"severity": severity,"ref": references,"cvss": cvss,"cvss_vector": cvss_vector,"cve": cve, "tags": this.tags},{"original": item}]);
}


addtomaster(): void {
const templatename = this.templatename.value || '';
const description = this.description.value || '';
Expand All @@ -72,8 +90,6 @@ export class DialogAddCustomTemplateComponent implements OnInit {
const cvss_vector = this.cvss_vector.value || '';
const cve = this.cve.value || '';



const title = "[add-custom-template] "+templatename;
const body = `Hi,
Please add template:
Expand Down Expand Up @@ -105,7 +121,7 @@ to \`/assets/vulns.json\`.
openDialogCVSS(): void {

const dialogRef = this.dialog.open(DialogCvssComponent, {
width: '800px',
width: '700px',
disableClose: false,
data: []
});
Expand All @@ -121,5 +137,23 @@ to \`/assets/vulns.json\`.

}

TAGadd(event: MatChipInputEvent): void {
const value = (event.value || '').trim();
if (value) {
this.tags.push({ name: value });
}
// Reset the input value
if (event.input) {
event.input.value = '';
}
}

TAGremove(tag: Tags): void {

const ind: number = this.tags.indexOf(tag);
if (ind !== -1) {
this.tags.splice(ind, 1);
}
}

}
7 changes: 6 additions & 1 deletion src/app/dialog-addissue/dialog-addissue.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import {MatAutocompleteSelectedEvent, MatAutocompleteModule} from '@angular/mate
import { CurrentdateService } from '../currentdate.service';
import { IndexeddbService } from '../indexeddb.service';

export interface Tags {
name: string;
}

export interface Vulns {
title: string;
cve: string;
Expand All @@ -23,6 +27,7 @@ export interface Vulns {
poc: string;
ref: string;
severity: string;
tags:Array<Tags>
}

export interface PCI {
Expand Down Expand Up @@ -286,7 +291,7 @@ export class DialogAddissueComponent implements OnInit {
cvss: found.cvss,
cvss_vector: found.cvss_vector,
cve: found.cve,
tags: [],
tags: found.tags,
bounty: [],
date: this.getcurrentDate()
};
Expand Down
Loading
Loading