( vulnClass: VulnClass, state: readonly AddExploitInput[], idToType: ReadonlyMap<string, string>, )
| 176 | // ============================================================================ |
| 177 | |
| 178 | export function renderExploitDeliverable( |
| 179 | vulnClass: VulnClass, |
| 180 | state: readonly AddExploitInput[], |
| 181 | idToType: ReadonlyMap<string, string>, |
| 182 | ): string { |
| 183 | const title = `# ${TITLES[vulnClass]}`; |
| 184 | |
| 185 | if (state.length === 0 && idToType.size === 0) { |
| 186 | const body = '*No vulnerabilities were available in the queue for exploitation.*'; |
| 187 | return `${title}\n\n${body}\n`; |
| 188 | } |
| 189 | |
| 190 | const exploited = state.filter((e): e is ExploitedEntry => e.status === 'exploited'); |
| 191 | const blocked = state.filter((e): e is BlockedEntry => e.status === 'blocked'); |
| 192 | |
| 193 | const sections: string[] = [title, '', renderExploitedSection(exploited), '', renderBlockedSection(blocked)]; |
| 194 | |
| 195 | return `${sections.join('\n').trimEnd()}\n`; |
| 196 | } |
no test coverage detected