Sha256: bf2460ee44195f0c443ab57758b9559836ec4704478a4870c2ecc583a393ffc0
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
# # Standard libraries # require 'json' # # Third-party libraries # require 'rainbow' 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 version: #{patched_version['spec'].join(', ')}" puts end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hrw-0.1.0 | lib/hrw/formatter.rb |