2.9.13 • Published 2 days ago

@attackforge/reportgen-node v2.9.13

Weekly downloads
-
License
MIT
Repository
-
Last release
2 days ago

AttackForge Report Generator Library for Node

AttackForge ReportGen is a free tool to help penetration testers create powerful and robust automated pentest reports.

It works by combining a DOCX template with an AttackForge project JSON file, and outputs a DOCX report.

Example project data and DOCX templates, as well as additional tutorial material, are available on the AttackForge ReportGen page. A video presentation on the ReportGen product can be viewed here.

Additional support material is available on our Github Support Community.

Installation

$ npm install @attackforge/reportgen-node

Creating Programmatic Reports

To programmatically create reports, it is recommended to use the AttackForge Self-Service API to retrieve the JSON report data for a given project.

Reference

The AttackForge ReportGen library exports the following functions:

generateCommunityReport

If you exported your project data from the Community version of the AttackForge product, use this library function to generate your report document.

ArgumentDescription
docxTemplate: ArrayBufferAn ArrayBuffer instance containing the DOCX template file to generate the report with. Example project data and DOCX templates are available here.
reportData: anyThe parsed AttackGen JSON report data to compile into the report template.

generateIndividualReport

If you exported your project data from the Core, or Enterprise versions of the AttackForge product, use this library function to generate your report document.

ArgumentDescription
docxTemplate: ArrayBufferAn ArrayBuffer instance containing the DOCX template file to generate the report with. Example project data and DOCX templates are available here.
reportData: anyThe parsed AttackGen JSON report data to compile into the report template.

Example Usage

The following Typescript code snippet provides an example of how to use ReportGen to generate a report, given an AttackForge project JSON file, and a DOCX template.

Typescript

import { readFile, writeFile } from 'node:fs/promises';
import { generateCommunityReport, generateIndividualReport } from '@attackforge/reportgen-node';

async function readDataFileContents(filePath: string): Promise<any> {
  const dataFileContents = await readFile(filePath, {
    encoding: 'utf-8'
  });

  return JSON.parse(dataFileContents);
}


async function readDocxTemplateFileContents(templateFilePath: string): Promise<ArrayBuffer> {
  return readFile(templateFilePath);
}

async function exampleUsage(): Promise<void> {
  const templateFileContents = await readDocxTemplateFileContents('./template.docx');
  const dataFileContents = await readDataFileContents('./data.json');

  const reportOutput = await generateCommunityReport(templateFileContents, dataFileContents);

  await writeFile('report.docx', Buffer.from(reportOutput));
}

Javascript

const { readFile, writeFile } = require('fs/promises');
const { generateCommunityReport, generateIndividualReport } = require('@attackforge/reportgen-node');

async function readDataFileContents(filePath) {
  const dataFileContents = await readFile(filePath, {
    encoding: 'utf-8'
  });

  return JSON.parse(dataFileContents);
}


async function readDocxTemplateFileContents(templateFilePath) {
  return readFile(templateFilePath);
}

async function exampleUsage() {
  const templateFileContents = await readDocxTemplateFileContents('./template.docx');
  const dataFileContents = await readDataFileContents('./data.json');

  const reportOutput = await generateCommunityReport(templateFileContents, dataFileContents);

  await writeFile('report.docx', Buffer.from(reportOutput));
}
2.9.13

2 days ago

2.9.12

3 days ago

2.9.11

10 days ago

2.9.10

11 days ago

2.9.9

20 days ago

2.9.8

2 months ago

2.9.7

2 months ago

2.9.6

2 months ago

2.9.5

2 months ago

2.9.4

3 months ago

2.9.3

3 months ago

2.9.2

3 months ago

2.9.1

3 months ago

2.9.0

3 months ago

2.8.11

4 months ago

2.8.10

4 months ago

2.8.7

4 months ago

2.8.9

4 months ago

2.8.8

4 months ago

2.8.6

4 months ago

2.8.5

4 months ago

2.8.4

5 months ago

2.8.3

5 months ago

2.8.1

6 months ago

2.8.2

6 months ago

2.8.0

7 months ago

2.7.25

7 months ago

2.7.24

7 months ago

2.7.23

7 months ago

2.7.22

8 months ago

2.7.21

8 months ago

2.7.20

8 months ago

2.7.19

8 months ago

2.7.18

8 months ago

2.7.17

8 months ago

2.7.16

9 months ago

2.7.15

9 months ago

2.7.14

9 months ago

2.7.13

9 months ago

2.7.12

9 months ago

2.7.11

9 months ago

2.7.10

9 months ago

2.7.9

9 months ago

2.7.7

9 months ago

2.7.6

9 months ago

2.7.5

9 months ago