Class: Rex::OLE::PropertySet

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

Instance Method Summary collapse

Constructor Details

#initialize(fmtid = nil) ⇒ PropertySet

Returns a new instance of PropertySet.



46
47
48
49
# File 'lib/rex/ole/propset.rb', line 46

def initialize(fmtid = nil)
	@fmtid = CLSID.new(fmtid)
	@properties = []
end

Instance Method Details

#<<(val) ⇒ Object



51
52
53
# File 'lib/rex/ole/propset.rb', line 51

def <<(val)
	@properties << val
end

#pack_dataObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/rex/ole/propset.rb', line 59

def pack_data
	# Pack all the property data
	data = []
	dlen = 0
	@properties.each { |p|
		dat = p.pack_data
		dlen += dat.length
		data << dat
	}

	buf = ''
	# First the header
	off = 8 + (@properties.length * 8)
	buf << [ off + dlen, @properties.length ].pack('V*')
	# Now, the Property Id and Offset for each
	@properties.each_with_index { |p,x|
		buf << p.pack_pio(off)
		off += data[x].length
	}
	# Finally, all the data
	buf << data.join
	buf
end

#pack_fno(off = 0) ⇒ Object



55
56
57
# File 'lib/rex/ole/propset.rb', line 55

def pack_fno(off = 0)
	@fmtid.pack + [ off ].pack('V')
end

#to_sObject



83
84
85
# File 'lib/rex/ole/propset.rb', line 83

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