Method: Rex::Text.to_vbapplication
- Defined in:
- lib/rex/text.rb
.to_vbapplication(str, name = "buf") ⇒ Object
Converts a raw string into a vba buffer
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/rex/text.rb', line 336 def self.to_vbapplication(str, name = "buf") return "#{name} = Array()" if str.nil? or str.empty? code = str.unpack('C*') buff = "#{name} = Array(" maxbytes = 20 1.upto(code.length) do |idx| buff << code[idx].to_s buff << "," if idx < code.length - 1 buff << " _\r\n" if (idx > 1 and (idx % maxbytes) == 0) end buff << ")\r\n" return buff end |