Skip to content

Commit

Permalink
Merge pull request #364 from kac89/dev
Browse files Browse the repository at this point in the history
update
  • Loading branch information
kac89 committed May 10, 2024
2 parents 5e64e64 + 7461431 commit 8fe09e7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
15 changes: 15 additions & 0 deletions src/app/report/report.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,19 @@ tr.mat-mdc-footer-row td {
mat-paginator {
display: flex;
justify-content: center;
}

::ng-deep code {
font-family: Consolas, "Courier New", Courier, monospace;
font-size: 15px;
background-color: black;
display: block;
white-space: pre;
-webkit-overflow-scrolling: touch;
overflow-x: scroll;
max-width: 100%;
min-width: 100px;
padding-left: 5px;
border-left: 12px solid #16bf6e;
border-radius: 5px;
}
19 changes: 14 additions & 5 deletions src/app/report/report.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2488,14 +2488,23 @@ IP | hostname | role | comments\n\
// add Markdown rendering
const renderer = new marked.Renderer();
renderer.code = function (code, infostring, escaped) {
const xx = `
<code style="white-space: pre-wrap;word-wrap: break-word;">` + DOMPurify.sanitize(code) + `</code>
`;
return xx;
return `<code>` + DOMPurify.sanitize(code) + `</code>`;
};

renderer.link = function( href, title, text ) {
return '<a target="_blank" href="'+ DOMPurify.sanitize(href) +'" title="' + DOMPurify.sanitize(title) + '">' + DOMPurify.sanitize(text) + '</a>';

try {
var prot = decodeURIComponent(unescape(href))
.replace(/[^\w:]/g, '')
.toLowerCase();
} catch (e) {
return text;
}
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
return text;
}

return '<a target="_blank" rel="nofollow" href="'+ DOMPurify.sanitize(href) +'" title="' + DOMPurify.sanitize(title) + '">' + DOMPurify.sanitize(text) + '</a>';
}

const index: number = this.decryptedReportDataChanged.report_vulns.indexOf(dec_data);
Expand Down
12 changes: 12 additions & 0 deletions src/assets/html_report_v2_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@

pre code {
color: var(--bs-code-color);
font-family: Consolas, "Courier New", Courier, monospace;
font-size: 15px;
background-color: black;
display: block;
white-space: pre;
-webkit-overflow-scrolling: touch;
overflow-x: scroll;
max-width: 100%;
min-width: 100px;
padding-left: 5px;
border-left: 12px solid #16bf6e;
border-radius: 5px;
}

pre {
Expand Down

0 comments on commit 8fe09e7

Please sign in to comment.