Class: Rex::Zip::CentralDir
- Inherits:
-
Object
- Object
- Rex::Zip::CentralDir
- Defined in:
- lib/rex/zip/blocks.rb
Overview
This structure holds all of the information about a particular Zip Entry as it is contained within the central directory.
Constant Summary collapse
- SIGNATURE =
0x2014b50
Instance Method Summary collapse
-
#initialize(entry, offset) ⇒ CentralDir
constructor
A new instance of CentralDir.
- #pack ⇒ Object
Constructor Details
#initialize(entry, offset) ⇒ CentralDir
Returns a new instance of CentralDir.
110 111 112 113 114 115 116 |
# File 'lib/rex/zip/blocks.rb', line 110 def initialize(entry, offset) @entry = entry @disknum_start = 0 @attr_int = 0 @attr_ext = 0x20 @hdr_offset = offset end |
Instance Method Details
#pack ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/rex/zip/blocks.rb', line 118 def pack if @entry.central_dir_name.blank? 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 |