Provider for Faker to generate random/fake data related to security.
- Faker
- Python 3.8+
If you want to use faker-security
within your project, add it to your dependency file of choice.
This is typically your project's requirements.txt
file. If you are using a higher-level package manager like poetry
or pipenv
, follow their instructions for adding new packages.
Once installed, you need to setup Faker
to make use of the SecurityProvider
. An example of how that could be done is shown below:
from faker import Faker
from faker_security.providers import SecurityProvider
fake = Faker()
fake.add_provider(SecurityProvider)
# generate a CVSSv3 vector
fake.cvss3()
cvss4
: generates a CVSS v4 vectorcvss3
: generates a CVSS v3 vectorcvss2
: generates a CVSS v2 vectorccss
: generates a CCSS vectorversion
: generates a semver version numbernpm_semver_range
: generates a npm compatible semver version rangecwe
: generates a CWE identifiercve
: generates a CVE identifier
- Install
poetry
and runpoetry install
- Install
pre-commit
and runpre-commit install --install-hooks
poetry run pytest
to run tests.