![]() |
|
[Tutorial] License System for Python apps. - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Tutorial] License System for Python apps. (/showthread.php?tid=6273485) Pages: Pages
1
2
|
License System for Python apps. - Qismon - Jun 17, 2024 ![]() Lately I have had a few people ask about how to sell/rent a Python app without having it leaked or cracked. Many people suggest using Beeware to compile it into an executable, but we all know that can easily be reversed. What I have done to secure a few programs I have made in Python is develop an interactive console menu as the front-end if you will. You install your app onto a simple bare-bones Debian VPS and modify the user logins to execute the app instead of bash/shell. 1. Make sure to add the shebang at the top of the python app that you want run on login. Code #!/usr/bin/env python32. Also add this code to the main function of your app before any other code so you are in the correct working path. Code os.chdir("/path/to/python/app")3. Create a new file called new_license.sh and include the code below. Code #!/bin/bash4. Make the new_license.sh executable. Code chmod +x new_license.sh5. Create a new user by running the bash script and entering the needed information. This step can be repeated when needed to create a new user. Code ./new_license.shNow login by ssh using ssh or putty and the user/pass you set in step 5. You should be presented with your console application. Enjoy and if you run into any problems send me a DM and I can help you out. RE: License System for Python apps. - Ren And Stimpy - Jun 17, 2024 Nice share mate! Keep it up! RE: License System for Python apps. - mtaujanskas - Jun 17, 2024 so this is restricted to ssh access only? and what if the program is nontrivial and requires any sort of i/o? RE: License System for Python apps. - Tentco - Jun 17, 2024 (Jun 17, 2024 03:35 PM)mtaujanskas Wrote: so this is restricted to ssh access only? and what if the program is nontrivial and requires any sort of i/o? Idk about this but for windows, simply use https://github.com/Nuitka/Nuitka and use a pre-existing license SDK, like KeyAuth. RE: License System for Python apps. - Qismon - Jun 18, 2024 (Jun 17, 2024 03:35 PM)mtaujanskas Wrote: so this is restricted to ssh access only? and what if the program is nontrivial and requires any sort of i/o? In that case I use a Flask server as an example and I run it as a service. All incoming data is stored in a sqlite3 DB and the ConsoleMenu can access it when logged in through SSH. If you need to do something like a download then you can write a file temporary to /var/www/html. (Jun 17, 2024 06:45 PM)Tentco Wrote: Idk about this but for windows, simply use https://github.com/Nuitka/Nuitka and use a pre-existing license SDK, like KeyAuth. You can do same on Windows, just host the app on Linux so its always running. Then in Windows use cmd.exe/powershell.exe to run ssh. Nuitka I feel is same as Beeware in terms of cracking though and the file size for any Python app is huge once compiled. RE: License System for Python apps. - Tentco - Jun 18, 2024 (Jun 18, 2024 05:55 AM)Qismon Wrote: In that case I use a Flask server as an example and I run it as a service. All incoming data is stored in a sqlite3 DB and the ConsoleMenu can access it when logged in through SSH. Nuitka is not same, it translates source to C and is obviously less in size most of the time. RE: License System for Python apps. - Qismon - Jun 18, 2024 (Jun 18, 2024 06:10 AM)Tentco Wrote: Nuitka is not same, it translates source to C and is obviously less in size most of the time. Honestly I have not tried it before, but it uses CPython correct? I have never been able to get a exe for Python less than 7MB and even with just print() it gets detected as malware. RE: License System for Python apps. - Tentco - Jun 18, 2024 (Jun 18, 2024 06:19 AM)Qismon Wrote: Honestly I have not tried it before, but it uses CPython correct? https://github.com/Nuitka/Nuitka 7mb for hello world sounds like pyinstaller. RE: License System for Python apps. - Qismon - Jun 18, 2024 (Jun 18, 2024 06:23 AM)Tentco Wrote: https://github.com/Nuitka/Nuitka PyInstaller or Beeware had the same problem with compiled size. Thanks I'll check it out sometime today. RE: License System for Python apps. - mtaujanskas - Jun 18, 2024 (Jun 18, 2024 05:55 AM)Qismon Wrote: In that case I use a Flask server as an example and I run it as a service. All incoming data is stored in a sqlite3 DB and the ConsoleMenu can access it when logged in through SSH. so it's not a drop-in module for an application (and not even necessarily Python-specific)? and you also have to rework your application based around the axiom that you have no access to the user's system in any way whatsoever. RE: License System for Python apps. - Qismon - Jun 24, 2024 (Jun 18, 2024 08:07 AM)mtaujanskas Wrote: so it's not a drop-in module for an application (and not even necessarily Python-specific)? and you also have to rework your application based around the axiom that you have no access to the user's system in any way whatsoever. Never said it was a drop in module or Python specific. No need to rework your application at all either, it's literally 1 chdir statement to make sure you are in the same path as the running app. I have been renting a builder that runs on same tech and without any problems of having access to the users system. RE: License System for Python apps. - DashPHP - Jun 24, 2024 Interesting approach. Thanks for sharing. RE: License System for Python apps. - Novo - Jun 24, 2024 So when the user connects to the ssh user it will instantly open the python script? and what if they do CTRL + C? i did do an app like that a while ago. seems cool. RE: License System for Python apps. - Qismon - Jun 25, 2024 (Jun 24, 2024 04:15 PM)NovoDev Wrote: So when the user connects to the ssh user it will instantly open the python script? and what if they do CTRL + C? i did do an app like that a while ago. seems cool. Yes instead of opening bash shell as normal it will run the python app. Ctrl+C will kill the SSH session but if you are in a while loop or running threads then it will just break from the loop. RE: License System for Python apps. - Novo - Jun 26, 2024 (Jun 25, 2024 06:30 AM)Qismon Wrote: Yes instead of opening bash shell as normal it will run the python app. Ctrl+C will kill the SSH session but if you are in a while loop or running threads then it will just break from the loop. Seems very cool. Thank you for sharing this! |