def set_service_status(self, status): """ The function sets the logger's service status to be the given status. :return: None """ if status == 1: status = 'ON' else: status = 'OFF' self._status = status if status == 'ON': with open('App_Files/Services.txt', 'r+') as file: lines_list = file.readlines() lines_list[6] = json.dumps({encrypt('Logger'): encrypt('ON')}) lines_list[6] += '\n' file.seek(0) file.truncate(0) file.write("".join(lines_list)) self.start_logging() elif status == 'OFF': with open('App_Files/Services.txt', 'r+') as file: lines_list = file.readlines() lines_list[6] = json.dumps({encrypt('Logger'): encrypt('OFF')}) lines_list[6] += '\n' file.seek(0) file.truncate(0) file.write("".join(lines_list))
def set_service_status(self, status): """ The function sets the virus scanner's service status to be the given status. :return: None """ self._status = status if status == 'ON': with open('App_Files/Services.txt', 'r+') as file: lines_list = file.readlines() lines_list[0] = json.dumps( {encrypt('Virus Scanner'): encrypt('ON')}) lines_list[0] += '\n' file.seek(0) file.truncate(0) file.write("".join(lines_list)) elif status == 'OFF': with open('App_Files/Services.txt', 'r+') as file: lines_list = file.readlines() lines_list[0] = json.dumps( {encrypt('Virus Scanner'): encrypt('OFF')}) lines_list[0] += '\n' file.seek(0) file.truncate(0) file.write("".join(lines_list))
def WrapMessage(FileName, message, IDpassword, PublicKey, Max): #This function stores a message in a image message = str(Hash(message, IDpassword)) + message # Prepend HMAC to message EncryptedMessage = encrypt(int(PublicKey), int(Max), message) # Encrypt the message EncryptedMessage = json.dumps( EncryptedMessage) # Turn to string for stegano image = lsb.hide(FileName, EncryptedMessage) return (image)