View Single Post
Old 04-05-2008   #3 (permalink)
Robertico


 
 

Re: Read and search through a binary file

Steven,

So far i've this:

Get-Content -Encoding byte $path `
|%{ " " + ("{0:x}" -f $_).PadLeft(2,"0")

It generates a list with hex values. (i needed to convert from dec to hex)
How can i search for example: 131B1B087C156108AE151B
After that, i need the fileoffset of the result to read teh previous bits.

Robertico

"Steven Murawski" wrote:
Quote:

> Robertico,
>
> This might get you started -
> http://www.microsoft.com/technet/scr.../payette2.mspx
>
> It's an excerpt from Windows Powershell in Action and there is a
> Get-HexDump function and some other info that could get you started.
>
> Both Get-Content and Select-String can read from binary files.
>
> Steven Murawski
> Steven Murawski
>
> Robertico wrote:
Quote:

> > Is it possible to read and search through a binary file.
> > I've a binary file an i'd like to search for certain hex values (markers).
> > After that i need to read eight bits just before the previous founded values.
> > (It's not a structured file)
> >
> > Thanks in advanced,
> >
> > Robertico
>
My System SpecsSystem Spec