Skip to main content

CWE Common weakness enumeration library for Python

Python package

https://cwe.mitre.org/index.html

Installation

pip install cwe

Usage

  • Get a CWE by ID:
>>> from cwe import Database
>>> db = Database()
>>> db.get(15)
Weakness(cwe_id=15, name=External Control of System or Configuration Setting)
  • Access attributes of the Weakness using dot notation
>>> weakness = db.get(15)
>>> weakness.description
'One or more system settings or configuration elements can be externally controlled by a user.'
  • Or use the weakness get method
>>> weakness.get("status", None)
'Incomplete'
  • Get a dictionary of the weakness (Truncated for this example)
>>> weakness.to_dict()
{'cwe_id': '15', 'name': 'External Control of System or Configuration Setting', 'weakness_abstraction': 'Base'}
  • Get the top 25 weaknesses
>>> from cwe import Database
>>> db = Database()
>>> db.get_top_25()

Weakness attributes

The following weakness object attributes can accessed:

  • cwe_id
  • name
  • weakness_abstraction
  • status
  • description
  • extended_description
  • related_weaknesses
  • weakness_ordinalities
  • applicable_platforms
  • background_details
  • alternate_terms
  • modes_of_introduction
  • exploitation_factors
  • likelihood_of_exploit
  • common_consequences
  • detection_methods
  • potential_mitigations
  • observed_examples
  • functional_areas
  • affected_resources
  • taxonomy_mappings
  • related_attack_patterns
  • notes

Tests

There's a small unittest test suite in the tests directory

Metadata

Release files for cwe 1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cwe 1.6
File Size Uploaded
cwe-1.6.tar.gz 660.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cwe 1.6
File Interpreter ABI Platform
cwe-1.6-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / cwe-1.6.tar.gz

Download URL cwe-1.6.tar.gz
Size 660.9 kB
Tags Source
SHA-256 checksum
How to use checksums
eed7fdbe3565f975bb9ec6cef6f42cb4eb721ec6155fa954f3b1b106351d981e
BLAKE2b-256 checksum
How to use checksums
ada482772fcb8687f9db3c194e53672e0f4b3bec8eef9fc4b0e10667f68f1a37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.1

Release files / cwe-1.6-py3-none-any.whl

Download URL cwe-1.6-py3-none-any.whl
Size 527.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bad040864f52ccd494763d317eb77e7c604ce323b3a17164d43a97fea4ebb9e8
BLAKE2b-256 checksum
How to use checksums
f7bc813a36f58a6c3857951f275f19191b20a5042733fd39d9eaca25dbb9255e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.1

Release history Release notifications | RSS feed

This release

1.6 This release

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page