Method: Rex::Text.to_csharp
- Defined in:
- lib/rex/text.rb
.to_csharp(str, wrap = DefaultWrap, name = "buf") ⇒ Object
236 237 238 239 240 241 242 243 244 245 |
# File 'lib/rex/text.rb', line 236 def self.to_csharp(str, wrap = DefaultWrap, name = "buf") ret = "byte[] #{name} = new byte[#{str.length}] {" i = -1; while (i += 1) < str.length ret << "\n" if i%(wrap/4) == 0 ret << "0x" << str[i].unpack("H*")[0] << "," end ret = ret[0..ret.length-2] #cut off last comma ret << " };\n" end |