Method: Rex::ImageSource::Disk#index

Defined in:
lib/rex/image_source/disk.rb

#index(search, offset = 0) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rex/image_source/disk.rb', line 32

def index(search, offset = 0)
  # do a sliding window search across the disk
  while offset < size

    # get a full window size if we can, we
    # don't want to read past our boundaries
    wsize = size - offset
    wsize = WINDOW_SIZE if wsize > WINDOW_SIZE

    window = self.read(offset, wsize)
    res = window.index(search)
    return res + offset if res
    offset += WINDOW_SIZE - WINDOW_OVERLAP
  end
end