|
13 | 13 | const logContainer = /** @type {HTMLElement} */ (document.querySelector('.log')); |
14 | 14 | const vulnsContainer = /** @type {HTMLElement} */ (document.querySelector('.vulns')); |
15 | 15 | const unaffectingContainer = /** @type {HTMLElement} */ (document.querySelector('.unaffecting')); |
| 16 | + const debugContainer = /** @type {HTMLElement} */ (document.querySelector('.debug')); |
16 | 17 |
|
17 | 18 | vulnsContainer.addEventListener('click', (event) => { |
18 | 19 | let node = event && event.target; |
|
91 | 92 | } |
92 | 93 | errorContainer.style.display = 'none'; |
93 | 94 |
|
94 | | - logContainer.innerHTML = ''; |
95 | | - const runLog = document.createElement('table'); |
96 | 95 | const timeinfo = (startDate, durationMillisec) => { |
97 | 96 | if (!startDate) { return '' } |
98 | 97 | return durationMillisec ? `${startDate} (took ${durationMillisec} msec)` : `${startDate}`; |
99 | 98 | } |
| 99 | + debugContainer.innerHTML = `Analyzed at: ${timeinfo(json.Start, json.Duration)}`; |
100 | 100 |
|
101 | 101 | const vulns = json.Vuln || []; |
102 | 102 | const affecting = vulns.filter((v) => v.CallStackSummaries?.length); |
103 | 103 | const unaffecting = vulns.filter((v) => !v.CallStackSummaries?.length); |
104 | 104 |
|
105 | | - runLog.innerHTML = ` |
106 | | -<tr><td>Dir:</td><td>${json.Dir || ''}</td></tr> |
107 | | -<tr><td>Pattern:</td><td>${json.Pattern || ''}</td></tr> |
108 | | -<tr><td>Analyzed at:</td><td>${timeinfo(json.Start, json.Duration)}</td></tr> |
109 | | -<tr><td>Found</td><td>${affecting?.length || 0} known vulnerabilities</td></tr>`; |
110 | | - if (unaffecting?.length > 0) { |
111 | | - runLog.innerHTML += `<tr><td>Found</td><td>${unaffecting.length} informational vulnerabilities</td></tr>` |
112 | | - } |
113 | | - |
114 | | - logContainer.appendChild(runLog); |
115 | | - |
| 105 | + logContainer.innerHTML = ` |
| 106 | +<pre>cd ${json.Dir || ''}; govulncheck ${json.Pattern || ''}</pre> |
| 107 | +Found ${affecting?.length || 0} known vulnerabilities.`; |
| 108 | + |
116 | 109 | vulnsContainer.innerHTML = ''; |
117 | 110 | affecting.forEach((vuln) => { |
118 | 111 | const element = document.createElement('div'); |
|
0 commit comments