Skip to content

Python Faker provider for security related data

License

Notifications You must be signed in to change notification settings

snyk/faker-security

Repository files navigation

Faker-Security

Pypi CircleCI

Provider for Faker to generate random/fake data related to security.

Requirements

  • Faker
  • Python 3.8+

Installation and Usage

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()

Provider Features

  • cvss4: generates a CVSS v4 vector
  • cvss3: generates a CVSS v3 vector
  • cvss2: generates a CVSS v2 vector
  • ccss: generates a CCSS vector
  • version: generates a semver version number
  • npm_semver_range: generates a npm compatible semver version range
  • cwe: generates a CWE identifier
  • cve: generates a CVE identifier

Developing

  • Install poetry and run poetry install
  • Install pre-commit and run pre-commit install --install-hooks

Testing

poetry run pytest to run tests.