Re: An unusual question...

2011-04-18 Thread wisecracker
Hi Rhodri... You do realise that what id() returns is implementation-dependent, don't you? In particular, what IronPython returns isn't an address. I'm pretty sure I wrote standard Python install in one of my replies. Yeah here it is in a reply to Miki... Hmm, I was hoping to stay inside

Re: An unusual question...

2011-04-18 Thread Chris Angelico
On Mon, Apr 18, 2011 at 4:21 PM, wisecrac...@tesco.net wrote: Hi Rhodri... You do realise that what id() returns is implementation-dependent, don't you?  In particular, what IronPython returns isn't an address. I'm pretty sure I wrote standard Python install in one of my replies. Yeah

Re: An unusual question...

2011-04-18 Thread Steven D'Aprano
On Mon, 18 Apr 2011 07:21:18 +0100, wisecracker wrote: Hi Rhodri... You do realise that what id() returns is implementation-dependent, don't you? In particular, what IronPython returns isn't an address. I'm pretty sure I wrote standard Python install in one of my replies. IronPython

Re: An unusual question...

2011-04-18 Thread harrismh777
Steven D'Aprano wrote: I'm pretty sure I wrote standard Python install in one of my replies. IronPython*is* standard Python. As are Jython, PyPy and CPython. This brings up a question I have had for a while; when is PSF going to forward PythonX on over to a formal standards committee

Re: An unusual question...

2011-04-18 Thread wisecracker
Hi Chris... It sounds to me like you're trying to pull off a classic buffer overrun and remote code execution exploit, in someone else's Python program. And all I have to say is Good luck to you. Talking of nefarious usage... I wonder what this would do left unchecked on a current

Re: An unusual question...

2011-04-18 Thread Chris Angelico
On Mon, Apr 18, 2011 at 7:53 PM, wisecrac...@tesco.net wrote: Talking of nefarious usage... I wonder what this would do left unchecked on a current machine and current Python install... ### global somestring somestring = while 1:        #print somestring        somestring =

Re: An unusual question...

2011-04-18 Thread Steven D'Aprano
On Mon, 18 Apr 2011 10:53:00 +0100, wisecracker wrote: global somestring somestring = You don't need to declare a name in the global scope as global. It just is global. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: An unusual question...

2011-04-18 Thread Grant Edwards
On 2011-04-18, harrismh777 harrismh...@charter.net wrote: Steven D'Aprano wrote: I'm pretty sure I wrote standard Python install in one of my replies. IronPython*is* standard Python. As are Jython, PyPy and CPython. This brings up a question I have had for a while; when is PSF going

Re: An unusual question...

2011-04-18 Thread Rhodri James
On Mon, 18 Apr 2011 08:01:00 +0100, wisecrac...@tesco.net wrote: Hi Rhodri... You do realise that what id() returns is implementation-dependent, don't you? In particular, what IronPython returns isn't an address. I'm pretty sure I wrote standard Python install in one of my replies. Yeah

An unusual question...

2011-04-17 Thread wisecracker
Hi coders... Before I start I don`t expect an easy answer except No it can`t be done!. I have not tried it yet, I`m only asking for opinions ATM. (Except on the classic AMIGA and it DOES work for that!) I only want it to work in Linux/?IX. Windblows does not interest me at all. OK here we

Re: An unusual question...

2011-04-17 Thread Miki Tebeka
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) This is calling a different *program* outside of the current

Re: An unusual question...

2011-04-17 Thread Steven D'Aprano
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

Re: An unusual question...

2011-04-17 Thread wisecracker
Hi Miki... os.system(/full//path/to/Jump address_of_binary_in_ascii) This is calling a different *program* outside of the current Python process. I don't think it'll do what you want (different memory segments). That is what I assumed, that an os.system() call would run in a subshell.

Re: An unusual question...

2011-04-17 Thread sturlamolden
On Apr 17, 2:15 pm, wisecrac...@tesco.net wrote: I can also find out where it is EXACTLY just as easily so this is not my problem. The problem is calling it! You'll need to mmap or valloc a page-alligned memory buffer (for which the size must be a multiple of the system page size), and call

Re: An unusual question...

2011-04-17 Thread wisecracker
Hello Steven... I read the whole of your post first and you come across one abrasive character. 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? No and

Re: An unusual question...

2011-04-17 Thread wisecracker
Hi Sturla... You'll need to mmap or valloc a page-alligned memory buffer (for which the size must be a multiple of the system page size), and call mprotect to make it executable. Copy your binary code into this buffer. Then you will need to do some magic with ctypes, Cython or C to call it;

Re: An unusual question...

2011-04-17 Thread Chris Angelico
It sounds to me like you're trying to pull off a classic buffer overrun and remote code execution exploit, in someone else's Python program. And all I have to say is Good luck to you. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: An unusual question...

2011-04-17 Thread rusi
On Apr 17, 9:37 pm, wisecrac...@tesco.net wrote: Hi Sturla... You'll need to mmap or valloc a page-alligned memory buffer (for which the size must be a multiple of the system page size), and call mprotect to make it executable. Copy your binary code into this buffer. Then you will need

Re: An unusual question...

2011-04-17 Thread sturlamolden
On Apr 17, 7:25 pm, Chris Angelico ros...@gmail.com wrote: It sounds to me like you're trying to pull off a classic buffer overrun and remote code execution exploit, in someone else's Python program. And all I have to say is Good luck to you. He might. But this also has reputable use,

Re: An unusual question...

2011-04-17 Thread Steven D'Aprano
On Sun, 17 Apr 2011 10:30:01 -0700, rusi wrote: [...] If you make it work (and prove Steve wrong :-) ) please post your how/ what/where here -- I'm always happy to be proven wrong. If I was right all the time, that would mean I'd run out of things to learn, and where's the fun in that? --

Re: An unusual question...

2011-04-17 Thread wisecracker
Hi Chris... It sounds to me like you're trying to pull off a classic buffer overrun and remote code execution exploit, in someone else's Python program. And all I have to say is Good luck to you. No, not even remotely close... ;o) Note that the idea works on an AMIGA without an MMU. The

Re: An unusual question...

2011-04-17 Thread wisecracker
Hi Sturla... He might. But this also has reputable use, such as implementing a JIT compiler. E.g. this is what Psyco and PyPy does. I`ll contact you privately... Gimme a bit of time to type a monologue... ;o) -- 73... Bazza, G0LCU... Team AMIGA... http://homepages.tesco.net/wisecracker/

Re: An unusual question...

2011-04-17 Thread Rhodri James
On Sun, 17 Apr 2011 17:17:02 +0100, wisecrac...@tesco.net wrote: I`ll give you a clue... id(some_object) is close enough but NOT that close. You do realise that what id() returns is implementation-dependent, don't you? In particular, what IronPython returns isn't an address. -- Rhodri