binutils "strings" like functionality?
cjl
cjlesh at gmail.com
Thu Mar 3 14:47:13 EST 2005
Fredrik Lundh wrote:
> something like this could work:
>
> import re
>
> text = open(file, "rb").read()
>
> for m in re.finditer("([\x20-\x7f]{4,})[\n\0]", text):
> print m.start(), repr(m.group(1))
Hey...that worked. I actually modified:
for m in re.finditer("([\x20-\x7f]{4,})[\n\0]", text):
to
for m in re.finditer("([\x20-\x7f]{4,})", text):
and now the output is nearly identical to 'strings'. One problem
exists, in that if the binary file contains a string
"monkey/chicken/dog/cat" it is printed as "mokey//chicken//dog//cat",
and I don't know enough to figure out where the extra "/" is coming
from.
Help?
-CJL
More information about the Python-list
mailing list