How I Built A Windows Lock Screen Desktop App At Work - Part 2

THIS IS THE ENTIRE CODE STRUCTURE AND FUNCTION OF THE PROJECT.

Hello, world, my name is Godspower Maurice and this is the complete workout code for the windows desktop lock app I built. Don't worry, I'll try my best to be as concise as possible.
The libraries I used for this,

  1. pyautogui

  2. sleep

Install the pyautogui library with pip install pyautogui. Then open your favourite code editor, for starters, I would recommend vscode or git bash but for pros, you can use notepad :). Now, we have to pause the script for 20 minutes if the customer buys 30 minutes

STEP 1

from time import sleep 
import pyautogui 

sleep(1200)    #this is in seconds and its equivalent to 20 minutes.

Now we have to take some actions after the 20 minutes:

pyautogui.hotkey('win', 'r')  #this will open a windows run dialog box.
pyautogui.typewrite("notepad") #this will type notepad into the windows dialog box.
pyautogui.press('enter') #And this will hit the enter key on your keyboard after writing the notepad in the dialog box.

Note: Everything will happen fast. So we need to look for a way to make the script goes on human speed in some aspect, like the warning message should be on a normal human speed.

sleep(1) #scripts sleeps for 1 second again
pyautogui.write('Hello dear Customer, you have 10 minutes remaining from your browsing time, logout from your account and save neccessaries. Thank you for using our services. We hope to see you again :).\n', interval=0.25) #This will write the warning message using the normal human sleep
sleep(600) #And this will sleep for the 10 minutes remaining

STEP 2:

Now, its time to lock the desktop-run workstation

pyautogui.hotkey('win', 'r')
pyautogui.typewrite("cmd")
pyautogui.press('enter')
sleep(1)
pyautogui.typewrite("rundll32.exe user32.dll, LockWorkStation\n")
pyautogui.press('enter')

FULL CODE

#!/bin/python

import time
import pyautogui


time.sleep(1200)
pyautogui.hotkey('win', 'r')
pyautogui.typewrite("notepad")
pyautogui.press('enter')
time.sleep(1)
pyautogui.write('Hello dear Customer, you have 10 minutes remaining from your browsing time, logout from your account and save neccessaries. Thank you for using our services, we hope to see you again :).\n', interval=0.25)
time.sleep(600)

pyautogui.hotkey('win', 'r')
pyautogui.typewrite("cmd")
pyautogui.press('enter')
time.sleep(1)
pyautogui.typewrite("rundll32.exe user32.dll, LockWorkStation\n")
pyautogui.press('enter')

Overall, building a desktop lock screen app could be easy, if you want to add some other touches to this, you could use the PyQt5 which has so many widgets and also the pipwin32 library used to call the windows OS API. Python is awesome - it's a powerful and easy-to-use language that can help you bring your ideas to life.

Thank you guys, watch out for more....

Next, I'll be posting offensive and defensive tools I wrote for my Cyber Security journey. In addition, how to hack anyone and everyone using MITM attack, how to listen to anyone's call and text messages around you {that is hacking mobile phones}, and how to essentially listen to radio frequencies using an RTL-SRD dongle.

I have a lot for you guys, just remained tuned!

print("Am God’spower Maurice")

Peace Out! :)