John,
Thanks for reminding me of the mmap module. The following worked as
expected.
#
import mmap
source_data = open("source_file.bin", 'rb').read()
search_data = open("search_data.bin", 'rb').read()
replace_data = open("replace_data.bin",
Bengt,
Thanks for the input, sorry, your diff threw me the first time I looked
at it, but then I went back and tried it later. Yes it works fine and
I've tucked it away for later use. For this particular Use Case
String.replace seems to get the job done in short order and the tool
needs to be ma
Thanks Francois,
It worked as expected.
---
source_data = open("source_data.bin", 'rb').read()
search_data = open("search_data.bin", 'rb').read()
replace_data = open("replace_data.bin", 'rb').read()
outFile = open("
On Wed, Jan 12, 2005 at 10:36:54PM -0800, yaipa wrote:
> What would be the common sense way of finding a binary pattern in a
> .bin file, say some 200 bytes, and replacing it with an updated pattern
> of the same length at the same offset?
>
> Also, the pattern can occur on any byte boundary in th
On 14 Jan 2005 15:40:27 -0800, "yaipa" <[EMAIL PROTECTED]> wrote:
>Bengt, and all,
>
>Thanks for all the good input. The problems seems to be that .find()
>is good for text files on Windows, but is not much use when it is
>binary data. The script is for a Assy Language build tool, so I know
Did
Bengt, and all,
Thanks for all the good input. The problems seems to be that .find()
is good for text files on Windows, but is not much use when it is
binary data. The script is for a Assy Language build tool, so I know
the exact seek address of the binary data that I need to replace, so
maybe
On Thu, 13 Jan 2005 11:40:52 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>
>> BTW, I'm sure you could write a generator that would take a file name
>> and oldbinstring and newbinstring as arguments, and read and yield nice
>> os-file-system-friendly disk-sector-multiple ch
On Thu, 13 Jan 2005 11:40:52 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>
>> BTW, I'm sure you could write a generator that would take a file name
>> and oldbinstring and newbinstring as arguments, and read and yield nice
>> os-file-system-friendly disk-sector-multiple ch
Bengt Richter wrote:
BTW, I'm sure you could write a generator that would take a file name
and oldbinstring and newbinstring as arguments, and read and yield nice
os-file-system-friendly disk-sector-multiple chunks, so you could write
fout = open('mynewbinfile', 'wb')
for buf in updated_fil
[Stephen Thorne]
> On 12 Jan 2005 22:36:54 -0800, yaipa <[EMAIL PROTECTED]> wrote:
>
> > What would be the common sense way of finding a binary pattern in
> > a .bin file, say some 200 bytes, and replacing it with an updated
> > pattern of the same length at the same offset? The file itself
> > i
On Thu, 13 Jan 2005 16:51:46 +1000, Stephen Thorne <[EMAIL PROTECTED]> wrote:
>On 12 Jan 2005 22:36:54 -0800, yaipa <[EMAIL PROTECTED]> wrote:
>> What would be the common sense way of finding a binary pattern in a
>> .bin file, say some 200 bytes, and replacing it with an updated pattern
>> of the
On 12 Jan 2005 22:36:54 -0800, yaipa <[EMAIL PROTECTED]> wrote:
> What would be the common sense way of finding a binary pattern in a
> .bin file, say some 200 bytes, and replacing it with an updated pattern
> of the same length at the same offset?
>
> Also, the pattern can occur on any byte bound
12 matches
Mail list logo