https://github.com/gocsaf/fakedoc
https://github.com/gocsaf/fakedoc
csaf
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gocsaf/fakedoc
- Owner: gocsaf
- Created: 2024-10-23T15:46:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-18T06:41:13.000Z (12 months ago)
- Last Synced: 2025-10-09T18:33:10.259Z (8 months ago)
- Topics: csaf
- Language: Go
- Homepage:
- Size: 138 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSES/Apache-2.0.txt
Awesome Lists containing this project
README
# Fake CSAF document generator
Will allow the creation
of one or many fake CSAF 2.0 documents to explore
and test implementations of this standard.
Will use the CSAF Go library where appropriate.
## Build
``` shell
go build -o fakedoc ./cmd/fakedoc
go build -o createtemplate ./cmd/createtemplate
```
To enable support for profiling with `go tool pprof`
to fakedoc add the build tag `profile`:
``` shell
go build -tags profile -o fakedoc ./cmd/fakedoc
```
## Usage
Generate a random CSAF document with default settings (with the `-o`
option for the output file, the tracking ID will match the filename):
``` shell
./fakedoc -o random-csaf.json
```
The generator can be influenced with a template. Create a template
containing all of the settings used by fakedoc with
``` shell
./createtemplate > template.toml
```
Use the template to generate a document:
``` shell
./fakedoc --template template.toml -o random-csaf.json
```
The template file is used in addition to the built-in template used when
the --template option is not given. See the
[template documentation](docs/templates.md) for details about the
templates.
Generate many documents at once with the `-n` option and an output
filename with a template for filenames. This will generate 100 documents
named `csaf-0.json` through `csaf-99.json`:
``` shell
./fakedoc --template template.toml -n 100 -o 'csaf-{{$}}.json'
```
To generate large documents, one can use the something like this:
``` shell
./fakedoc -o random-csaf.json -l limits.json --force-max-size
```
With the `-l limits.json` option, fakedoc loads information about the
maximum lengths of arrays, strings and URIs from the `limits.json` file.
If loaded the maximum lenghts of arrays are taken from this file (it's
only implemented for arrays so far). By default these maximum values are
multiplied by 0.00001 to avoid generating exceedingly large files. This
factor can be set with the `--size` option. With the `--force-max-size`
option, fakedoc tries to make arrays as large as their maximum length.
How big the files will actually be depends not only on the length of the
arrays but also on which parts of the document are actually generated.
## License
fakedoc is Free Software:
```
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: 2024 German Federal Office for Information Security (BSI)
Software-Engineering: 2024 Intevation GmbH
```