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.
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 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!
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 made a small script that solves an combinatorial optimization problem and I would like put it in a website so users can "play" with it, they could send a list of "points" to the server and this script would use a database to return the best combination of these "points".
The problem is I do not have much experience in web dev. I searched how to make an html button execute an script and I found this thread: https://stackoverflow.com/questions/48552343/how-can-i-execute-a-python-script-from-an-html-button#:~:text=To%20run%2C%20open%20command%20prompt,Hope%20this%20helpful.
But there says that an html button calling an python script is not safe. So what would be ideal What would be an ideal, safe alternative so that I could make sure that anyone who accesses my website can execute this script safely?
Well, there's no "easy" answer to your question. What you'd really need to do is to create a web-site in Python on your host computer – using a tool such as Django – and have one of the URLs supported by that website call your script.
Honestly, "what you're asking for here, really isn't the sort of question that StackOverflow is intended to answer." It's too big. Another one of the SE-family sites might be more appropriate, although I'm not quite sure which one ...
The solution that comes to mind would be setting up some Python-API (e.g. with Flask) which you could call with HTTP via JS, having different routes for different usages.
Here's a short overview of Flask showcasing how it could be used.
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 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 7 years ago.
Improve this question
I'm searching for a way to generate a (limited time license) .so
when a user starts the program . it has to check license date first before the program runs.
but the problem is :
i tried a couple of solutions . one of them is python's time.ctime , (to check time and see if it's realy during the license time) and it returns the time of the machine, so whenever a user want to use software without license he'll just change time of the machine.
i hope the idea is clear enough
any better ideas?
please inform me if you want more explanation
Regardless with the question whether or not this hassle is really worth the effort, you can check access times of ubiquitous files (e.g. /etc/passwd in Linux) and compare these to the current date. If you see that the files have been accessed/modified in the future, you know that there is a problem. Again, at least in *nix, a user may substitute system's stat, so that it "massages" the info you are looking at.
You could get the time from an external source via Internet: Python Getting date online?
Of course, this will only work if the user doesn't block your program from accessing the internet. And what should your program do when it can't access the internet? Refuse to run? I doubt that this is a good idea.
Nearly every standard function will return the machine time that can be adjusted by the user.
One possibility is to call a web service that returns the "correct" time. But this is only possible if you can assume internet access.
And may be should ask your self the question if that hassle is really worth the effort?