2005-12-17 07:46:23 +01:00
|
|
|
#!/usr/bin/env ruby
|
2005-12-09 01:03:52 +01:00
|
|
|
|
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
|
|
|
|
|
|
require 'rex'
|
|
|
|
|
2006-04-21 23:06:31 +02:00
|
|
|
if ARGV.length < 1
|
|
|
|
$stderr.puts("Usage: #{File.basename($0)} <searh item> <length of buffer>")
|
|
|
|
$stderr.puts("Default length of buffer if none is inserted: 8192")
|
|
|
|
$stderr.puts("This buffer is generated by pattern_create() in the Rex library automatically")
|
|
|
|
exit
|
2005-12-09 01:03:52 +01:00
|
|
|
end
|
|
|
|
|
2006-04-21 23:06:31 +02:00
|
|
|
value = ARGV.shift
|
|
|
|
len = ARGV.shift || 8192
|
|
|
|
|
2005-12-09 01:03:52 +01:00
|
|
|
value = value.hex if (value.length >= 8 and value.hex > 0)
|
2006-04-21 23:06:31 +02:00
|
|
|
buffer = Rex::Text.pattern_create(len.to_i)
|
2005-12-09 01:03:52 +01:00
|
|
|
|
|
|
|
puts Rex::Text.pattern_offset(buffer, value)
|