Class: Rex::Zip::CompFlags

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/zip/blocks.rb

Overview

This structure holds the following data pertaining to a Zip entry.

general purpose bit flag compression method modification time modification date

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gpbf, compmeth, timestamp) ⇒ CompFlags


39
40
41
42
43
44
# File 'lib/rex/zip/blocks.rb', line 39

def initialize(gpbf, compmeth, timestamp)
  @gpbf = gpbf
  @compmeth = compmeth
  @mod_time = ((timestamp.hour << 11) | (timestamp.min << 5) | (timestamp.sec))
  @mod_date = (((timestamp.year - 1980) << 9) | (timestamp.mon << 5) | (timestamp.day))
end

Instance Attribute Details

#compmethObject

Returns the value of attribute compmeth


37
38
39
# File 'lib/rex/zip/blocks.rb', line 37

def compmeth
  @compmeth
end

Instance Method Details

#packObject


46
47
48
# File 'lib/rex/zip/blocks.rb', line 46

def pack
  [ @gpbf, @compmeth, @mod_time, @mod_date ].pack('vvvv')
end