使用 Bandit 进行安全分析的 Python 代码 [英] Python code for security analysis using Bandit

查看:60
本文介绍了使用 Bandit 进行安全分析的 Python 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取 Python 代码以使用 Bandit 静态分析器进行分析.主要强调安全性,适用于 python 2.7.

I would like to get python code for an analysis using Bandit static analyzer. The main emphasis is security, for python 2.7.

有人可以帮忙吗?

谢谢.

推荐答案

您无需编写代码即可使用 Bandit 静态分析器工具来测试您的软件.

You don't need to write code to test your software using Bandit static analyzer tool.

您需要做的(在最基本的情况下)是:

All you need to do (in the most basic scenario) is:

  1. 使用 pip3 install bandit (Python3) 或 pip install bandit (Python2) 安装 Bandit
  2. 在终端中导航到您的项目,例如cd/home/user/projects/abc/
  3. 使用 bandit -r
  4. 在源代码上运行 Bandit
  1. Install Bandit with pip3 install bandit (Python3) or pip install bandit (Python2)
  2. Navigate to your project in terminal, e.g. cd /home/user/projects/abc/
  3. Run the Bandit on your source code with bandit -r .

您可能还想要做的是,通过将 -x env 添加到命令中,从测试中排除 virtualenv 库的文件(现在看起来像这样:bandit -r . -x env).

What you may also want to do, is to exclude virtualenv libraries' files from testing by adding -x env to the command (now it would look like this: bandit -r . -x env).

有关详细信息,请参阅Bandit 主页.

For more information, please refer to Bandit main page.

这篇关于使用 Bandit 进行安全分析的 Python 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆