Execute binary code

Larry Bates larry.bates at websafe.com
Mon Jan 8 21:06:12 CET 2007


citronelu at yahoo.com wrote:
> Is it possible to execute a binary string stored within a python script
> as executable code ?
> 
> The script is run under Windows, and the binary code (a full executable
> file) is stored in a variable in the script.
> 
> I know I can use os.system() or os.popen() to run an external file, but
> these functions take as argument a string evaluated as command-line.
> 
> I also know I could save the binary code as a temporary file, execute
> it and delete it afterwards, but this is not an alternative.
> 
> Thanks.
> 

What you are asking is a virus/trojan "like" program.  There's no reason
you shouldn't be able to write the code to TEMP directory and execute it.

-Larry



More information about the Python-list mailing list