class Rex::Zip::CentralDir

This structure holds all of the information about a particular Zip Entry as it is contained within the central directory.

Constants

SIGNATURE

Public Class Methods

new(entry, offset) click to toggle source
# File lib/rex/zip/blocks.rb, line 109
def initialize(entry, offset)
  @entry = entry
  @disknum_start = 0
  @attr_int = 0
  @attr_ext = 0x20
  @hdr_offset = offset
end

Public Instance Methods

pack() click to toggle source
# File lib/rex/zip/blocks.rb, line 117
def pack
  if @entry.central_dir_name.to_s.empty?
    path = @entry.relative_path
  else
    path = @entry.central_dir_path
  end

  ret = [ SIGNATURE, ZIP_VERSION ].pack('Vv')
  ret << [ ZIP_VERSION ].pack('v')
  ret << @entry.flags.pack
  ret << @entry.info.pack
  arr = []
  arr << path.length
  arr << @entry.xtra.length
  arr << @entry.comment.length
  arr << @disknum_start
  arr << @attr_int
  arr << @entry.attrs
  arr << @hdr_offset
  ret << arr.pack('vvvvvVV')
  ret << path
  ret << @entry.xtra
  ret << @entry.comment
  # digital signature not supported
  ret
end