Class: Necropsy::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/necropsy/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root:, config_path: nil, analyzers: nil) ⇒ Runner

Returns a new instance of Runner.



7
8
9
10
11
# File 'lib/necropsy/runner.rb', line 7

def initialize(root:, config_path: nil, analyzers: nil)
  @root = File.expand_path(root)
  @config = Configuration.load(root: @root, path: config_path)
  @analyzers = analyzers
end

Instance Attribute Details

#analyzersObject (readonly)

Returns the value of attribute analyzers.



5
6
7
# File 'lib/necropsy/runner.rb', line 5

def analyzers
  @analyzers
end

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/necropsy/runner.rb', line 5

def config
  @config
end

#rootObject (readonly)

Returns the value of attribute root.



5
6
7
# File 'lib/necropsy/runner.rb', line 5

def root
  @root
end

Instance Method Details

#analyzeObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/necropsy/runner.rb', line 13

def analyze
  project = Project.new(root: root, config: config)
  graph = CallGraph.new(project.scan_result)

  apply_entry_points(graph, project)
  configured_analyzers.each do |analyzer|
    graph.add_profile(analyzer.profile)
    graph.apply_result(analyzer.analyze(graph, project))
  end

  reachability = Reachability::Engine.new(graph).call
  findings = Confidence::Scorer.new(graph: graph, reachability: reachability, project: project).findings
  Report.new(root: root, graph: graph, findings: findings)
end