Method: Rex::Text.pattern_offset
- Defined in:
- lib/rex/text.rb
.pattern_offset(pattern, value, start = 0) ⇒ Fixnum?
Calculate the offset to a pattern
1382 1383 1384 1385 1386 1387 1388 1389 1390 |
# File 'lib/rex/text.rb', line 1382 def self.pattern_offset(pattern, value, start=0) if (value.kind_of?(String)) pattern.index(value, start) elsif (value.kind_of?(Fixnum) or value.kind_of?(Bignum)) pattern.index([ value ].pack('V'), start) else raise ::ArgumentError, "Invalid class for value: #{value.class}" end end |