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.



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

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

Instance Method Details

#<<(val) ⇒ Object



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

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

#pack_dataObject



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

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



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

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

#to_sObject



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

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