Sha256: 5355beb0c93b0ac4cfb99f92e27db75b4e2d11852c80d3fe8b280ce46c639cab

Contents?: true

Size: 798 Bytes

Versions: 16

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

require "dnpedia"

module Mihari
  module Analyzers
    class DNPedia < Base
      attr_reader :query
      attr_reader :title
      attr_reader :description
      attr_reader :tags

      def initialize(query, title: nil, description: nil, tags: [])
        super()

        @query = query
        @title = title || "DNPedia domain lookup"
        @description = description || "query = #{query}"
        @tags = tags
      end

      def artifacts
        lookup || []
      end

      private

      def api
        @api ||= ::DNPedia::API.new
      end

      def lookup
        res = api.search(query)
        rows = res.dig("rows") || []
        rows.map do |row|
          [row.dig("name"), row.dig("zoneid")].join(".")
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mihari-1.4.1 lib/mihari/analyzers/dnpedia.rb
mihari-1.4.0 lib/mihari/analyzers/dnpedia.rb
mihari-1.3.2 lib/mihari/analyzers/dnpedia.rb
mihari-1.3.1 lib/mihari/analyzers/dnpedia.rb
mihari-1.3.0 lib/mihari/analyzers/dnpedia.rb
mihari-1.2.1 lib/mihari/analyzers/dnpedia.rb
mihari-1.2.0 lib/mihari/analyzers/dnpedia.rb
mihari-1.1.1 lib/mihari/analyzers/dnpedia.rb
mihari-1.1.0 lib/mihari/analyzers/dnpedia.rb
mihari-1.0.1 lib/mihari/analyzers/dnpedia.rb
mihari-1.0.0 lib/mihari/analyzers/dnpedia.rb
mihari-0.17.5 lib/mihari/analyzers/dnpedia.rb
mihari-0.17.4 lib/mihari/analyzers/dnpedia.rb
mihari-0.17.3 lib/mihari/analyzers/dnpedia.rb
mihari-0.17.2 lib/mihari/analyzers/dnpedia.rb
mihari-0.17.1 lib/mihari/analyzers/dnpedia.rb