AnthemPython || Related



How I Built A Windows Desktop Lock Screen App At Work

How I Built A Windows Desktop Lock Screen App At Work

AnthemPython || Related's photo
AnthemPython || Related
·Dec 30, 2022·

3 min read

Play this article

Hello, world. My name is Godspower and this is my second blog on hashnode. I don't want to write too much and bore you guys, so lately at where I work, we've been looking for a software that could lock and access the desktop only if the cafe attendant gives you the password for that particular session which is randomly generated by the software. Well, the actual plan was simple:

  • Install the software on the admin server system, so only the right person has access to the admin panel.

  • We wanted to generate more money for the company using that integrated system.

  • We were tired of people using the system to type without paying.

So I integrated a possible solution which was, look for a software online that could just lock the system and open when the actual password is giving to it for that session. Note: this was all personal stuff, we never told the management, we just wanted to see if we could see such software for free but unfortunately for us, we couldn't find a free software for that purpose, the rest are all paid subscriptions.

As a software engineer, I knew it was time to be creative and apply professionalism, so I opened Vs Code on my Kali Linux machine [Favourite Code Editor].

I used python to automate the process by:

  • Import all the necessary libraries

  • Do the actual coding

Used auto-py-to-exe to convert the .py files to .exe executables. The library called auto-py-to-exe could convert any .py files to .exe which is windows executable applications extension.

But there was a problem since it'd auto generate random passwords, that means i needed a live server, two things are involved, I needed to set up an account in the cloud or use any development server but choice number 2 was not a good option because this stuff is something they'd be using every day, so using a development server is not just an option and my colleagues, they don't really know how to operate stuff in the cloud, ansible was another stuff that got to my head, why not automate with ansible but everything still boils down to a live cloud server and that would cost me to setup an instance. Mehn, I don't want to spend money on that, I had to do a change plans. So i thought about putting password on the system and then using the windows lock workstation command to lock the desktop. StackOverflow came in handy😊😊.....

So in a way, StackOverflow gave me a way, now this was my pseudo code structure in python:

  • Necessary libraries imported

  • Use the time library to pause the session, let's say a customer bought 30 minutes so we pause for 1200 seconds which is equivalent to 20 minutes.

  • Anytime it reaches 10 minutes to finish, the script should open up a notepad warning the customer that he or she has 10 minutes more to round up what they are doing then pauses for another 10 minutes to complete 30 minutes.

  • After the pausing, it should lock the desktop workstation immediately the 30 minutes is completed.

All mapped out and I was done, so I used the auto-py-to-exe and converted the python files to windows executables and it worked fine as expected. Sorry for not putting the codes. Watch out for part 2 of this post where I'll be putting down every pieces of code and how they all work.

Thank you all guys for reading!

print("My name is Godspower Maurice")

Peace out!

Share this