コード例 #1
0
ファイル: crypt.py プロジェクト: theAsteriks/TITS_balena
    def getDBdata(self):
        fileobj = open('passes/pi' + str(config.RPI_ID()) + '_pass.bin', 'rb')
        raw_data_list = list()
        text_data_list = list()
        db_item = ''

        while True:
            chip = fileobj.read(1)
            if chip == '':
                break
            if chip == chr(0):
                raw_data_list.append(db_item)
                db_item = ''
            else:
                db_item = db_item.__add__(chip)

        fileobj.close()
        key = self.__genKey()
        enigma = Fernet(key)
        for item in raw_data_list:
            word = enigma.decrypt(item)
            text_data_list.append(word)
        return text_data_list
コード例 #2
0
import UART
import config
import constr_params
import supDB
import logging

logger = logging.getLogger(__name__)
logger.setLevel(config.MAIN_LOG_LEVEL)
formatter = logging.Formatter('%(name)s:%(levelname)s:%(asctime)s:%(message)s')
file_handler = logging.FileHandler('log_files/main.log')
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)

##########################################################################
#################### GLOBAL VARIABLES ####################################
id = config.RPI_ID()
sub_boss = constr_params.GlobalVarMGR()
logger.debug("Initiated global variable holder")
wind_tracer = config.IS_WIND_TRACER(id)
io_counter = config.POLLING_INTERVAL
current_state = "ADMIN_IDLE"
max_wind_poll_counter = config.MAX_NO_WIND_DETECTION
wind_poll_counter = max_wind_poll_counter
ok_status = True

#########################################################################

#changing the local timezone to CET because the resin.io's default timezone is UTC


def set_local_time():