Class: Rex::OLE::CLSID
- Inherits:
-
Object
- Object
- Rex::OLE::CLSID
- Defined in:
- lib/rex/ole/clsid.rb
Instance Method Summary collapse
-
#initialize(buf = nil) ⇒ CLSID
constructor
A new instance of CLSID.
- #pack ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(buf = nil) ⇒ CLSID
Returns a new instance of CLSID.
14 15 16 17 |
# File 'lib/rex/ole/clsid.rb', line 14 def initialize(buf=nil) @buf = buf @buf ||= "\x00" * 16 end |
Instance Method Details
#pack ⇒ Object
19 20 21 |
# File 'lib/rex/ole/clsid.rb', line 19 def pack @buf end |
#to_s ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rex/ole/clsid.rb', line 23 def to_s ret = "" ret << "%08x" % Util.get32(@buf, 0) ret << "-" ret << "%04x" % Util.get16(@buf, 4) ret << "-" ret << "%04x" % Util.get16(@buf, 6) ret << "-" idx = 0 last8 = @buf[8,8] last8.unpack('C*').each { |byte| ret << [byte].pack('C').unpack('H*')[0] ret << "-" if (idx == 1) idx += 1 } ret end |