473,383 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Embedding exe file

hi
how i can Embed an exe file in python program ?
i want read an exe file then convert it to base64 and store in a string
format and Embedd in python code such this :

Exe='''R0lGODdhFQAVAPMAAAQ2PESapISCBASCBMTCxPxmNCQ iJJya/ISChGRmzPz+/PxmzDQyZ
DQyZDQyZDQyZCwAAAAAFQAVAAAElJDISau9Vh2WMD0gqHHelJw nsXVloqDd2hrMm8pYYiSHYfMMRm
53ULlQHGFFx1MZCciUiVOsPmEkKNVp3UBhJ4Ohy1UxerSgJGZM MBbcBACQlVhRiHvaUsXHgywTdyc
....'''

then i want execute it without converting and saving it in a separate
exe file . in the other hand i want Embedding exe file ...
how i can do it ??
ThanX for Answers ...!!

--------------------------------
First Iranian Python Community --www.python.ir

Jul 16 '06 #1
4 4485
Hi!
This script :

import base64
data=open("D:\\toto.exe","rb").read()
data64='''import base64,os
data="""'''+base64.b64encode(data)+'''"""
f=open(r"C:\\temporaire.exe","wb").write(base64.b6 4decode(data))
os.system(r"C:\\temporaire.exe")
'''
f=open("64exe.py","w").write(data64)
Create a script (ascii file) "64exe.py" with the exe "D:\toto.exe"
The script "64exe.py" (re)-create C:\temporaire.exe and run it.

It's a little basic template, for your answer.
*sorry for my bad english*

Michel Claveau

Jul 16 '06 #2
hi,ThanX
but i dont want to save the exe file in temp file and run it . i want
to run it directly from python . maybe such this :
exec("file("test.exe","rw").read())")
i want write a cd lock with python tp protect an binary file . and so i
dont want save it in other temp file fom max security ....

-----------------------------------------------------
Iranian python community --www.python.ir

Jul 17 '06 #3
In article <11**********************@s13g2000cwa.googlegroups .com>,
Bayazee <ba*****@gmail.comwrote:
>hi,ThanX
but i dont want to save the exe file in temp file and run it . i want
to run it directly from python . maybe such this :
exec("file("test.exe","rw").read())")
i want write a cd lock with python tp protect an binary file . and so i
dont want save it in other temp file fom max security ....
Jul 17 '06 #4

Bayazee wrote:
hi,ThanX
but i dont want to save the exe file in temp file and run it . i want
to run it directly from python . maybe such this :
exec("file("test.exe","rw").read())")
i want write a cd lock with python tp protect an binary file . and so i
dont want save it in other temp file fom max security ....

-----------------------------------------------------
Iranian python community --www.python.ir
If your users can run it, they can steal it. You can't keep your code
secure if you run it on their systems.

Jul 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

56
by: alan b | last post by:
I copied it and tried to edit the movie.htm below in the <PARAM NAME=*** location of the file where the videoclip is on my hard drive. It is already recorded by Windows Media Player. My version...
1
by: Tommy Nordgren | last post by:
I want to write an application that embeds and extends (at least) the Python and Perl interpreters. Now i want to find as much as possible about the Python tools used for extending and embedding...
1
by: gavinpaterson | last post by:
Dear Pythoners, I am writing as I am having trouble embedding a Python program into a Win XP C++ console application. I have written a script file for importing and I am trying to use the...
0
by: Fozzie | last post by:
Hi, I have a problem which is quite circular, and hopefully either someone has encountered something similar or has a reason why this will not work. We have a COM library providing...
3
by: Ollie Riches | last post by:
How do I embed a *.flv file (Flash Video) into an aspx page similar to embedding windows media player active x control? Cheers Ollie Riches
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.