Sha256: d4cb82a39b29c90fd2ad939ebdec76d550fd98f7253a95cf460062166646f510

Contents?: true

Size: 798 Bytes

Versions: 9

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

module Fushin
  module Models
    class Attachment < Model
      attr_reader :url
      def initialize(url)
        @url = url
      end

      def sha256
        @sha256 ||= [].tap do |out|
          res = HybridAnalysis.quick_url_scan(url)
          out << res.dig("sha256")
        end.first
      end

      def title
        "HA: #{sha256}"
      end

      def ha_link
        "https://www.hybrid-analysis.com/sample/#{sha256}/"
      end

      def to_attachements
        [
          {
            fallback: "HA link",
            title: title,
            title_link: ha_link,
            footer: "hybrid-analysis.com",
            footer_icon: "http://www.google.com/s2/favicons?domain=hybrid-analysis.com"
          }
        ]
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fushin-0.4.2 lib/fushin/models/attachment.rb
fushin-0.4.1 lib/fushin/models/attachment.rb
fushin-0.4.0 lib/fushin/models/attachment.rb
fushin-0.3.4 lib/fushin/models/attachment.rb
fushin-0.3.3 lib/fushin/models/attachment.rb
fushin-0.3.2 lib/fushin/models/attachment.rb
fushin-0.3.1 lib/fushin/models/attachment.rb
fushin-0.3.0 lib/fushin/models/attachment.rb
fushin-0.2.0 lib/fushin/models/attachment.rb