2005-12-17 06:46:23 +00:00
|
|
|
#!/usr/bin/env ruby
|
2010-05-03 17:13:09 +00:00
|
|
|
# $Id$
|
|
|
|
# $Revision$
|
2005-12-09 00:03:52 +00:00
|
|
|
|
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
|
|
|
|
|
|
require 'rex'
|
|
|
|
|
2010-11-05 00:06:31 +00:00
|
|
|
if ARGV.length < 1
|
2006-11-13 13:38:11 +00:00
|
|
|
$stderr.puts("Usage: #{File.basename($0)} <search item> <length of buffer>")
|
2006-04-21 21:06:31 +00:00
|
|
|
$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 00:03:52 +00:00
|
|
|
end
|
|
|
|
|
2006-04-21 21:06:31 +00:00
|
|
|
value = ARGV.shift
|
|
|
|
len = ARGV.shift || 8192
|
|
|
|
|
2005-12-09 00:03:52 +00:00
|
|
|
value = value.hex if (value.length >= 8 and value.hex > 0)
|
2006-04-21 21:06:31 +00:00
|
|
|
buffer = Rex::Text.pattern_create(len.to_i)
|
2005-12-09 00:03:52 +00:00
|
|
|
|
2009-11-09 17:50:53 +00:00
|
|
|
offset = Rex::Text.pattern_offset(buffer, value)
|
|
|
|
while offset
|
|
|
|
puts offset
|
|
|
|
offset = Rex::Text.pattern_offset(buffer, value, offset + 1)
|
|
|
|
end
|