extract the strings in an exe

?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Fernando said:
Hi,

How can I extract all the strings in an exe with python? O:)

I don't know about Python, but Unixoid systems, and on Windows, Cygwin
has a utility called 'strings' which you can use for exactly this purpose.

It's written in C and you could translate its algorithm to Python ;)

-- Gerhard
 
D

Dietrich Epp

How can I extract all the strings in an exe with python? O:)
$ strings foo.exe

--- OR ---

import os
os.exec1p('strings', 'foo.exe')

--- OR ---

import re
fooExe = file('foo.exe', 'r').read()
strings = re.findall("[\x1f-\x7e]{4,}", fooExe)

---

If you're looking for something a little more discriminating, you'll
need to ask someone who cares about executable formats. This will
probably print out the function names as well. Basically, the code
finds strings of printing characters at least four characters long.

If you're looking for the definitive list of strings, you're going to
hit your head against the cold, hard reality of executable formats not
usually storying that information. It just isn't there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,173
Messages
2,570,938
Members
47,475
Latest member
NovellaSce

Latest Threads

Top