471,353 Members | 1,469 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,353 software developers and data experts.

extract the strings in an exe

Hi,

How can I extract all the strings in an exe with python? O:-)
Jul 18 '05 #1
3 4433
Fernando Rodriguez wrote:
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

Jul 18 '05 #2

On Nov 21, 2003, at 2:52 AM, Fernando Rodriguez wrote:
How can I extract all the strings in an exe with python? O:-)

CTRL-D

$ 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.
Jul 18 '05 #3
Fernando Rodriguez <fr*@easyjob.net> wrote in message news:<1j********************************@4ax.com>. ..
Hi,

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


Looks like this might be of use (look for SRV):

http://www.micon.no/PythonPage.asp

I haven't tried it myself; just came across it looking for something else.

TJG
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Logical | last post: by
9 posts views Thread by Sharon | last post: by
4 posts views Thread by Barry | last post: by
9 posts views Thread by flit | last post: by
4 posts views Thread by Horacius ReX | last post: by
3 posts views Thread by SteveB | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.