An unusual question...

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Apr 17 11:22:14 EDT 2011


On Sun, 17 Apr 2011 13:15:01 +0100, wisecracker wrote:

> OK here we go...
> 
> I can easily place a machine code, PURE binary, routine into Python.

What do you mean by "into Python"? Do you mean patching the Python 
compiler? Injecting code into the runtime interpreter? Storing a bunch of 
bytes in memory?

What machine code, for which CPU?


> I can also find out where it is EXACTLY just as easily so this is not my
> problem.

And how would you do that?


> The problem is calling it!
> 
> If I wrote an Assembly(/Assembler) routine to call this binary code
> using say the JMP instruction or using PUSH absolute value and RET, and,
> call these "Jump" using:-
> 
> os.system("/full//path/to/Jump <address_of_binary_in_ascii>")
> 
> can I expect a "segmentation error" 

Almost certainly. 

Sorry to be cynical, but if you have to ask these questions, you almost 
certainly don't have the skill to successfully pull it off.

Reading your questions is a bit like hearing somebody saying "I have a 
Swiss Army Knife. If I poke around here in somebody's chest, can I do a 
heart transplant, or do you think they might die?"




> OR because the "Jump" command is
> already inside the Python terminal would this be considered inside
> Python`s working memory from the MMUs point of view?

I don't know. That depends on what you mean by "into Python".



-- 
Steven



More information about the Python-list mailing list