Class: Rex::OLE::PropertySetStream

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/ole/propset.rb

Instance Method Summary collapse

Constructor Details

#initializePropertySetStream

Returns a new instance of PropertySetStream


88
89
90
91
92
93
94
95
96
# File 'lib/rex/ole/propset.rb', line 88

def initialize
  @byte_order = 0xfffe
  @ole_version = 0
  @os_version = 1
  @os_platform = 2
  @clsid = CLSID.new

  @propsets = []
end

Instance Method Details

#<<(ps) ⇒ Object


98
99
100
# File 'lib/rex/ole/propset.rb', line 98

def <<(ps)
  @propsets << ps
end

#packObject


102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/rex/ole/propset.rb', line 102

def pack
  buf = ''

  # First, add the header
  buf << [
    @byte_order,
    @ole_version,
    @os_version,
    @os_platform
  ].pack('vvvv')
  buf << @clsid.pack
  buf << [@propsets.length].pack('V')

  # Pack all the PropertySet children
  data = []
  @propsets.each { |p|
    data << p.pack_data
  }

  # Next, add all the FMTID and Offset headers
  off = buf.length + (20 * @propsets.length)
  @propsets.each_with_index { |ps,x|
    buf << ps.pack_fno(off)
    off += data[x].length
  }

  # Finally, add all the data
  buf << data.join
  buf
end

#to_sObject


133
134
135
# File 'lib/rex/ole/propset.rb', line 133

def to_s
  "Rex::OLE::PropertySetStream - to_s unimplemented"
end