Class: Rex::Zip::CentralDirEnd

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

Overview

This structure is written after the per-entry central directory records to provide information about the archive as a whole.

Constant Summary collapse

SIGNATURE =
0x6054b50

Instance Method Summary collapse

Constructor Details

#initialize(ncfd, cfdsz, offset, comment = nil) ⇒ CentralDirEnd

Returns a new instance of CentralDirEnd


156
157
158
159
160
161
162
163
164
165
# File 'lib/rex/zip/blocks.rb', line 156

def initialize(ncfd, cfdsz, offset, comment=nil)
  @disk_no = 0
  @disk_dir_start = 0
  @ncfd_this_disk = ncfd
  @ncfd_total = ncfd
  @cfd_size = cfdsz
  @start_offset = offset
  @comment = comment
  @comment ||= ''
end

Instance Method Details

#packObject


168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/rex/zip/blocks.rb', line 168

def pack
  arr = []
  arr << SIGNATURE
  arr << @disk_no
  arr << @disk_dir_start
  arr << @ncfd_this_disk
  arr << @ncfd_total
  arr << @cfd_size
  arr << @start_offset
  arr << @comment.length
  (arr.pack('VvvvvVVv') + @comment)
end