Jun 17, 2024 08:47 AM
(This post was last modified: Jun 17, 2024 08:53 AM by Qismon.)
![[Image: oKTRsJt.gif]](https://i.imgur.com/oKTRsJt.gif)
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/bash
new_license() {
printf "Enter username: "
read -r licenseUser
printf "Enter password: "
read -r licensePass
printf "Date Format >> 2024-04-20\n"
printf "Enter cutoff date: "
read -r cutoffDate
adduser --quiet --disabled-password --gecos "User" $licenseUser
echo "$licenseUser:$licensePass" | chpasswd
usermod -e $cutoffDate $licenseUser
chmod +x /root/PythonApp.py
usermod -s /root/PythonApp.py $licenseUser
}
new_license4. 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.


![[Image: main.gif]](https://i.ibb.co/W2WKpzj/main.gif)

![[Image: main.gif]](https://i.ibb.co/MZkhhV6/main.gif)

![[Image: O444cFs.jpg]](https://i.ibb.co/c2rr5jw/O444cFs.jpg)

![[Image: rezize.png]](https://i.ibb.co/Xr4Yw73n/rezize.png)