Re: Search an entire drive for character string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2005-11-14 at 22:54 -0700, David G. Miller (aka DaveAtFraud)
wrote:
> There is (was?) a hex editor for linux called bev that might do the 
> trick.  The problem with using dd and grep (e.g., dd if=/dev/hda | grep 
> 'string') is the best you will get is that the string you're interested 
> in is somewhere on the disk.

One could probably narrow it down to disk blocks, by checking them all
individually, like this:

$dev is the device to search
$size is the size of $dev in 1k blocks
$string is your search string

n=0; while [[ $n -lt $size ]]; do
  dd if=$dev bs=1k skip=$n count=1 2>/dev/null | \
  grep -q "$string" && echo Disk block $n matches.
  ((n=n+1))
done

Cheers
Steffen.

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux