BANDIT(1) Bandit BANDIT(1) (NAME) bandit - (SYNOPSIS) bandit [-h] [-r] [-a {file,vuln}] [-n CONTEXT_LINES] [-c CONFIG_FILE] [-p PROFILE] [-t TESTS] [-s SKIPS] [-l] [-i] [-f {csv,custom,html,json,screen,txt,xml,yaml}] [--msg-template MSG_TEMPLATE] [-o [OUTPUT_FILE]] [-v] [-d] [-q] [--ignore-nosec] [-x EXCLUDED_PATHS] [-b BASELINE] [--ini INI_PATH] [--exit-zero] [--version] [targets [targets ...]] (DESCRIPTION) bandit . (AST) AST . . (OPTIONS) -h, --help -r, --recursive -a {file,vuln}, --aggregate {file,vuln} () -n CONTEXT_LINES, --number CONTEXT_LINES -c CONFIG_FILE, --configfile CONFIG_FILE -p PROFILE, --profile PROFILE (: ) -t TESTS, --tests TESTS ( ) -s SKIPS, --skip SKIPS ( ) -l, --level ( : -l, : -ll, : -lll) -l, --severity-level={all,high,medium,low} . "all" "low" "low" . -i, --confidence ( : -i, : -ii, : -iii) -l, --confidence-level={all,high,medium,low} . "all" "low" "low" . -f {csv,custom,html,json,sarif,screen,txt,xml,yaml}, --format {csv,custom,html,json,sarif,screen,txt,xml,yaml} --msg-template MSG_TEMPLATE ( --format custom ) << >> . -o OUTPUT_FILE, --output OUTPUT_FILE -v, --verbose -d, --debug -q, --quiet, --silent --ignore-nosec # nosec -x EXCLUDED_PATHS, --exclude EXCLUDED_PATHS ( glob) ( ) (: .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg) -b BASELINE, --baseline BASELINE (Baseline) ( JSON ) --ini INI_PATH .bandit --exit-zero --version (CUSTOM FORMATTING) : {abspath}, {relpath}, {line}, {test_id}, {severity}, {msg}, {confidence}, {range} : : bandit -r examples/ --format custom --msg-template "{abspath}:{line}: {test_id}[bandit]: {severity}: {msg}" : bandit -r examples/ --format custom string.format() : bandit -r examples/ --format custom --msg-template "{relpath:20.20s}: {line:03}: {test_id:^8}: DEFECT: {msg:>20}" : https://docs.python.org/3/library/string.html (FILES) .bandit /etc/bandit/bandit.yaml (EXAMPLES) : bandit -r ~/your-repos/project examples/ : bandit examples/*.py -n 3 --severity-level=high . examples ShellInjection: bandit examples/*.py -p ShellInjection . : cat examples/imports.py | bandit - (SEE ALSO) pylint(1) (AUTHORS) PyCQA (COPYRIGHT) 2026, Bandit Developers February 25, 2026 BANDIT(1)