Method: Rex::Text.to_num
- Defined in:
- lib/rex/text.rb
.to_num(str, wrap = DefaultWrap) ⇒ Object
Creates a comma separated list of numbers
259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/rex/text.rb', line 259 def self.to_num(str, wrap = DefaultWrap) code = str.unpack('C*') buff = "" 0.upto(code.length-1) do |byte| if(byte % 15 == 0) and (buff.length > 0) buff << "\r\n" end buff << sprintf('0x%.2x, ', code[byte]) end # strip , at the end buff = buff.chomp(', ') buff << "\r\n" return buff end |