Difference between revisions of "Bandit - Static Code Analyss for Python Code"
Line 21: | Line 21: | ||
This example is using the Bandit example files from their github (https://github.com/PyCQA/bandit). For this case we are using the imports.py Example with the following Source Code: | This example is using the Bandit example files from their github (https://github.com/PyCQA/bandit). For this case we are using the imports.py Example with the following Source Code: | ||
import | import os | ||
import pickle | |||
import sys | |||
import subprocess | |||
After executing bandit on the File | After executing bandit on the File |
Revision as of 22:20, 14 January 2023
Summary
This documentation shows how to install and use Bandit, a static analysis tool for C/C++ source code. This Tool can be used to identify possible Security risks categorized in three different Severity Levels (Low, Medium, High).
Requirements
- Python Version 3.7 or higher
- Python Package: bandit
Installation and Usage
Bandit can be easily installed via the pip install command. Furthermore it can be found on PyPi for manual installation. If you want to install it manually please follow the attached References.
pip install bandit
For executing the analysis just enter die File or Folder you want to be analyzed in a Python Terminal
bandit <File/Folder>
Example
This example is using the Bandit example files from their github (https://github.com/PyCQA/bandit). For this case we are using the imports.py Example with the following Source Code:
import os import pickle import sys import subprocess
After executing bandit on the File
bandit imports.py
you get the following output:
Bandit has found two Low Severity Issues regarding Problems with the imported Packages. A detailed information is given for every Issue found. It also shows the CWE Number associated with it.