Class: SeccompTools::CLI::Audit
- Includes:
- FilterInput
- Defined in:
- lib/seccomp-tools/cli/audit.rb
Overview
Handle 'audit' command.
Constant Summary collapse
- SUMMARY =
Summary of this command.
'Assess a seccomp filter for weaknesses and escape routes.'- USAGE =
Usage of this command.
"audit - #{SUMMARY}\n\nUsage: seccomp-tools audit [options] [BPF_FILE|EXEC]".freeze
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#handle ⇒ void
Reads the filter(s) from a BPF file, an executable, or an existing process, then reports the weaknesses of each.
-
#initialize ⇒ Audit
constructor
Instantiate an Audit object.
-
#parser ⇒ OptionParser
Define option parser.
Methods included from Dumpable
#dump_seccomp, #dumping_supported?
Constructor Details
#initialize ⇒ Audit
Instantiate an SeccompTools::CLI::Audit object.
Takes the same arguments as Base#initialize.
25 26 27 28 |
# File 'lib/seccomp-tools/cli/audit.rb', line 25 def initialize(*) super option[:format] = :human end |
Instance Method Details
#handle ⇒ void
This method returns an undefined value.
Reads the filter(s) from a BPF file, an executable, or an existing process, then reports the weaknesses of each.
49 50 51 52 53 54 55 56 |
# File 'lib/seccomp-tools/cli/audit.rb', line 49 def handle return unless super filters = collect_filters return if filters.empty? option[:format] == :json ? emit_json(filters) : emit_human(filters) end |
#parser ⇒ OptionParser
Define option parser.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/seccomp-tools/cli/audit.rb', line 33 def parser @parser ||= OptionParser.new do |opt| opt. = usage option_filter_source(opt, 'audit') option_arch(opt, 'With an executable or --pid the architecture is auto-detected instead.') opt.on('-f', '--format FORMAT', %i[human json], 'Output format, one of <human|json>.', 'Default: human') do |f| option[:format] = f end end end |