Sha256: 0980689d95e9944037da72f4c583d47d253c3746732a33251b98f55e644698f6
Contents?: true
Size: 1.27 KB
Versions: 20
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true require "parallel" module Mihari module Analyzers class PassiveSSL < Base attr_reader :query attr_reader :type attr_reader :title attr_reader :description attr_reader :tags ANALYZERS = [ Mihari::Analyzers::CIRCL, Mihari::Analyzers::PassiveTotal, ].freeze def initialize(query, title: nil, description: nil, tags: []) super() @query = query @type = TypeChecker.detailed_type(query) @title = title || "PassiveSSL cross search" @description = description || "query = #{query}" @tags = tags end def artifacts Parallel.map(analyzers) do |analyzer| run_analyzer analyzer end.flatten end private def valid_type? %w(sha1).include? type end def analyzers raise InvalidInputError, "#{query}(type: #{type || 'unknown'}) is not supported." unless valid_type? ANALYZERS.map do |klass| klass.new(query) end end def run_analyzer(analyzer) analyzer.artifacts rescue ArgumentError, InvalidInputError => _e nil rescue ::PassiveCIRCL::Error, ::PassiveTotal::Error => _e nil end end end end
Version data entries
20 entries across 20 versions & 1 rubygems