Class: DeltaAttack::FiletypeAssumption

Inherits:
Object
  • Object
show all
Defined in:
lib/delta_attack/filetype_assumption.rb

Constant Summary collapse

CONTENT_TYPES =
{
  "application/msword" => :word,
  "application/vnd.ms-excel" => :excel,
  "application/vnd.ms-powerpoint" => :power_point,
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, content_type = nil, content = nil) ⇒ FiletypeAssumption

Returns a new instance of FiletypeAssumption.



19
20
21
22
23
# File 'lib/delta_attack/filetype_assumption.rb', line 19

def initialize(filename, content_type = nil, content = nil)
  @filename = filename
  @content_type = content_type
  @content = content
end

Class Method Details

.support_magic?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/delta_attack/filetype_assumption.rb', line 15

def self.support_magic?
  defined? Mahoro
end

Instance Method Details

#content_typeObject



29
30
31
# File 'lib/delta_attack/filetype_assumption.rb', line 29

def content_type
  CONTENT_TYPES.index(filetype)
end

#filetypeObject



25
26
27
# File 'lib/delta_attack/filetype_assumption.rb', line 25

def filetype
  by_content_type || by_extention || :unknown
end