Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to merge two exe files through python and I've come to the conclusion that the easiest method of doing this would be to make an executable file that has both exe's in its resources and runs the resources of one exe, then the resources of the other (they do not have to execute simultaneously, rather just be packed into one file and take turns executing).
Any ideas?
The simplest way (which isn't simple at all) would be to first write a program in a compile-able language like c or c++. This program would open itself and look for a delimiter of when the next program begins.
Example:
[exe header][code]{delimiter}[program2]
From there you can read that code and write it into a new exe file (if the second program is a exe) or multiple other ways. Then run the second program. Python could be used to pack the second program onto the first one but...
This is almost exclusively used for malicious programs as the "unpacking" program can be made to not be detected by anti-viruses and the malicious program can be encrypted. Due to this, this is as far as I will go and I won't be giving any examples.
If you have any specific questions about code your working on like errors or unexpected results I am sure many people would be up to helping you. Please let me know if you have any questions!
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Does anybody know of a methodology to get a remote file from a server using a python script, that will work suitably well for very large files?
I'm currently using Paramiko, and it works quite well, however i'm concerned that the target use case for this will be .bag files of considerable size, potentially around 10 gig. My limited understanding of this is that the downloaded file will be stored in RAM rather than on the drive, until I store it onto the drive.
Or am I loking at optimising a problem that doesn't exist?
Is there a way to save the data as it is being downloaded?
I had thought about just using a bash script, which i suppose would work, but there's a lot of additional functionality that is required. Hence my use of python.
Another option would be to use OS library to simply run SFTP.
I'd appreciate anyones thoughts on this.
Thanks!
It would seem my understanding of Paramiko and SCP / SFTP was flawed.
The default way to do it, does not store it in RAM, and i'd misread code that I'd written last year - we're all guilty of that!
A minimum working example -
def DownloadSFTP(self):
self.sftp.get(self.remotepath, self.localpath)
self.sftp.close()
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I am trying to create a batch script to format my pc and create a backup file for me while the formating process starts . How i am able to make such type of batch script please help me guys
No you can't & It's not advisable to run these kind of scripts in you cmd/Powershell....
It's completely waste of time...Even though if we build such scripts, We have to make that script such that it has to bypass all the permissions...After lot effort even though once we managed to build it...It wont work on different systems...Because a whole new permissions has to be bypassed manually..So it's not advisable to make such scripts run on PC
You can't format a PC, but you can format a disk using format command. And for backup you can copy files to a folder or a disk using xcopy.
You should first create and run one script, before the process start, 'cause u could potencially overlap the time that the OS need to prepare the process, that saves you work, files, statuses... etc
Write another one that it's able to read and execute this one.
Then you can upload them (or write the process to autoupload it in the script) to save both in any cloud based solution.
Finally, when the PC is restored, you just need to download it one from the cloud, and it should be able to download the another one and run it, restablishing your previous status.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a activity in school about how a hacker might hack your pc without knowing, I was assigned to make a self running file, what I'm trying to do is, when a person for eg. Downloads a file, then without he opening it should already run without even the user opening it. Is this possible?
This is not possible, not really actually.
If you want a file to be executed without the user executing it first after download, you will have to do one of such things:
Have an already running program on his machine that looks for your file and then executes it when he finds it in the downloads (MAGIC in the beginning of the file for example or hash validation).
Take advantage of a poorly protected software that executes other files or codes (Or override a standard library) file and make it run your code instead. of course this is not as simple as it sounds and requires you to understand the software that you are attacking pretty good.
Note: Most programs won't just execute some arbitrary code and probably wont just use execv for no reason or without making sure that everything is correct and protected, which makes that solution (Without finding a security breach in the software) pretty difficult.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have been making a games using pygame and python and I don't need to make more, separate python files to run my game, but when I look at other peoples programs, they have different files that all work in conjunction with each other for their program to work, why not have all or most of the coding in one file?
I use python 3.2.5 and the corresponding pygame
--- Me in the future --- I apologise for asking this question I didn't know exactly what this website was for and how to ask questions ect. I know know that this website inst for opinions.
People do this because it makes the program more readable.
While writing some code you have to understand the difficulty of the people who will maintain your code.
The main advantages of making it in separate files are:
modularity- By using separate files different modules of the program can be separated into different files. This has many advantages. Whenever a problem occur in some part of the code you can look straight into that file.
Readability- Splitting program into different files helps in making it more readable and beautiful.
easy to maintain- Similar to the advantage told in modularity. Whenever some part of the program needs to be updated it can be done easily.
code reuse- If the program is split carefully into different modules, you can use the same code later when a similar problem has to be solved
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Im not positive on the terminology here, so that may explain why searching on my own yielded no results.
I was just curious if there is a widely accepted, general method to writing a module in python. Obviosuly people prefer splitting things into segmented .py scripts, importing when needed, and packing it all into a folder.
What I want to know: Is there a general method to how/when/why we stop writing things together in one .py and begin a new one (And i mean other than obvious things like... one script .py for the main job, and then a preferences.py to handle reading/writing prefs)
You should split your code into multiple modules when it begins to be unwieldy to keep it all in one module. This is to some extent a matter of taste. Note that it may unwieldy for the code author (i.e., file is too big to navigate easily) or for the user of the library (e.g., too many unrelated functions/classes jammed together in the same namespace, hard to keep track of them).