Updating programs with duct tape, string and some hope

As I have written about previously, a warrant builder has been a personal pet project of mine for some time. I was intent on providing a simple way to streamline and provide consistency to what was a messy and varied approach by many in my area. Well, the program was something of a hit and many folks have been using it in their day to day. That’s all great until I get the itch to improve something or tweak a feature… You see, my average “customer” is techy enough to fill in a form and other routine tasks, but if I were to ask them to update Python libraries, sync a repository or even just seek out the most recent *.exe release from my Github, I know I would be playing tech support for a fair few. I don’t intend on slighting them, we are all good at different things, it’s just that the computer stuff is often not the focus of my coworkers.

So, I set out to create an updater program. Because the warrant builder was already a shambling ogre of a program, quivering under the weight of it’s own inefficient code; I didn’t want to add the update functionality into the builder itself. Thus, I created a companion application. A “Warrant Builder Update Utility”. I’ll stop typing for a sec while I wait for the shock over yet another creative name fade away.

The program functions as a helper application, ensuring the necessary files are present and then ensuring the most recent versions are had. If basically does this by first looking in the current directory for defined files. If the files aren’t found, the program will reach out to a defined location and calculate a sha256 of the file found there. Once obtained, this sha256 will be compared against one stored elsewhere on the interwebs. Assuming the hashes match, the download is authorized and the file is downloaded. Once all files are present and accounted for, the next function of the program is enabled.

If the program launches and finds all necessary components of the warrant builder application to be present, the “Update” button will be enabled. By starting this new function, the program will calculate the hashes of the local files first. If the hash of any local file does NOT match the hashes obtained from the authorized list, the program then reaches out to calculate the hash of the remote file. Once the remote hash is calculated, it is compared against the authorized list. Assuming a match, the file is downloaded and the local file is replaced. If the remote hash list and the remote calculated hash do not agree, no file is replaced.

It is incumbent on the host of the program to ensure that the remote files and remote hash list are stored separately and in properly secured locations. If there is an update to be had, all that needs be done is upload a new file to the designated location and update the hash list accordingly. Because of this functional limitation, hosting requires an “edit in place” functionality. Services like google drive don’t allow replacing files with the exact same direct reference URL. Github allows for this type of functionality as would personal hosting servers. Dealer’s choice.

Now, the warrant builder should be easily updated for my people! God forbid I need to update the updater… where would it end? Check out the script if you’re interested and let me know what you think. Surely I could do better, but how else would I know?

https://github.com/Whee30/update_utility

Leave a Reply

Your email address will not be published. Required fields are marked *

Digital Forensics and general nerdery. Learning bit by bit (heh) and fighting off imposter syndrome. Learning python, adapting it to my work and overcomplicating simple processes most of the time.