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?
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 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 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 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 3 years ago.
Improve this question
I am attempting to make a python a "buzzer" application which will function like the buzzers in jeopardy. It will (hopefully) work by linking several computers to a main computer. When a user taps the screen of their computer, if they are the first, it will change the color of their screen and alert the main computer. Now for my question: when module would be best to like together these two computer. I would need to send the name of the computer and a timestamp and the main computer would need to respond. I was reading that something like socket might work, but i am unsure. Also, could you please give me a link to documentation on whatever module you suggest. Thanks!
You mentioned socket in your question.
https://docs.python.org/3/library/socket.html
This might be appropriate for your needs, however with multiple clients it can get quite complicated.
Also, you may want to try using email for easier connections (if you don't mind the send time of a few seconds). I know it sounds stupid, but it has worked for me in the past, with significantly less difficulty than a multi-threaded socket connection.
https://docs.python.org/3/library/email.html
https://docs.python.org/3/library/smtplib.html
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 9 years ago.
Improve this question
Is any way to use a python script to start my computer every day at a certain time? I would like to have it start my computer every day at a time at which I usually wake up.
You cannot run a python script on a computer that is Switched off.
You could however run a python script on a different computer which remotely boots up the target machine if the machine you want to start supports remote wake.
Check this link out http://www.instructables.com/id/Starting-your-linux-box-remotely/ for more details.
If you don't have access to a remote computer you could always try to check your BIOS for something in the likes of "Power ON by Alarm"
This answers most of what you may ask. You should check your BIOS for this option. If it has, perfect, if it hasn't, resort to the previous answer. If neither, well... it's pretty much impossible.
To access a BIOS, you usually press F2 or F8 at computer (not system) startup. However, things can differ a lot from PC to PC including laptops.