Sha256: 6a62a8eeb75f51f137d54465bd44d71f7176dc4539c907f0c077a7e85d2bee91
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
# # Standard libraries # require 'json' # # Third-party libraries # require 'rainbow' require 'rainbow/ext/string' module Hrw # # Format result and pretty print it # class Formatter # Format result # # @param [Hash] result scan result # @return [Boolean] vulnerable or not def format(result) deps = [] result['ancestry']['layers'].each do |layer| layer['detected_features'].each do |feature| deps << feature if feature.key?('vulnerabilities') end end deps end # Pretty print result # def print_vulnerable_deps(deps) deps.each do |dep| dep['vulnerabilities'].each do |vuln| patched_version = JSON.parse(vuln['fixed_by']) puts "Name: #{dep['name']}" puts "Version: #{dep['version']}" puts "Advisory: #{vuln['name']}" puts "Severity: #{vuln['severity']}" puts "Link: #{vuln['link']}" puts "Patched: #{patched_version['spec'].join(', ')}" puts end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
hrw-0.2.3 | lib/hrw/formatter.rb |
hrw-0.2.2 | lib/hrw/formatter.rb |
hrw-0.2.1 | lib/hrw/formatter.rb |
hrw-0.2.0 | lib/hrw/formatter.rb |