Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
brakeman — 一个用于 Ruby on Rails 应用程序的静态分析安全漏洞扫描器 | Kitploit
工具/GitHubGitHub/presidentbeef/brakeman
静态分析漏洞扫描器代码分析Web安全DevSecOps
GitHubpresidentbeef/brakeman

brakeman

一个用于 Ruby on Rails 应用程序的静态分析安全漏洞扫描器

查看仓库
7.3k7738天前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
网站

Brakeman Logo

Build Status Code Coverage

Brakeman

Brakeman 是一款静态分析工具,用于检查 Ruby on Rails 应用程序中的安全漏洞。

安装

使用 RubyGems:

root@kitploit:~
gem install brakeman

使用 Bundler:

root@kitploit:~
group :development do
  gem 'brakeman', require: false
end

使用 Docker:

root@kitploit:~
docker pull presidentbeef/brakeman

使用 Docker 从源码构建:

root@kitploit:~
git clone https://github.com/presidentbeef/brakeman.git
cd brakeman
docker build . -t brakeman

使用方式

本地运行

从 Rails 应用程序的根目录执行:

root@kitploit:~
brakeman

在 Rails 根目录之外:

root@kitploit:~
brakeman /path/to/rails/application

使用 Docker 运行

从 Rails 应用程序的根目录执行:

root@kitploit:~
docker run -v "$(pwd)":/code presidentbeef/brakeman

启用更漂亮的颜色:

root@kitploit:~
docker run -v "$(pwd)":/code presidentbeef/brakeman --color

生成 HTML 报告:

root@kitploit:~
docker run -v "$(pwd)":/code presidentbeef/brakeman -o brakeman_results.html

在 Rails 根目录之外(注意输出文件路径相对于 Rails 应用程序目录):

root@kitploit:~
docker run -v 'path/to/rails/application':/code presidentbeef/brakeman -o brakeman_results.html

兼容性

Brakeman 应与 Rails 2.3.x 到 8.x 的任何版本兼容。

Brakeman 可以分析使用 Ruby 2.0 及更新版本语法编写的代码,但运行时需要至少 Ruby 3.2.0。

基本选项

完整选项列表请使用 brakeman --help 或参阅 OPTIONS.md 文件。

指定结果输出文件:

root@kitploit:~
brakeman -o output_file

输出格式由文件扩展名决定,或使用 -f 选项指定。当前支持的格式有:text、html、tabs、json、junit、markdown、csv、codeclimate、github、sarif 和 sonar。

可以指定多个输出文件:

root@kitploit:~
brakeman -o output.html -o output.json

同时输出到文件和控制台,并启用颜色:

root@kitploit:~
brakeman --color -o /dev/stdout -o output.json

抑制信息性警告,仅输出报告:

root@kitploit:~
brakeman -q

注意:除报告外,Brakeman 的所有输出都发送到 stderr,因此可以简单地将 stdout 重定向到文件,从而只获取报告内容。

查看各种调试信息:

root@kitploit:~
brakeman -d

可按需跳过特定检查项。名称需要使用正确的大小写。例如,跳过默认路由检查(DefaultRoutes):

root@kitploit:~
brakeman -x DefaultRoutes

多个检查项用逗号分隔:

root@kitploit:~
brakeman -x DefaultRoutes,Redirect

若要反其道而行之,只运行特定检查集:

root@kitploit:~
brakeman -t SQL,ValidationRegex

如果 Brakeman 运行较慢,可以尝试:

root@kitploit:~
brakeman --faster

这将禁用某些特性,但通常会快很多(目前等同于 --skip-libs --no-branching)。警告:这可能导致 Brakeman 遗漏某些漏洞。

默认情况下,如果发现任何安全警告或扫描错误,Brakeman 会返回非零退出码。要禁用此行为:

root@kitploit:~
brakeman --no-exit-on-warn --no-exit-on-error

要跳过 Brakeman 可能无法解析的某些文件或目录,使用:

root@kitploit:~
brakeman --skip-files file1,/path1/,path2/

要比较本次扫描与之前扫描的结果,先使用 JSON 输出选项,然后执行:

root@kitploit:~
brakeman --compare old_report.json

这将输出 JSON,包含两个列表:已修复的警告和新出现的警告。

如果配置得当,Brakeman 会忽略某些警告。默认情况下,它在 config/brakeman.ignore 中查找配置文件。要创建和管理该文件,使用:

root@kitploit:~
brakeman -I

如果你想临时查看已忽略的警告而不影响退出码,使用:

root@kitploit:~
brakeman --show-ignored

警告信息

有关本工具报告的警告的更多信息,请参阅 warning_types。

警告上下文

HTML 输出格式提供了触发警告的原始应用源代码摘录。由于查找漏洞过程中的处理,源代码可能与报告的警告不完全一致,报告的行号也可能略有偏差。不过,上下文仍然可以快速查看引发警告的代码。

置信度级别

Brakeman 为每个警告分配一个置信度级别。这大致估计了该警告实际存在问题的可能性。当然,这些评级不应被视为绝对真理。

置信度分为三个级别:

  • 高 – 要么是简单的警告(布尔值),要么用户输入极有可能被不安全地使用。
  • 中 – 通常表示变量存在不安全使用,但该变量可能是也可能不是用户输入。
  • 弱 – 通常表示用户输入被间接地以潜在不安全的方式使用。

若要仅获取高于某一置信度级别的警告:

root@kitploit:~
brakeman -w3

-w 开关接受 1 到 3 的数字,1 表示低(所有警告),3 表示高(仅最高置信度的警告)。

配置文件

Brakeman 的选项可以存储在 YAML 文件中并读取。

为简化配置文件的编写过程,可使用 -C 选项输出当前设置的选项:

root@kitploit:~
$ brakeman -C --skip-files plugins/
---
:skip_files:
- plugins/

命令行中传递的选项优先级高于配置文件。

默认配置位置依次为 ./config/brakeman.yml、~/.brakeman/config.yml 和 /etc/brakeman/config.yml

可以使用 -c 选项指定要使用的配置文件。

持续集成

Jenkins/Hudson 有可用的插件。

如需更持续的测试,可以尝试 Guard 插件。

还有几个 GitHub Actions 可供使用。

构建

root@kitploit:~
git clone git://github.com/presidentbeef/brakeman.git
cd brakeman
gem build brakeman.gemspec
gem install brakeman*.gem

谁在使用 Brakeman?

  • Code Climate
  • GitHub
  • Groupon
  • New Relic
  • Twitter

……以及更多!

网站/新闻

网站:http://brakemanscanner.org/

Twitter:https://twitter.com/brakeman

聊天:https://gitter.im/presidentbeef/brakeman

许可证

Brakeman 免费用于非商业用途。

详情请参阅 COPYING。

下载工具