Couldn't you have the javascript encode the password in whatever encryption you want (SHA2/MD5/Whatever), and put that hash in a txt file in a secure area of the server?
Then have a python thread constantly check that file for data. If it finds any, it checks if it's the correct hash.
Now, you have another function (Shutdown), that turns off the computer. It constantly checks a variable, shutdown1. Initially, it equals 0, but that thread will set it to 1 if the correct hash is used. If the variable is set to 1, the program continues on to shutting down the computer.
It might be kinda messy, but it should work with some work.
That's actually the route that I started to take before I thought that someone here may know of an easier way. I tend to do things more complicated than needed and I was hoping to save myself on this one.
I was also hoping that someone new of a 3rd party Python library that I could install into the OS itself that's not bloated.
This same thing can be done with PHP, but that adds another 20MB to the OS that's used for only one purpose. Since the same can be done with some Javascript and Python, which already exist.
Thank you for the idea though. Does anyone else have any others?