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.



91
92
93
94
95
96
97
98
99
# File 'lib/rex/ole/propset.rb', line 91

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

	@propsets = []
end

Instance Method Details

#<<(ps) ⇒ Object



101
102
103
# File 'lib/rex/ole/propset.rb', line 101

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

#packObject



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
132
133
134
# File 'lib/rex/ole/propset.rb', line 105

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



136
137
138
# File 'lib/rex/ole/propset.rb', line 136

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