Wrapper round x86 Assembler

G

Greg Ewing

Fuzzyman said:
The only compielr I have is gcc under mingw - and I'm not at all sure
it's set up right. Does pyrex still need a C-compiler or *is* pyrex a
compiler ?

It needs a C compiler. MinGW should be fine
(once you get it set up properly, anyway:).
 
A

Andrew MacIntyre

MinGW seems easy enough to install - I've even compiled example C
programs with gcc - but getting disutils to use it is another
matter...

Distutils won't use MinGW by default, as VS6 is the "native" compiler.

You use MinGW by specifying the compiler on the command line with the
"-compiler=mingw" option to the setup script - note that this is from
memory, but there is a page on www.python.org that contains more
information about using MinGW to build extensions.
 
C

Chris Liechti

(e-mail address removed) (Fuzzyman) wrote in

Yeah - I'm having great fun getting it set up.
MinGW seems easy enough to install - I've even compiled example C
programs with gcc - but getting disutils to use it is another
matter...

add the bin dir of mingw to the PATH variable, do the pexports stuff to
create an import lib and then use e.g.
python setup.py build --compiler=mingw32

see here for the pexports part:
http://docs.python.org/inst/tweak-flags.html#SECTION000620000000000000000

chris
 
F

Fuzzyman

[snip..]
The following has been reposted by Bradley Schatz to the ctypes mailing
list, it may indeed contain what you want, and it *is* very
interesting. The original post was to the bugtraq mailing list (or so):

from (e-mail address removed)

Today marks another solar cycle I've spent on this planet. To celebrate I'd
like to share one of my toys with all of you.

Adder is a tool I wrote for myself, so that I could experiment with runtime
modification of binary applications. I've found it really useful for
prototyping run-time patches, understanding the effects and possibilities of
call-hooking and other run-time program tweaks; that sort of thing. I hope
you might find it useful too...


Binary:
http://www.rootkit.com/vault/x3nophi1e/adder-0.3.3-win32.zip
( NT 4 / 2000 / XP / 2003 )

Source:
http://www.rootkit.com/vault/x3nophi1e/adder-0.3.3-src.zip

Documentation:
http://www.rootkit.com/vault/x3nophi1e/adder-manual.zip
( please read the installation instructions in here. )
[snip..]

Very interesting.
It looks like Adder *does* contain what I originally asked for - a
wrapper round an assembler, with the ability to assemble into memory
and jump into the code. All contained within a much more sophisticated
package for bug finding and reverse engineering.

*However* - I've just discovered Weave - a package that is part of the
SciPy project and allows for (almost) inline C functions that can be
dynamically compiled at run-time.

As I'd like to learn Pyrex (and so need to learn C) - I think I'll
experiment with Weave.

Thanks.

Fuzzy

http://www.voidspace.org.uk/atlantibots/pythonutils.html
 
F

Fuzzyman

[snip..]
The following has been reposted by Bradley Schatz to the ctypes mailing
list, it may indeed contain what you want, and it *is* very
interesting. The original post was to the bugtraq mailing list (or so):

from (e-mail address removed)

Today marks another solar cycle I've spent on this planet. To celebrate I'd
like to share one of my toys with all of you.

Adder is a tool I wrote for myself, so that I could experiment with runtime
modification of binary applications. I've found it really useful for
prototyping run-time patches, understanding the effects and possibilities of
call-hooking and other run-time program tweaks; that sort of thing. I hope
you might find it useful too...


Binary:
http://www.rootkit.com/vault/x3nophi1e/adder-0.3.3-win32.zip
( NT 4 / 2000 / XP / 2003 )

Source:
http://www.rootkit.com/vault/x3nophi1e/adder-0.3.3-src.zip

Documentation:
http://www.rootkit.com/vault/x3nophi1e/adder-manual.zip
( please read the installation instructions in here. )
[snip..]

Very interesting.
It looks like Adder *does* contain what I originally asked for - a
wrapper round an assembler, with the ability to assemble into memory
and jump into the code. All contained within a much more sophisticated
package for bug finding and reverse engineering.

*However* - I've just discovered Weave - a package that is part of the
SciPy project and allows for (almost) inline C functions that can be
dynamically compiled at run-time.

As I'd like to learn Pyrex (and so need to learn C) - I think I'll
experiment with Weave.

Thanks.

Fuzzy

http://www.voidspace.org.uk/atlantibots/pythonutils.html
 
F

Fuzzyman

I.m sure that what I am about to suggest isn't as high tech as you
were expecting ,
but I thought that Python already has a way of accessing functions in
a Unix
shared library, or Windows DLL.
If you cancompile Python on the platform than you no doubt have an
assembler handy too.
So, you could put your assemble language in a string; write the string
to a file;
assemble the file to create a shered library or DLL, then call the
function from Python!

I don't think I'd do it that way though :)

Cheers, Pad.


I've just discovered Weave - a package that is part of the SciPy
project and allows for (sort-of) inline C functions that can be
dynamically compiled at run-time.

So it effectively allows what you've suggested - but with C-functions
!!

As I'd like to learn Pyrex (and so need to learn C) - I think I'll
experiment with Weave.

Regards,


Fuzzy


http://www.voidspace.org.uk/atlantibots/pythonutils.html
 
F

Fuzzyman

I.m sure that what I am about to suggest isn't as high tech as you
were expecting ,
but I thought that Python already has a way of accessing functions in
a Unix
shared library, or Windows DLL.
If you cancompile Python on the platform than you no doubt have an
assembler handy too.
So, you could put your assemble language in a string; write the string
to a file;
assemble the file to create a shered library or DLL, then call the
function from Python!

I don't think I'd do it that way though :)

Cheers, Pad.


I've just discovered Weave - a package that is part of the SciPy
project and allows for (sort-of) inline C functions that can be
dynamically compiled at run-time.

So it effectively allows what you've suggested - but with C-functions
!!

As I'd like to learn Pyrex (and so need to learn C) - I think I'll
experiment with Weave.

Regards,


Fuzzy


http://www.voidspace.org.uk/atlantibots/pythonutils.html
 

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,184
Messages
2,570,978
Members
47,578
Latest member
LC_06

Latest Threads

Top