Skip to content

Commit

Permalink
Merge pull request #405 from kac89/dev
Browse files Browse the repository at this point in the history
bugs fixes
  • Loading branch information
kac89 authored Aug 13, 2024
2 parents 4789efa + 95f1708 commit 859ed8e
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<div *ngIf="show_status" class="title-center">

<div *ngIf="enc_status">
<mat-icon class="vertical-align-middle padding-bottom-3 decrypted-color" matSuffix>no_encryption</mat-icon> Report is decrypted.
<mat-icon class="vertical-align-middle padding-bottom-3 decrypted-color" matSuffix>no_encryption</mat-icon> Report is decrypted
</div>
<div *ngIf="!enc_status"><mat-icon class="vertical-align-middle padding-bottom-3 encrypted-color" matSuffix>lock</mat-icon> Report is encrypted.</div>
<div *ngIf="!enc_status"><mat-icon class="vertical-align-middle padding-bottom-3 encrypted-color" matSuffix>lock</mat-icon> Report is encrypted</div>

</div>

Expand Down
14 changes: 7 additions & 7 deletions src/app/report/report.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -931,8 +931,6 @@ <h3>Changelog is empty <mat-icon>sentiment_dissatisfied</mat-icon></h3>
(change)="parsingdescnewline($event)">(Parsing: Description)<br>Add new line</mat-checkbox><br>
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_parsing_poc_markdown"
(change)="parsingpocmarkdown($event)">(Parsing: PoC)<br>Use Markdown</mat-checkbox>
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_remove_attach_name"
(change)="removeattachname($event)">Hide the filename of all attachments</mat-checkbox>
</div>

</mat-card-content>
Expand All @@ -951,21 +949,23 @@ <h3>Changelog is empty <mat-icon>sentiment_dissatisfied</mat-icon></h3>

<div fxFlex="50%" fxFlex.sm="100%" fxFlex.xs="100%">
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_changelog_page"
(change)="removechangelogpage($event)">Remove Changelog</mat-checkbox><br>
(change)="removechangelogpage($event)">Remove Changelog</mat-checkbox>
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_remove_issuestatus"
(change)="removeIssuestatus($event)">Remove Issue status</mat-checkbox><br>
(change)="removeIssuestatus($event)">Remove Issue status</mat-checkbox>
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_remove_issuecvss"
(change)="removeIssuecvss($event)">Remove Issue CVSS</mat-checkbox><br>
(change)="removeIssuecvss($event)">Remove Issue CVSS</mat-checkbox>
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_remove_issuecve"
(change)="removeIssuecve($event)">Remove Issue CVE</mat-checkbox>
</div>

<div fxFlex="50%" fxFlex.sm="100%" fxFlex.xs="100%">
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_remove_researchers"
(change)="removeResearchers($event)">Remove Researcher</mat-checkbox><br>
(change)="removeResearchers($event)">Remove Researcher</mat-checkbox>
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_remove_issuetags"
(change)="removetagsfromreport($event)">Remove TAGs</mat-checkbox>
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_remove_lastpage"
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_remove_attach_name"
(change)="removeattachname($event)">Hide the filename of all attachments</mat-checkbox>
<mat-checkbox [checked]="decryptedReportDataChanged.report_settings.report_remove_lastpage"
(change)="removeGeninfo($event)">Remove<br>(Generated by vulnrepo.com)</mat-checkbox>
</div>

Expand Down
156 changes: 151 additions & 5 deletions src/app/report/report.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { PageEvent } from '@angular/material/paginator';
import { DialogEditorFullscreenComponent } from '../dialog-editor-fullscreen/dialog-editor-fullscreen.component';
import { DialogAttachPreviewComponent } from '../dialog-attach-preview/dialog-attach-preview.component';
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, HeadingLevel, ImageRun, PageNumber, NumberFormat, Paragraph, TextRun, TableOfContents, Table, TableCell, TableRow, WidthType } from "docx";

import { UtilsService } from '../utils.service';
export interface Tags {
name: string;
}
Expand Down Expand Up @@ -185,7 +185,8 @@ export class ReportComponent implements OnInit, OnDestroy {
private snackBar: MatSnackBar,
public sessionsub: SessionstorageserviceService,
private datePipe: DatePipe,
private dateAdapter: DateAdapter<Date>) {
private dateAdapter: DateAdapter<Date>,
private utilsService: UtilsService) {
//console.log(route);
this.subscription = this.messageService.getDecrypted().subscribe(message => {
this.decryptedReportData = message;
Expand Down Expand Up @@ -1977,6 +1978,32 @@ Date | Description
return changelogArray;
};

const buildreportsummary = () => {
let authorArray = [];

if (this.decryptedReportDataChanged.report_summary.length > 0) {

authorArray.push(
new Paragraph({
text: "Report summary",
heading: HeadingLevel.HEADING_1,
pageBreakBefore: true,
spacing: {
after: 200,
before: 200,
},
}),
new Paragraph({
text: this.decryptedReportDataChanged.report_summary,
spacing: {
after: 200,
},
})
);

}
return authorArray;
};

const buildmainauthors = () => {
let authorArray = [];
Expand Down Expand Up @@ -2006,7 +2033,7 @@ Date | Description

if (this.decryptedReportDataChanged.report_settings.report_changelog_page === false) {

for (var i = 0; i < this.decryptedReportDataChanged.researcher.length; i++) {
if (this.decryptedReportDataChanged.report_changelog.length > 0) {

authorArray.push(
new Paragraph({
Expand Down Expand Up @@ -2074,6 +2101,13 @@ Date | Description
for (var i = 0; i < this.decryptedReportDataChanged.report_vulns[x].files.length; i++) {

if (this.decryptedReportDataChanged.report_vulns[x].files[i].type.includes('image')) {

let filename = "";
filename = this.decryptedReportDataChanged.report_vulns[x].files[i].title;
if (this.decryptedReportDataChanged.report_settings.report_remove_attach_name === true) {
filename = "";
}

filesArray.push(

new ImageRun({
Expand All @@ -2083,7 +2117,18 @@ Date | Description
height: 400,
},
}),

new TextRun({
text: 'sha256: ' + this.decryptedReportDataChanged.report_vulns[x].files[i].sha256checksum,
break: 1,
}),
new TextRun({
text: filename,
break: 1,
}),
new TextRun({
text: '',
break: 1,
})
);
}

Expand All @@ -2093,6 +2138,31 @@ Date | Description
return filesArray;
};

const buildtags = (x) => {
let tagsArray = [];

const tags = [];
for (var i = 0; i < this.decryptedReportDataChanged.report_vulns[x].tags.length; i++) {
tags.push(this.decryptedReportDataChanged.report_vulns[x].tags[i].name);
}
const xy = tags.join(", ");

tagsArray.push(
new TextRun({
text: xy,
break: 1,
}),
new TextRun({
text: '',
break: 1,
})

);


return tagsArray;
};

const buildrefs = (x) => {
let refArray = [];
const ref = this.decryptedReportDataChanged.report_vulns[x].ref.split('\n');
Expand Down Expand Up @@ -2123,6 +2193,60 @@ Date | Description
}),
);

const farr = [];

let sev = "";
if (this.decryptedReportDataChanged.report_vulns[i].severity.length > 0) {
sev = "Severity: " + this.decryptedReportDataChanged.report_vulns[i].severity;
farr.push(sev);
}

if (this.decryptedReportDataChanged.report_settings.report_remove_issuestatus === false) {
if (this.decryptedReportDataChanged.report_vulns[i].status) {
const result = this.utilsService.issueStatustable.filter((sev) => sev.value === this.decryptedReportDataChanged.report_vulns[i].status);
let stat = "";
if (result[0].status) {
stat = "Issue status: " + result[0].status;
farr.push(stat);
}
}
}

if (this.decryptedReportDataChanged.report_settings.report_remove_issuecvss === false) {
let cvss = "";
if (this.decryptedReportDataChanged.report_vulns[i].cvss.length > 0) {
cvss = "CVSS: " + this.decryptedReportDataChanged.report_vulns[i].cvss;
farr.push(cvss);
}
}

if (this.decryptedReportDataChanged.report_settings.report_remove_issuecve === false) {
let cve = "";
if (this.decryptedReportDataChanged.report_vulns[i].cve.length > 0) {
cve = "CVE: " + this.decryptedReportDataChanged.report_vulns[i].cve;
farr.push(cve);
}
}

const info = farr.join(", ");
paragraphArray.push(

new Paragraph({
children: [
new TextRun({
text: info,
bold: false,
break: 1,
}),
new TextRun({
text: "",
break: 1,
}),
],
}),

);

paragraphArray.push(

new Paragraph({
Expand Down Expand Up @@ -2161,6 +2285,28 @@ Date | Description
})
);

if (this.decryptedReportDataChanged.report_settings.report_remove_issuetags === false) {
if (this.decryptedReportDataChanged.report_vulns[i].tags.length > 0) {
paragraphArray.push(

new Paragraph({
children: [
new TextRun({
text: "TAGs:",
bold: true,
})
],
}),


new Paragraph({
children: buildtags(i),
}),

);
}
}

paragraphArray.push(

new Paragraph({
Expand Down Expand Up @@ -2761,8 +2907,8 @@ Date | Description
/// issues start
...buildParagraphissues(),
/// issues end
...buildreportsummary(),
...buildmainauthors(),

...buildmainchangelog(),
],
},
Expand Down
24 changes: 21 additions & 3 deletions src/assets/html_report_v2_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ <h6 class="mb-0">Issues</h6>

<div class="table_of_contents"></div>

<div class="list_summary">
<a href="#Summary" class="list-group-item list-group-item-action d-flex gap-3 py-3"
aria-current="true">
<i style="font-size: 2rem;" class="bi bi-chat-square-text"></i>
<div class="d-flex gap-2 w-100 justify-content-between">
<div>
<h6 class="mb-0">Report summary</h6>
<p class="mb-0 opacity-75">Short comments from researcher.</p>
</div>
</div>
</a>
</div>

<div class="list_researcher">
<a href="#Researcher" class="list-group-item list-group-item-action d-flex gap-3 py-3"
aria-current="true">
Expand All @@ -201,7 +214,6 @@ <h6 class="mb-0">Researcher</h6>
</a>
</div>


<div class="list_changelog">
<a href="#Changelog" class="list-group-item list-group-item-action d-flex gap-3 py-3"
aria-current="true">
Expand Down Expand Up @@ -323,7 +335,7 @@ <h2 id="Issues" class="report_vulns_h2"></h2><br>
<div class="row report_vulns bg-d"></div>

<br>
<h2 id="Report summary" class="report_summary_h2"></h2>
<h2 id="Summary" class="report_summary_h2"></h2>
<div class="report_summary"></div>

<br>
Expand Down Expand Up @@ -376,6 +388,7 @@ <h5 class="modal-title" style="display: flex;" id="exampleModalLongTitle">
$('#reportdetal').hide();
$('.wrongpass').hide();
$('.list_changelog').hide();
$('.list_summary').hide();
$('.list_researcher').hide();
$('.list_copyright').hide();

Expand Down Expand Up @@ -813,7 +826,7 @@ <h5>Proof of Concept:</h5>

// report summary
if (obj.report_summary !== "") {
$(".report_summary_h2").append('<i class="bi bi-card-heading"></i> Report summary');
$(".report_summary_h2").append('<i class="bi bi-chat-square-text"></i> Report summary');
const markedreport_summary = marked.parse(obj.report_summary, { renderer: renderer });
$(".report_summary").html(DOMPurify.sanitize(markedreport_summary));
}
Expand Down Expand Up @@ -883,6 +896,11 @@ <h4 class="card-title">`+ DOMPurify.sanitize(element.reportername) + `</h4>
$('.list_copyright').show();
}


if(obj.report_summary.length > 0) {
$('.list_summary').show();
}

//back to top
//Get the button
let mybutton = document.getElementById("btn-back-to-top");
Expand Down

0 comments on commit 859ed8e

Please sign in to comment.