From f5c70e36631f6e98e223c423309e8c1fcb8b2ef1 Mon Sep 17 00:00:00 2001 From: Carlos Alfredo Diaz Date: Tue, 26 Jul 2022 21:57:33 -0300 Subject: [PATCH] Added check for encryption --- meshtastic-mqtt-client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/meshtastic-mqtt-client.py b/meshtastic-mqtt-client.py index 2c1d4e7..10cad02 100644 --- a/meshtastic-mqtt-client.py +++ b/meshtastic-mqtt-client.py @@ -1,7 +1,9 @@ #!/bin/python # Las dependencias: +from ast import Not +from types import NoneType import yaml -import json +#import json for future version import time import os import sys @@ -14,7 +16,7 @@ import sqlite3 as sl #import sqlalchemy for future version import random #from queue import Queue -from logging import NullHandler +#from logging import NullHandler #PROTOBUF dependencies copied from joshpirihi/meshtastic-mqtt import portnums_pb2 as portnums_pb2 @@ -123,6 +125,10 @@ def decode_message(msg): mesh_node_id = str(getattr(decoded_message, "from")) if mesh_node_id == mesh_client_id: pass + elif getattr(decoded_message, "encrypted") != "b''": + print("Encrypted message received.") + logging.info("Encrypted message received, please check the settings on your Meshtastic uplink device.") + return None else: mesh_node_full_id = mesh_pb2.User() mesh_node_id = str(getattr(decoded_message, "from"))