Skip to content

Instantly share code, notes, and snippets.

@DS256
DS256 / README.md
Last active March 14, 2022 21:05
Encrypting/Decrypting Passwords in Python using External 'C' Function Call

Encrypting/Decrypting Passwords in Python using External 'C' Function Call

Introduction/Problem

I am deploying a stand-alone Raspberry PI based weather station and webcam. This will be visible, known and unattended for days at a time. I will be FTPing to a server and emailing daily status reports over security IP protocols. I was concerned about the unit potentially being stolen. Even in compiled Python text is still clear. There is also an ongoing project to decompile PYC files back to PY.

I posted in the Raspberry PI Forum on my challenge. Look there for some suggestions that were posted on approaches to prevent others from getting access to passwords.

In the end, I decided to use encrypted passwords. However, since at some time my Python 3.9 PYC program may be able to be decompiled, I decided to use a compiled 'C' lanquage decrypt function. I found it challenging in determining how to call and return strings between Python and C. Th

@DS256
DS256 / README.md
Created March 6, 2022 22:48
Scripted Reboot Button for Raspberry PI
@DS256
DS256 / template_1.py
Created January 30, 2022 14:57
Simple Python Template With Argument Parsing and Logging
#!/usr/bin/env python
# TEMPLATE_1.PY
# This program template was created to be simple single program.
# I didn't want to get around to having the complexity of a Python project.
# I am greatful to the following contributors who I stole code from ;-)
# - https://gist.github.com/calebrob6/eb98725187425c527567#file-template-py
# - https://gist.github.com/nafeu/e513e23b6b343ef896e4cccd4430b428
import sys,os
import time