diff --git a/2 b/2
new file mode 100644
index 0000000..d06bf22
--- /dev/null
+++ b/2
@@ -0,0 +1 @@
+lalalal
diff --git a/Rhasspy-LED-4mic.py b/Rhasspy-LED-4mic.py
new file mode 100644
index 0000000..0c9ac86
--- /dev/null
+++ b/Rhasspy-LED-4mic.py
@@ -0,0 +1,129 @@
+#!/usr/bin/env python
+from apa102_pi.driver import apa102
+from pixel_ring import pixel_ring
+from gpiozero import LED
+from time import sleep
+import paho.mqtt.client as mqtt
+import RPi.GPIO as GPIO
+import json
+import os
+import time
+
+rhasspyConfig = '/home/jd/.config/rhasspy/profiles/en/profile.json'
+
+counter = 0
+LED_ST = "on"
+mute = "off"
+siteId = ""
+MQTThost = ""
+
+GPIO.setmode(GPIO.BCM)
+GPIO.setup(5, GPIO.OUT)
+GPIO.output(5, GPIO.HIGH)
+
+power = LED(5)
+power.on()
+pixel_ring.set_brightness(20)
+pixel_ring.change_pattern('echo')
+pixel_ring.wakeup()
+time.sleep(2)
+
+with open(rhasspyConfig,'r', encoding='UTF-8') as file:
+ obj = json.loads(file.read())
+ MQTTconfig = json.dumps(obj["mqtt"])
+ MQTTconfig = MQTTconfig.replace("\"mqtt\": ","")
+ MQTTconfig = json.loads(MQTTconfig)
+ siteId = MQTTconfig["site_id"]
+ MQTThost = MQTTconfig["host"]
+ MQTThost = MQTThost.strip('"')
+ if "port" in json.dumps(MQTTconfig):
+ MQTTport = MQTTconfig["port"]
+ MQTTport = MQTTport.strip('"')
+ MQTTport = int(MQTTport)
+ else:
+ MQTTport = 1883
+
+strip = apa102.APA102(num_led=12)
+strip.clear_strip()
+
+def on_disconnect():
+ # for i in range(0,12):
+ # strip.set_pixel(i,0,59,0,7)
+ # strip.show()
+ pixel_ring.wakeup()
+
+for i in range(0,12):
+ strip.set_pixel(i,255,0,0,30)
+strip.show()
+time.sleep(3)
+def on_connect(client, userdata, flags, rc):
+ print("Connected with result code " + str(rc))
+ client.subscribe("hermes/dialogueManager/sessionEnded/#")
+ client.subscribe("hermes/hotword/toggleOff/#")
+ client.subscribe("hermes/hotword/toggleOn/#")
+ client.subscribe("hermes/asr/stopListening")
+ client.subscribe("hermes/hotword/hey siri_raspberry-pi/detected")
+ client.subscribe("hermes/asr/textCaptured")
+
+ for i in range(0,12):
+ strip.set_pixel(i,0,127,0,7)
+ strip.show()
+ sleep(2)
+ for i in range(0,12):
+ strip.set_pixel(i,0,255,0,0)
+ strip.show()
+def on_message(client, userdata, msg):
+ jsonData = json.loads(msg.payload)
+ if msg.topic == "hermes/hotword/hey siri_raspberry-pi/detected" and jsonData["siteId"] == siteId and LED_ST == "on":
+ # for i in range(0,12):
+ # strip.set_pixel(i,0,100,0,7)
+ # strip.show()
+ pixel_ring.think()
+
+ elif msg.topic == "hermes/asr/textCaptured" and jsonData["siteId"] == siteId:
+ # for i in range(0,12):
+ # strip.set_pixel(i,0,255,0,0)
+ # strip.show()
+ pixel_ring.wakeup()
+ time.sleep(0.3)
+ pixel_ring.off()
+ time.sleep(0.3)
+ pixel_ring.wakeup()
+ time.sleep(0.3)
+ pixel_ring.off()
+ elif msg.topic == "hermes/asr/stopListening":
+ #pixel_ring.off()
+ pass
+ elif msg.topic == "hermes/hotword/toggleOn":
+ # for i in range(0,12):
+ # strip.set_pixel(i,0,99,0,0)
+ # strip.show()
+ #pixel_ring.off() for i in range(0,12):
+ # strip.set_pixel(i,255,0,0,7)
+ # strip.show()
+ # time.sleep(0.2)
+ # pixel_ring.off()
+ # time.sleep(0.3)
+ # for i in range(0,12):
+ # strip.set_pixel(i,255,0,0,7)
+ # strip.show()
+ # time.sleep(0.2)
+ pass
+ else:
+ # for i in range(0,12):
+ # strip.set_pixel(i,0,99,0,0)
+ # strip.show()
+ pass
+# for i in range(0,12):
+# strip.set_pixel(i,0,127,255,7)
+# sleep(0.1)
+# strip.show()
+
+client = mqtt.Client()
+client.username_pw_set("jaydee", password="jaydee1")
+client.on_connect = on_connect
+client.on_disconnect = on_disconnect
+client.on_message = on_message
+client.connect(MQTThost, MQTTport, 15)
+
+client.loop_forever()
diff --git a/aida_send.py b/aida_send.py
new file mode 100644
index 0000000..e1af7b4
--- /dev/null
+++ b/aida_send.py
@@ -0,0 +1,12 @@
+import python_aida64
+import json
+from pprint import pprint
+data = python_aida64.getData()
+print(json.dumps(data))
+print(data["sys"][5]["value"])
+stats = {}
+for i in data:
+ for j in data[i]:
+ stats[j["id"]] = j["value"]
+
+print(json.dumps(stats))
\ No newline at end of file
diff --git a/auto_import.py b/auto_import.py
new file mode 100644
index 0000000..4b4d23c
--- /dev/null
+++ b/auto_import.py
@@ -0,0 +1,101 @@
+import os
+from posixpath import ismount
+import sys
+import time
+import subprocess
+import datetime
+import shutil
+import json
+
+_DEST = "/share/Photo/imported"
+_DEV = ""
+_DEV_MOUNT = "/share/external/DEV3304_1/"
+_DEV_DIR = "/share/external/DEV3304_1/DCIM/100GOPRO"
+_IMP_FILE = "/share/external/DEV3304_1/auto_import"
+_DEV_DATA = "/share/external/DEV3304_1/MISC/version.txt"
+
+
+
+
+#sys.exit()
+while True:
+ if os.path.ismount(_DEV_MOUNT):
+ if os.path.exists(_DEV_DATA):
+ file = open(_DEV_DATA, 'r')
+ content = file.read()
+ file.close()
+ strToReplace = ','
+ replacementStr = ''
+ strToReplaceReversed = strToReplace[::-1]
+ replacementStrReversed = replacementStr[::-1]
+
+ strValue = content[::-1].replace(strToReplaceReversed, replacementStrReversed, 1)[::-1]
+ c = content.replace("\n","")
+
+ print("--------------")
+ print(c[-2])
+ print("--------------")
+ print(strValue)
+ _DEV_CONT = json.loads(strValue)
+ wifimac = _DEV_CONT["wifi mac"]
+ if wifimac == "2474f742c017":
+ _DEV = "gopro9_1"
+ print("gopro9_1 registered")
+
+ if os.path.exists(_IMP_FILE) and _DEV == "":
+ print("path exist")
+ time.sleep(5)
+ if _DEV == "":
+ file = open(_IMP_FILE, 'r')
+ content = file.read()
+ _DEV = json.loads(content)["device"]
+ file.close()
+ x = datetime.datetime.now()
+ print(x.year)
+ _DAT = x.strftime("%Y%m%d")
+ if len(os.listdir(_DEV_DIR)) == 0:
+ print("Folder is empty!")
+ myCmd = "umount /share/external/DEV3304_1"
+ status, output = subprocess.getstatusoutput(myCmd)
+ time.sleep(5)
+ continue
+ myCmd = "/sbin/hal_app --se_buzzer enc_id=0,mode=101;sleep 1;/sbin/hal_app --se_buzzer enc_id=0,mode=101;sleep 1;/sbin/hal_app --se_buzzer enc_id=0,mode=101"
+ status, output = subprocess.getstatusoutput(myCmd)
+ if not _DEV == "":
+ if os.path.exists(_DEV_DIR):
+ for filename in os.listdir(_DEV_DIR):
+ print(filename)
+ c_time = os.path.getctime("{}/{}".format(_DEV_DIR,filename))
+ dt_c = datetime.datetime.fromtimestamp(c_time)
+ print(dt_c)
+ _CDAT = dt_c.strftime("%Y-%m-%d")
+ print(_CDAT)
+ _FDEST = "{}/{}/{}".format(_DEST,_DEV, _CDAT)
+ if not os.path.exists(_FDEST):
+ cmnd = "mkdir -p {}".format(_FDEST)
+ status, output = subprocess.getstatusoutput(cmnd)
+ print("Moving file {} into {}".format(filename, _FDEST))
+ try:
+ shutil.move("{}/{}".format(_DEV_DIR,filename),_FDEST)
+ except:
+ try:
+ shutil.move("{}/{}".format(_DEV_DIR,filename),"{}/{}".format(_FDEST,filename))
+ except:
+ print("failed to move file {}".format(filename))
+ print("Umounting")
+ myCmd = "umount /share/external/DEV3304_1"
+ status, output = subprocess.getstatusoutput(myCmd)
+ print(output)
+ print(status)
+ myCmd = "/sbin/hal_app --se_buzzer enc_id=0,mode=100"
+ subprocess.getstatusoutput(myCmd)
+ time.sleep(5)
+ else:
+ print("Nothing to import")
+ time.sleep(5)
+ else:
+ print("Unknown device")
+ time.sleep(5)
+ else:
+ print("Usb does not connected")
+ time.sleep(5)
\ No newline at end of file
diff --git a/build/mqtt_srv/Analysis-00.toc b/build/mqtt_srv/Analysis-00.toc
new file mode 100644
index 0000000..19d3456
--- /dev/null
+++ b/build/mqtt_srv/Analysis-00.toc
@@ -0,0 +1,864 @@
+(['X:\\__GITHUB\\python\\mqtt_srv.pyw'],
+ ['X:\\__GITHUB\\python'],
+ ['codecs'],
+ ['C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks\\__pycache__',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks\\__pycache__',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks'],
+ {},
+ [],
+ [],
+ False,
+ False,
+ False,
+ {},
+ '3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit '
+ '(AMD64)]',
+ [('pyi_rth_inspect',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py',
+ 'PYSOURCE'),
+ ('pyi_rth_subprocess',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_subprocess.py',
+ 'PYSOURCE'),
+ ('pyi_rth_pkgutil',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py',
+ 'PYSOURCE'),
+ ('pyi_rth_multiprocessing',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py',
+ 'PYSOURCE'),
+ ('mqtt_srv',
+ '\\\\192.168.77.106\\Data\\__GITHUB\\python\\mqtt_srv.pyw',
+ 'PYSOURCE')],
+ [('multiprocessing.popen_spawn_posix',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\popen_spawn_posix.py',
+ 'PYMODULE'),
+ ('multiprocessing.resource_tracker',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\resource_tracker.py',
+ 'PYMODULE'),
+ ('threading', 'C:\\Program Files\\Python310\\lib\\threading.py', 'PYMODULE'),
+ ('_threading_local',
+ 'C:\\Program Files\\Python310\\lib\\_threading_local.py',
+ 'PYMODULE'),
+ ('contextlib',
+ 'C:\\Program Files\\Python310\\lib\\contextlib.py',
+ 'PYMODULE'),
+ ('signal', 'C:\\Program Files\\Python310\\lib\\signal.py', 'PYMODULE'),
+ ('multiprocessing.util',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\util.py',
+ 'PYMODULE'),
+ ('multiprocessing.forkserver',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\forkserver.py',
+ 'PYMODULE'),
+ ('multiprocessing.connection',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\connection.py',
+ 'PYMODULE'),
+ ('multiprocessing.resource_sharer',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\resource_sharer.py',
+ 'PYMODULE'),
+ ('xmlrpc.client',
+ 'C:\\Program Files\\Python310\\lib\\xmlrpc\\client.py',
+ 'PYMODULE'),
+ ('xmlrpc',
+ 'C:\\Program Files\\Python310\\lib\\xmlrpc\\__init__.py',
+ 'PYMODULE'),
+ ('gzip', 'C:\\Program Files\\Python310\\lib\\gzip.py', 'PYMODULE'),
+ ('argparse', 'C:\\Program Files\\Python310\\lib\\argparse.py', 'PYMODULE'),
+ ('textwrap', 'C:\\Program Files\\Python310\\lib\\textwrap.py', 'PYMODULE'),
+ ('copy', 'C:\\Program Files\\Python310\\lib\\copy.py', 'PYMODULE'),
+ ('gettext', 'C:\\Program Files\\Python310\\lib\\gettext.py', 'PYMODULE'),
+ ('_compression',
+ 'C:\\Program Files\\Python310\\lib\\_compression.py',
+ 'PYMODULE'),
+ ('xml.parsers.expat',
+ 'C:\\Program Files\\Python310\\lib\\xml\\parsers\\expat.py',
+ 'PYMODULE'),
+ ('xml.parsers',
+ 'C:\\Program Files\\Python310\\lib\\xml\\parsers\\__init__.py',
+ 'PYMODULE'),
+ ('xml', 'C:\\Program Files\\Python310\\lib\\xml\\__init__.py', 'PYMODULE'),
+ ('xml.sax.expatreader',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\expatreader.py',
+ 'PYMODULE'),
+ ('xml.sax.saxutils',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\saxutils.py',
+ 'PYMODULE'),
+ ('xml.sax',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\__init__.py',
+ 'PYMODULE'),
+ ('xml.sax.handler',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\handler.py',
+ 'PYMODULE'),
+ ('xml.sax._exceptions',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\_exceptions.py',
+ 'PYMODULE'),
+ ('xml.sax.xmlreader',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\xmlreader.py',
+ 'PYMODULE'),
+ ('http.client',
+ 'C:\\Program Files\\Python310\\lib\\http\\client.py',
+ 'PYMODULE'),
+ ('ssl', 'C:\\Program Files\\Python310\\lib\\ssl.py', 'PYMODULE'),
+ ('calendar', 'C:\\Program Files\\Python310\\lib\\calendar.py', 'PYMODULE'),
+ ('http', 'C:\\Program Files\\Python310\\lib\\http\\__init__.py', 'PYMODULE'),
+ ('email.message',
+ 'C:\\Program Files\\Python310\\lib\\email\\message.py',
+ 'PYMODULE'),
+ ('email.policy',
+ 'C:\\Program Files\\Python310\\lib\\email\\policy.py',
+ 'PYMODULE'),
+ ('email.contentmanager',
+ 'C:\\Program Files\\Python310\\lib\\email\\contentmanager.py',
+ 'PYMODULE'),
+ ('email.quoprimime',
+ 'C:\\Program Files\\Python310\\lib\\email\\quoprimime.py',
+ 'PYMODULE'),
+ ('string', 'C:\\Program Files\\Python310\\lib\\string.py', 'PYMODULE'),
+ ('email.headerregistry',
+ 'C:\\Program Files\\Python310\\lib\\email\\headerregistry.py',
+ 'PYMODULE'),
+ ('email._header_value_parser',
+ 'C:\\Program Files\\Python310\\lib\\email\\_header_value_parser.py',
+ 'PYMODULE'),
+ ('email.iterators',
+ 'C:\\Program Files\\Python310\\lib\\email\\iterators.py',
+ 'PYMODULE'),
+ ('email.generator',
+ 'C:\\Program Files\\Python310\\lib\\email\\generator.py',
+ 'PYMODULE'),
+ ('email._encoded_words',
+ 'C:\\Program Files\\Python310\\lib\\email\\_encoded_words.py',
+ 'PYMODULE'),
+ ('email.charset',
+ 'C:\\Program Files\\Python310\\lib\\email\\charset.py',
+ 'PYMODULE'),
+ ('email.encoders',
+ 'C:\\Program Files\\Python310\\lib\\email\\encoders.py',
+ 'PYMODULE'),
+ ('email.base64mime',
+ 'C:\\Program Files\\Python310\\lib\\email\\base64mime.py',
+ 'PYMODULE'),
+ ('email._policybase',
+ 'C:\\Program Files\\Python310\\lib\\email\\_policybase.py',
+ 'PYMODULE'),
+ ('email.header',
+ 'C:\\Program Files\\Python310\\lib\\email\\header.py',
+ 'PYMODULE'),
+ ('email.errors',
+ 'C:\\Program Files\\Python310\\lib\\email\\errors.py',
+ 'PYMODULE'),
+ ('email.utils',
+ 'C:\\Program Files\\Python310\\lib\\email\\utils.py',
+ 'PYMODULE'),
+ ('email._parseaddr',
+ 'C:\\Program Files\\Python310\\lib\\email\\_parseaddr.py',
+ 'PYMODULE'),
+ ('email',
+ 'C:\\Program Files\\Python310\\lib\\email\\__init__.py',
+ 'PYMODULE'),
+ ('quopri', 'C:\\Program Files\\Python310\\lib\\quopri.py', 'PYMODULE'),
+ ('uu', 'C:\\Program Files\\Python310\\lib\\uu.py', 'PYMODULE'),
+ ('optparse', 'C:\\Program Files\\Python310\\lib\\optparse.py', 'PYMODULE'),
+ ('email.parser',
+ 'C:\\Program Files\\Python310\\lib\\email\\parser.py',
+ 'PYMODULE'),
+ ('email.feedparser',
+ 'C:\\Program Files\\Python310\\lib\\email\\feedparser.py',
+ 'PYMODULE'),
+ ('decimal', 'C:\\Program Files\\Python310\\lib\\decimal.py', 'PYMODULE'),
+ ('_pydecimal',
+ 'C:\\Program Files\\Python310\\lib\\_pydecimal.py',
+ 'PYMODULE'),
+ ('contextvars',
+ 'C:\\Program Files\\Python310\\lib\\contextvars.py',
+ 'PYMODULE'),
+ ('numbers', 'C:\\Program Files\\Python310\\lib\\numbers.py', 'PYMODULE'),
+ ('base64', 'C:\\Program Files\\Python310\\lib\\base64.py', 'PYMODULE'),
+ ('hmac', 'C:\\Program Files\\Python310\\lib\\hmac.py', 'PYMODULE'),
+ ('hashlib', 'C:\\Program Files\\Python310\\lib\\hashlib.py', 'PYMODULE'),
+ ('struct', 'C:\\Program Files\\Python310\\lib\\struct.py', 'PYMODULE'),
+ ('selectors', 'C:\\Program Files\\Python310\\lib\\selectors.py', 'PYMODULE'),
+ ('tempfile', 'C:\\Program Files\\Python310\\lib\\tempfile.py', 'PYMODULE'),
+ ('shutil', 'C:\\Program Files\\Python310\\lib\\shutil.py', 'PYMODULE'),
+ ('zipfile', 'C:\\Program Files\\Python310\\lib\\zipfile.py', 'PYMODULE'),
+ ('py_compile',
+ 'C:\\Program Files\\Python310\\lib\\py_compile.py',
+ 'PYMODULE'),
+ ('importlib.machinery',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\machinery.py',
+ 'PYMODULE'),
+ ('importlib',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\__init__.py',
+ 'PYMODULE'),
+ ('importlib._common',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\_common.py',
+ 'PYMODULE'),
+ ('importlib._adapters',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\_adapters.py',
+ 'PYMODULE'),
+ ('typing', 'C:\\Program Files\\Python310\\lib\\typing.py', 'PYMODULE'),
+ ('importlib.abc',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\abc.py',
+ 'PYMODULE'),
+ ('importlib._abc',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\_abc.py',
+ 'PYMODULE'),
+ ('importlib._bootstrap',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\_bootstrap.py',
+ 'PYMODULE'),
+ ('importlib._bootstrap_external',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\_bootstrap_external.py',
+ 'PYMODULE'),
+ ('importlib.metadata',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\__init__.py',
+ 'PYMODULE'),
+ ('importlib.metadata._itertools',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_itertools.py',
+ 'PYMODULE'),
+ ('importlib.metadata._functools',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_functools.py',
+ 'PYMODULE'),
+ ('importlib.metadata._collections',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_collections.py',
+ 'PYMODULE'),
+ ('importlib.metadata._meta',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_meta.py',
+ 'PYMODULE'),
+ ('importlib.metadata._adapters',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_adapters.py',
+ 'PYMODULE'),
+ ('importlib.metadata._text',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_text.py',
+ 'PYMODULE'),
+ ('csv', 'C:\\Program Files\\Python310\\lib\\csv.py', 'PYMODULE'),
+ ('importlib.readers',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\readers.py',
+ 'PYMODULE'),
+ ('importlib.util',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\util.py',
+ 'PYMODULE'),
+ ('tarfile', 'C:\\Program Files\\Python310\\lib\\tarfile.py', 'PYMODULE'),
+ ('lzma', 'C:\\Program Files\\Python310\\lib\\lzma.py', 'PYMODULE'),
+ ('bz2', 'C:\\Program Files\\Python310\\lib\\bz2.py', 'PYMODULE'),
+ ('logging',
+ 'C:\\Program Files\\Python310\\lib\\logging\\__init__.py',
+ 'PYMODULE'),
+ ('pickle', 'C:\\Program Files\\Python310\\lib\\pickle.py', 'PYMODULE'),
+ ('pprint', 'C:\\Program Files\\Python310\\lib\\pprint.py', 'PYMODULE'),
+ ('dataclasses',
+ 'C:\\Program Files\\Python310\\lib\\dataclasses.py',
+ 'PYMODULE'),
+ ('inspect', 'C:\\Program Files\\Python310\\lib\\inspect.py', 'PYMODULE'),
+ ('dis', 'C:\\Program Files\\Python310\\lib\\dis.py', 'PYMODULE'),
+ ('opcode', 'C:\\Program Files\\Python310\\lib\\opcode.py', 'PYMODULE'),
+ ('ast', 'C:\\Program Files\\Python310\\lib\\ast.py', 'PYMODULE'),
+ ('_compat_pickle',
+ 'C:\\Program Files\\Python310\\lib\\_compat_pickle.py',
+ 'PYMODULE'),
+ ('multiprocessing.process',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\process.py',
+ 'PYMODULE'),
+ ('multiprocessing.context',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\context.py',
+ 'PYMODULE'),
+ ('multiprocessing.popen_forkserver',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\popen_forkserver.py',
+ 'PYMODULE'),
+ ('multiprocessing.sharedctypes',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\sharedctypes.py',
+ 'PYMODULE'),
+ ('multiprocessing.heap',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\heap.py',
+ 'PYMODULE'),
+ ('bisect', 'C:\\Program Files\\Python310\\lib\\bisect.py', 'PYMODULE'),
+ ('multiprocessing.pool',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\pool.py',
+ 'PYMODULE'),
+ ('multiprocessing.dummy',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\dummy\\__init__.py',
+ 'PYMODULE'),
+ ('multiprocessing.dummy.connection',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\dummy\\connection.py',
+ 'PYMODULE'),
+ ('queue', 'C:\\Program Files\\Python310\\lib\\queue.py', 'PYMODULE'),
+ ('multiprocessing.queues',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\queues.py',
+ 'PYMODULE'),
+ ('multiprocessing.synchronize',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\synchronize.py',
+ 'PYMODULE'),
+ ('multiprocessing.managers',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\managers.py',
+ 'PYMODULE'),
+ ('multiprocessing.shared_memory',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\shared_memory.py',
+ 'PYMODULE'),
+ ('secrets', 'C:\\Program Files\\Python310\\lib\\secrets.py', 'PYMODULE'),
+ ('multiprocessing.reduction',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\reduction.py',
+ 'PYMODULE'),
+ ('multiprocessing.popen_fork',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\popen_fork.py',
+ 'PYMODULE'),
+ ('multiprocessing.popen_spawn_win32',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\popen_spawn_win32.py',
+ 'PYMODULE'),
+ ('multiprocessing.spawn',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\spawn.py',
+ 'PYMODULE'),
+ ('runpy', 'C:\\Program Files\\Python310\\lib\\runpy.py', 'PYMODULE'),
+ ('pkgutil', 'C:\\Program Files\\Python310\\lib\\pkgutil.py', 'PYMODULE'),
+ ('zipimport', 'C:\\Program Files\\Python310\\lib\\zipimport.py', 'PYMODULE'),
+ ('multiprocessing',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\__init__.py',
+ 'PYMODULE'),
+ ('getpass', 'C:\\Program Files\\Python310\\lib\\getpass.py', 'PYMODULE'),
+ ('nturl2path',
+ 'C:\\Program Files\\Python310\\lib\\nturl2path.py',
+ 'PYMODULE'),
+ ('ftplib', 'C:\\Program Files\\Python310\\lib\\ftplib.py', 'PYMODULE'),
+ ('netrc', 'C:\\Program Files\\Python310\\lib\\netrc.py', 'PYMODULE'),
+ ('shlex', 'C:\\Program Files\\Python310\\lib\\shlex.py', 'PYMODULE'),
+ ('mimetypes', 'C:\\Program Files\\Python310\\lib\\mimetypes.py', 'PYMODULE'),
+ ('http.cookiejar',
+ 'C:\\Program Files\\Python310\\lib\\http\\cookiejar.py',
+ 'PYMODULE'),
+ ('stringprep',
+ 'C:\\Program Files\\Python310\\lib\\stringprep.py',
+ 'PYMODULE'),
+ ('tracemalloc',
+ 'C:\\Program Files\\Python310\\lib\\tracemalloc.py',
+ 'PYMODULE'),
+ ('_py_abc', 'C:\\Program Files\\Python310\\lib\\_py_abc.py', 'PYMODULE'),
+ ('ping3',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\ping3\\__init__.py',
+ 'PYMODULE'),
+ ('ping3.enums',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\ping3\\enums.py',
+ 'PYMODULE'),
+ ('ping3.errors',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\ping3\\errors.py',
+ 'PYMODULE'),
+ ('psutil',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\__init__.py',
+ 'PYMODULE'),
+ ('psutil._psaix',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_psaix.py',
+ 'PYMODULE'),
+ ('glob', 'C:\\Program Files\\Python310\\lib\\glob.py', 'PYMODULE'),
+ ('psutil._pssunos',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_pssunos.py',
+ 'PYMODULE'),
+ ('psutil._psbsd',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_psbsd.py',
+ 'PYMODULE'),
+ ('xml.etree.ElementTree',
+ 'C:\\Program Files\\Python310\\lib\\xml\\etree\\ElementTree.py',
+ 'PYMODULE'),
+ ('xml.etree.cElementTree',
+ 'C:\\Program Files\\Python310\\lib\\xml\\etree\\cElementTree.py',
+ 'PYMODULE'),
+ ('xml.etree.ElementInclude',
+ 'C:\\Program Files\\Python310\\lib\\xml\\etree\\ElementInclude.py',
+ 'PYMODULE'),
+ ('xml.etree.ElementPath',
+ 'C:\\Program Files\\Python310\\lib\\xml\\etree\\ElementPath.py',
+ 'PYMODULE'),
+ ('xml.etree',
+ 'C:\\Program Files\\Python310\\lib\\xml\\etree\\__init__.py',
+ 'PYMODULE'),
+ ('psutil._psosx',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_psosx.py',
+ 'PYMODULE'),
+ ('psutil._pswindows',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_pswindows.py',
+ 'PYMODULE'),
+ ('psutil._pslinux',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_pslinux.py',
+ 'PYMODULE'),
+ ('psutil._psposix',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_psposix.py',
+ 'PYMODULE'),
+ ('psutil._compat',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_compat.py',
+ 'PYMODULE'),
+ ('psutil._common',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_common.py',
+ 'PYMODULE'),
+ ('curses',
+ 'C:\\Program Files\\Python310\\lib\\curses\\__init__.py',
+ 'PYMODULE'),
+ ('curses.has_key',
+ 'C:\\Program Files\\Python310\\lib\\curses\\has_key.py',
+ 'PYMODULE'),
+ ('__future__',
+ 'C:\\Program Files\\Python310\\lib\\__future__.py',
+ 'PYMODULE'),
+ ('requests',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\__init__.py',
+ 'PYMODULE'),
+ ('requests.status_codes',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\requests\\status_codes.py',
+ 'PYMODULE'),
+ ('requests.structures',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\structures.py',
+ 'PYMODULE'),
+ ('requests.compat',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\compat.py',
+ 'PYMODULE'),
+ ('http.cookies',
+ 'C:\\Program Files\\Python310\\lib\\http\\cookies.py',
+ 'PYMODULE'),
+ ('requests.models',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\models.py',
+ 'PYMODULE'),
+ ('idna',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\__init__.py',
+ 'PYMODULE'),
+ ('idna.intranges',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\intranges.py',
+ 'PYMODULE'),
+ ('idna.core',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\core.py',
+ 'PYMODULE'),
+ ('idna.uts46data',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\uts46data.py',
+ 'PYMODULE'),
+ ('idna.idnadata',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\idnadata.py',
+ 'PYMODULE'),
+ ('idna.package_data',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\package_data.py',
+ 'PYMODULE'),
+ ('requests.hooks',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\hooks.py',
+ 'PYMODULE'),
+ ('requests.cookies',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\cookies.py',
+ 'PYMODULE'),
+ ('requests.auth',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\auth.py',
+ 'PYMODULE'),
+ ('requests._internal_utils',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\requests\\_internal_utils.py',
+ 'PYMODULE'),
+ ('urllib3.util',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\__init__.py',
+ 'PYMODULE'),
+ ('urllib3.util.wait',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\wait.py',
+ 'PYMODULE'),
+ ('urllib3.util.url',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\url.py',
+ 'PYMODULE'),
+ ('urllib3.packages.six',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\packages\\six.py',
+ 'PYMODULE'),
+ ('urllib3.packages',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\packages\\__init__.py',
+ 'PYMODULE'),
+ ('urllib3.util.timeout',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\timeout.py',
+ 'PYMODULE'),
+ ('urllib3.util.ssl_',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\ssl_.py',
+ 'PYMODULE'),
+ ('urllib3.util.ssltransport',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\ssltransport.py',
+ 'PYMODULE'),
+ ('urllib3.util.retry',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\retry.py',
+ 'PYMODULE'),
+ ('urllib3.util.response',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\response.py',
+ 'PYMODULE'),
+ ('urllib3.util.request',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\request.py',
+ 'PYMODULE'),
+ ('urllib3.util.connection',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\connection.py',
+ 'PYMODULE'),
+ ('urllib3.contrib._appengine_environ',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\contrib\\_appengine_environ.py',
+ 'PYMODULE'),
+ ('urllib3.filepost',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\filepost.py',
+ 'PYMODULE'),
+ ('urllib3.fields',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\fields.py',
+ 'PYMODULE'),
+ ('requests.api',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\api.py',
+ 'PYMODULE'),
+ ('requests.sessions',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\sessions.py',
+ 'PYMODULE'),
+ ('requests.adapters',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\adapters.py',
+ 'PYMODULE'),
+ ('urllib3.contrib.socks',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\contrib\\socks.py',
+ 'PYMODULE'),
+ ('urllib3.connectionpool',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\connectionpool.py',
+ 'PYMODULE'),
+ ('urllib3.util.ssl_match_hostname',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\ssl_match_hostname.py',
+ 'PYMODULE'),
+ ('ipaddress', 'C:\\Program Files\\Python310\\lib\\ipaddress.py', 'PYMODULE'),
+ ('urllib3.util.queue',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\queue.py',
+ 'PYMODULE'),
+ ('urllib3.util.proxy',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\proxy.py',
+ 'PYMODULE'),
+ ('urllib3.request',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\request.py',
+ 'PYMODULE'),
+ ('urllib3.connection',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\connection.py',
+ 'PYMODULE'),
+ ('urllib3._version',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\_version.py',
+ 'PYMODULE'),
+ ('urllib3._collections',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\_collections.py',
+ 'PYMODULE'),
+ ('urllib3.response',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\response.py',
+ 'PYMODULE'),
+ ('urllib3.poolmanager',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\poolmanager.py',
+ 'PYMODULE'),
+ ('requests.__version__',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\__version__.py',
+ 'PYMODULE'),
+ ('requests.utils',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\utils.py',
+ 'PYMODULE'),
+ ('requests.certs',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\certs.py',
+ 'PYMODULE'),
+ ('certifi',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\certifi\\__init__.py',
+ 'PYMODULE'),
+ ('certifi.core',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\certifi\\core.py',
+ 'PYMODULE'),
+ ('importlib.resources',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\resources.py',
+ 'PYMODULE'),
+ ('requests.packages',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\packages.py',
+ 'PYMODULE'),
+ ('urllib3.exceptions',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\exceptions.py',
+ 'PYMODULE'),
+ ('urllib3.contrib.pyopenssl',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\contrib\\pyopenssl.py',
+ 'PYMODULE'),
+ ('urllib3.packages.backports.makefile',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\packages\\backports\\makefile.py',
+ 'PYMODULE'),
+ ('urllib3.packages.backports',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\packages\\backports\\__init__.py',
+ 'PYMODULE'),
+ ('urllib3.contrib',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\contrib\\__init__.py',
+ 'PYMODULE'),
+ ('charset_normalizer',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\__init__.py',
+ 'PYMODULE'),
+ ('charset_normalizer.version',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\version.py',
+ 'PYMODULE'),
+ ('charset_normalizer.utils',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\utils.py',
+ 'PYMODULE'),
+ ('charset_normalizer.constant',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\constant.py',
+ 'PYMODULE'),
+ ('charset_normalizer.assets',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\assets\\__init__.py',
+ 'PYMODULE'),
+ ('charset_normalizer.models',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\models.py',
+ 'PYMODULE'),
+ ('charset_normalizer.cd',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\cd.py',
+ 'PYMODULE'),
+ ('charset_normalizer.md',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\md.py',
+ 'PYMODULE'),
+ ('charset_normalizer.legacy',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\legacy.py',
+ 'PYMODULE'),
+ ('charset_normalizer.api',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\api.py',
+ 'PYMODULE'),
+ ('requests.exceptions',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\exceptions.py',
+ 'PYMODULE'),
+ ('urllib3',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\__init__.py',
+ 'PYMODULE'),
+ ('random', 'C:\\Program Files\\Python310\\lib\\random.py', 'PYMODULE'),
+ ('statistics',
+ 'C:\\Program Files\\Python310\\lib\\statistics.py',
+ 'PYMODULE'),
+ ('fractions', 'C:\\Program Files\\Python310\\lib\\fractions.py', 'PYMODULE'),
+ ('getopt', 'C:\\Program Files\\Python310\\lib\\getopt.py', 'PYMODULE'),
+ ('ctypes',
+ 'C:\\Program Files\\Python310\\lib\\ctypes\\__init__.py',
+ 'PYMODULE'),
+ ('ctypes._endian',
+ 'C:\\Program Files\\Python310\\lib\\ctypes\\_endian.py',
+ 'PYMODULE'),
+ ('datetime', 'C:\\Program Files\\Python310\\lib\\datetime.py', 'PYMODULE'),
+ ('_strptime', 'C:\\Program Files\\Python310\\lib\\_strptime.py', 'PYMODULE'),
+ ('json', 'C:\\Program Files\\Python310\\lib\\json\\__init__.py', 'PYMODULE'),
+ ('json.encoder',
+ 'C:\\Program Files\\Python310\\lib\\json\\encoder.py',
+ 'PYMODULE'),
+ ('json.decoder',
+ 'C:\\Program Files\\Python310\\lib\\json\\decoder.py',
+ 'PYMODULE'),
+ ('json.scanner',
+ 'C:\\Program Files\\Python310\\lib\\json\\scanner.py',
+ 'PYMODULE'),
+ ('subprocess',
+ 'C:\\Program Files\\Python310\\lib\\subprocess.py',
+ 'PYMODULE'),
+ ('socket', 'C:\\Program Files\\Python310\\lib\\socket.py', 'PYMODULE'),
+ ('platform', 'C:\\Program Files\\Python310\\lib\\platform.py', 'PYMODULE'),
+ ('getmac',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\getmac\\__init__.py',
+ 'PYMODULE'),
+ ('getmac.getmac',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\getmac\\getmac.py',
+ 'PYMODULE'),
+ ('uuid', 'C:\\Program Files\\Python310\\lib\\uuid.py', 'PYMODULE'),
+ ('paho.mqtt.client',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\paho\\mqtt\\client.py',
+ 'PYMODULE'),
+ ('paho.mqtt',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\paho\\mqtt\\__init__.py',
+ 'PYMODULE'),
+ ('paho',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\paho\\__init__.py',
+ 'PYMODULE'),
+ ('paho.mqtt.subscribeoptions',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\paho\\mqtt\\subscribeoptions.py',
+ 'PYMODULE'),
+ ('paho.mqtt.reasoncodes',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\paho\\mqtt\\reasoncodes.py',
+ 'PYMODULE'),
+ ('paho.mqtt.packettypes',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\paho\\mqtt\\packettypes.py',
+ 'PYMODULE'),
+ ('paho.mqtt.properties',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\paho\\mqtt\\properties.py',
+ 'PYMODULE'),
+ ('paho.mqtt.matcher',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\paho\\mqtt\\matcher.py',
+ 'PYMODULE'),
+ ('asyncio.log',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\log.py',
+ 'PYMODULE'),
+ ('asyncio',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\__init__.py',
+ 'PYMODULE'),
+ ('asyncio.unix_events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\unix_events.py',
+ 'PYMODULE'),
+ ('asyncio.windows_events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\windows_events.py',
+ 'PYMODULE'),
+ ('asyncio.windows_utils',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\windows_utils.py',
+ 'PYMODULE'),
+ ('asyncio.selector_events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\selector_events.py',
+ 'PYMODULE'),
+ ('asyncio.proactor_events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\proactor_events.py',
+ 'PYMODULE'),
+ ('asyncio.base_subprocess',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\base_subprocess.py',
+ 'PYMODULE'),
+ ('asyncio.threads',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\threads.py',
+ 'PYMODULE'),
+ ('asyncio.subprocess',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\subprocess.py',
+ 'PYMODULE'),
+ ('asyncio.streams',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\streams.py',
+ 'PYMODULE'),
+ ('asyncio.queues',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\queues.py',
+ 'PYMODULE'),
+ ('asyncio.runners',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\runners.py',
+ 'PYMODULE'),
+ ('asyncio.base_events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\base_events.py',
+ 'PYMODULE'),
+ ('concurrent.futures',
+ 'C:\\Program Files\\Python310\\lib\\concurrent\\futures\\__init__.py',
+ 'PYMODULE'),
+ ('concurrent.futures.thread',
+ 'C:\\Program Files\\Python310\\lib\\concurrent\\futures\\thread.py',
+ 'PYMODULE'),
+ ('concurrent.futures.process',
+ 'C:\\Program Files\\Python310\\lib\\concurrent\\futures\\process.py',
+ 'PYMODULE'),
+ ('concurrent.futures._base',
+ 'C:\\Program Files\\Python310\\lib\\concurrent\\futures\\_base.py',
+ 'PYMODULE'),
+ ('concurrent',
+ 'C:\\Program Files\\Python310\\lib\\concurrent\\__init__.py',
+ 'PYMODULE'),
+ ('asyncio.trsock',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\trsock.py',
+ 'PYMODULE'),
+ ('asyncio.staggered',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\staggered.py',
+ 'PYMODULE'),
+ ('asyncio.tasks',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\tasks.py',
+ 'PYMODULE'),
+ ('asyncio.base_tasks',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\base_tasks.py',
+ 'PYMODULE'),
+ ('asyncio.locks',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\locks.py',
+ 'PYMODULE'),
+ ('asyncio.mixins',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\mixins.py',
+ 'PYMODULE'),
+ ('asyncio.sslproto',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\sslproto.py',
+ 'PYMODULE'),
+ ('asyncio.transports',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\transports.py',
+ 'PYMODULE'),
+ ('asyncio.protocols',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\protocols.py',
+ 'PYMODULE'),
+ ('asyncio.futures',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\futures.py',
+ 'PYMODULE'),
+ ('asyncio.exceptions',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\exceptions.py',
+ 'PYMODULE'),
+ ('asyncio.events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\events.py',
+ 'PYMODULE'),
+ ('asyncio.coroutines',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\coroutines.py',
+ 'PYMODULE'),
+ ('asyncio.base_futures',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\base_futures.py',
+ 'PYMODULE'),
+ ('asyncio.format_helpers',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\format_helpers.py',
+ 'PYMODULE'),
+ ('asyncio.constants',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\constants.py',
+ 'PYMODULE')],
+ [('VCRUNTIME140.dll',
+ 'C:\\Program Files\\Python310\\VCRUNTIME140.dll',
+ 'BINARY'),
+ ('python310.dll', 'C:\\Program Files\\Python310\\python310.dll', 'BINARY'),
+ ('_multiprocessing',
+ 'C:\\Program Files\\Python310\\DLLs\\_multiprocessing.pyd',
+ 'EXTENSION'),
+ ('pyexpat', 'C:\\Program Files\\Python310\\DLLs\\pyexpat.pyd', 'EXTENSION'),
+ ('_ssl', 'C:\\Program Files\\Python310\\DLLs\\_ssl.pyd', 'EXTENSION'),
+ ('_decimal', 'C:\\Program Files\\Python310\\DLLs\\_decimal.pyd', 'EXTENSION'),
+ ('_hashlib', 'C:\\Program Files\\Python310\\DLLs\\_hashlib.pyd', 'EXTENSION'),
+ ('select', 'C:\\Program Files\\Python310\\DLLs\\select.pyd', 'EXTENSION'),
+ ('_lzma', 'C:\\Program Files\\Python310\\DLLs\\_lzma.pyd', 'EXTENSION'),
+ ('_bz2', 'C:\\Program Files\\Python310\\DLLs\\_bz2.pyd', 'EXTENSION'),
+ ('_queue', 'C:\\Program Files\\Python310\\DLLs\\_queue.pyd', 'EXTENSION'),
+ ('unicodedata',
+ 'C:\\Program Files\\Python310\\DLLs\\unicodedata.pyd',
+ 'EXTENSION'),
+ ('_elementtree',
+ 'C:\\Program Files\\Python310\\DLLs\\_elementtree.pyd',
+ 'EXTENSION'),
+ ('psutil._psutil_windows',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\psutil\\_psutil_windows.pyd',
+ 'EXTENSION'),
+ ('_ctypes', 'C:\\Program Files\\Python310\\DLLs\\_ctypes.pyd', 'EXTENSION'),
+ ('_socket', 'C:\\Program Files\\Python310\\DLLs\\_socket.pyd', 'EXTENSION'),
+ ('_uuid', 'C:\\Program Files\\Python310\\DLLs\\_uuid.pyd', 'EXTENSION'),
+ ('_overlapped',
+ 'C:\\Program Files\\Python310\\DLLs\\_overlapped.pyd',
+ 'EXTENSION'),
+ ('_asyncio', 'C:\\Program Files\\Python310\\DLLs\\_asyncio.pyd', 'EXTENSION'),
+ ('libcrypto-1_1.dll',
+ 'C:\\Program Files\\Python310\\DLLs\\libcrypto-1_1.dll',
+ 'BINARY'),
+ ('libssl-1_1.dll',
+ 'C:\\Program Files\\Python310\\DLLs\\libssl-1_1.dll',
+ 'BINARY'),
+ ('python3.dll', 'C:\\Program Files\\Python310\\python3.dll', 'BINARY'),
+ ('libffi-7.dll',
+ 'C:\\Program Files\\Python310\\DLLs\\libffi-7.dll',
+ 'BINARY')],
+ [],
+ [],
+ [('base_library.zip',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\base_library.zip',
+ 'DATA'),
+ ('certifi\\py.typed',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\certifi\\py.typed',
+ 'DATA'),
+ ('certifi\\cacert.pem',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\certifi\\cacert.pem',
+ 'DATA')],
+ [])
diff --git a/build/mqtt_srv/EXE-00.toc b/build/mqtt_srv/EXE-00.toc
new file mode 100644
index 0000000..8438080
--- /dev/null
+++ b/build/mqtt_srv/EXE-00.toc
@@ -0,0 +1,115 @@
+('X:\\__GITHUB\\python\\dist\\mqtt_srv.exe',
+ False,
+ False,
+ False,
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-windowed.ico',
+ None,
+ False,
+ False,
+ 'true',
+ True,
+ True,
+ False,
+ None,
+ None,
+ None,
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\mqtt_srv.pkg',
+ [('PYZ-00.pyz', 'X:\\__GITHUB\\python\\build\\mqtt_srv\\PYZ-00.pyz', 'PYZ'),
+ ('struct',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\localpycs\\struct.pyc',
+ 'PYMODULE'),
+ ('pyimod01_archive',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\localpycs\\pyimod01_archive.pyc',
+ 'PYMODULE'),
+ ('pyimod02_importers',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\localpycs\\pyimod02_importers.pyc',
+ 'PYMODULE'),
+ ('pyimod03_ctypes',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\localpycs\\pyimod03_ctypes.pyc',
+ 'PYMODULE'),
+ ('pyimod04_pywin32',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\localpycs\\pyimod04_pywin32.pyc',
+ 'PYMODULE'),
+ ('pyiboot01_bootstrap',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\PyInstaller\\loader\\pyiboot01_bootstrap.py',
+ 'PYSOURCE'),
+ ('pyi_rth_inspect',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py',
+ 'PYSOURCE'),
+ ('pyi_rth_subprocess',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_subprocess.py',
+ 'PYSOURCE'),
+ ('pyi_rth_pkgutil',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py',
+ 'PYSOURCE'),
+ ('pyi_rth_multiprocessing',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py',
+ 'PYSOURCE'),
+ ('mqtt_srv',
+ '\\\\192.168.77.106\\Data\\__GITHUB\\python\\mqtt_srv.pyw',
+ 'PYSOURCE'),
+ ('VCRUNTIME140.dll',
+ 'C:\\Program Files\\Python310\\VCRUNTIME140.dll',
+ 'BINARY'),
+ ('python310.dll', 'C:\\Program Files\\Python310\\python310.dll', 'BINARY'),
+ ('_multiprocessing',
+ 'C:\\Program Files\\Python310\\DLLs\\_multiprocessing.pyd',
+ 'EXTENSION'),
+ ('pyexpat', 'C:\\Program Files\\Python310\\DLLs\\pyexpat.pyd', 'EXTENSION'),
+ ('_ssl', 'C:\\Program Files\\Python310\\DLLs\\_ssl.pyd', 'EXTENSION'),
+ ('_decimal', 'C:\\Program Files\\Python310\\DLLs\\_decimal.pyd', 'EXTENSION'),
+ ('_hashlib', 'C:\\Program Files\\Python310\\DLLs\\_hashlib.pyd', 'EXTENSION'),
+ ('select', 'C:\\Program Files\\Python310\\DLLs\\select.pyd', 'EXTENSION'),
+ ('_lzma', 'C:\\Program Files\\Python310\\DLLs\\_lzma.pyd', 'EXTENSION'),
+ ('_bz2', 'C:\\Program Files\\Python310\\DLLs\\_bz2.pyd', 'EXTENSION'),
+ ('_queue', 'C:\\Program Files\\Python310\\DLLs\\_queue.pyd', 'EXTENSION'),
+ ('unicodedata',
+ 'C:\\Program Files\\Python310\\DLLs\\unicodedata.pyd',
+ 'EXTENSION'),
+ ('_elementtree',
+ 'C:\\Program Files\\Python310\\DLLs\\_elementtree.pyd',
+ 'EXTENSION'),
+ ('psutil._psutil_windows',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\psutil\\_psutil_windows.pyd',
+ 'EXTENSION'),
+ ('_ctypes', 'C:\\Program Files\\Python310\\DLLs\\_ctypes.pyd', 'EXTENSION'),
+ ('_socket', 'C:\\Program Files\\Python310\\DLLs\\_socket.pyd', 'EXTENSION'),
+ ('_uuid', 'C:\\Program Files\\Python310\\DLLs\\_uuid.pyd', 'EXTENSION'),
+ ('_overlapped',
+ 'C:\\Program Files\\Python310\\DLLs\\_overlapped.pyd',
+ 'EXTENSION'),
+ ('_asyncio', 'C:\\Program Files\\Python310\\DLLs\\_asyncio.pyd', 'EXTENSION'),
+ ('libcrypto-1_1.dll',
+ 'C:\\Program Files\\Python310\\DLLs\\libcrypto-1_1.dll',
+ 'BINARY'),
+ ('libssl-1_1.dll',
+ 'C:\\Program Files\\Python310\\DLLs\\libssl-1_1.dll',
+ 'BINARY'),
+ ('python3.dll', 'C:\\Program Files\\Python310\\python3.dll', 'BINARY'),
+ ('libffi-7.dll',
+ 'C:\\Program Files\\Python310\\DLLs\\libffi-7.dll',
+ 'BINARY'),
+ ('base_library.zip',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\base_library.zip',
+ 'DATA'),
+ ('certifi\\py.typed',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\certifi\\py.typed',
+ 'DATA'),
+ ('certifi\\cacert.pem',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\certifi\\cacert.pem',
+ 'DATA')],
+ [],
+ False,
+ False,
+ 1669484603,
+ [('runw.exe',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\PyInstaller\\bootloader\\Windows-64bit\\runw.exe',
+ 'EXECUTABLE')])
diff --git a/build/mqtt_srv/PKG-00.toc b/build/mqtt_srv/PKG-00.toc
new file mode 100644
index 0000000..e0d9ac0
--- /dev/null
+++ b/build/mqtt_srv/PKG-00.toc
@@ -0,0 +1,106 @@
+('X:\\__GITHUB\\python\\build\\mqtt_srv\\mqtt_srv.pkg',
+ {'BINARY': 1,
+ 'DATA': 1,
+ 'EXECUTABLE': 1,
+ 'EXTENSION': 1,
+ 'PYMODULE': 1,
+ 'PYSOURCE': 1,
+ 'PYZ': 0,
+ 'SPLASH': 1},
+ [('PYZ-00.pyz', 'X:\\__GITHUB\\python\\build\\mqtt_srv\\PYZ-00.pyz', 'PYZ'),
+ ('struct',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\localpycs\\struct.pyc',
+ 'PYMODULE'),
+ ('pyimod01_archive',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\localpycs\\pyimod01_archive.pyc',
+ 'PYMODULE'),
+ ('pyimod02_importers',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\localpycs\\pyimod02_importers.pyc',
+ 'PYMODULE'),
+ ('pyimod03_ctypes',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\localpycs\\pyimod03_ctypes.pyc',
+ 'PYMODULE'),
+ ('pyimod04_pywin32',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\localpycs\\pyimod04_pywin32.pyc',
+ 'PYMODULE'),
+ ('pyiboot01_bootstrap',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\PyInstaller\\loader\\pyiboot01_bootstrap.py',
+ 'PYSOURCE'),
+ ('pyi_rth_inspect',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py',
+ 'PYSOURCE'),
+ ('pyi_rth_subprocess',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_subprocess.py',
+ 'PYSOURCE'),
+ ('pyi_rth_pkgutil',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py',
+ 'PYSOURCE'),
+ ('pyi_rth_multiprocessing',
+ 'C:\\Program '
+ 'Files\\Python310\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py',
+ 'PYSOURCE'),
+ ('mqtt_srv',
+ '\\\\192.168.77.106\\Data\\__GITHUB\\python\\mqtt_srv.pyw',
+ 'PYSOURCE'),
+ ('VCRUNTIME140.dll',
+ 'C:\\Program Files\\Python310\\VCRUNTIME140.dll',
+ 'BINARY'),
+ ('python310.dll', 'C:\\Program Files\\Python310\\python310.dll', 'BINARY'),
+ ('_multiprocessing',
+ 'C:\\Program Files\\Python310\\DLLs\\_multiprocessing.pyd',
+ 'EXTENSION'),
+ ('pyexpat', 'C:\\Program Files\\Python310\\DLLs\\pyexpat.pyd', 'EXTENSION'),
+ ('_ssl', 'C:\\Program Files\\Python310\\DLLs\\_ssl.pyd', 'EXTENSION'),
+ ('_decimal', 'C:\\Program Files\\Python310\\DLLs\\_decimal.pyd', 'EXTENSION'),
+ ('_hashlib', 'C:\\Program Files\\Python310\\DLLs\\_hashlib.pyd', 'EXTENSION'),
+ ('select', 'C:\\Program Files\\Python310\\DLLs\\select.pyd', 'EXTENSION'),
+ ('_lzma', 'C:\\Program Files\\Python310\\DLLs\\_lzma.pyd', 'EXTENSION'),
+ ('_bz2', 'C:\\Program Files\\Python310\\DLLs\\_bz2.pyd', 'EXTENSION'),
+ ('_queue', 'C:\\Program Files\\Python310\\DLLs\\_queue.pyd', 'EXTENSION'),
+ ('unicodedata',
+ 'C:\\Program Files\\Python310\\DLLs\\unicodedata.pyd',
+ 'EXTENSION'),
+ ('_elementtree',
+ 'C:\\Program Files\\Python310\\DLLs\\_elementtree.pyd',
+ 'EXTENSION'),
+ ('psutil._psutil_windows',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\psutil\\_psutil_windows.pyd',
+ 'EXTENSION'),
+ ('_ctypes', 'C:\\Program Files\\Python310\\DLLs\\_ctypes.pyd', 'EXTENSION'),
+ ('_socket', 'C:\\Program Files\\Python310\\DLLs\\_socket.pyd', 'EXTENSION'),
+ ('_uuid', 'C:\\Program Files\\Python310\\DLLs\\_uuid.pyd', 'EXTENSION'),
+ ('_overlapped',
+ 'C:\\Program Files\\Python310\\DLLs\\_overlapped.pyd',
+ 'EXTENSION'),
+ ('_asyncio', 'C:\\Program Files\\Python310\\DLLs\\_asyncio.pyd', 'EXTENSION'),
+ ('libcrypto-1_1.dll',
+ 'C:\\Program Files\\Python310\\DLLs\\libcrypto-1_1.dll',
+ 'BINARY'),
+ ('libssl-1_1.dll',
+ 'C:\\Program Files\\Python310\\DLLs\\libssl-1_1.dll',
+ 'BINARY'),
+ ('python3.dll', 'C:\\Program Files\\Python310\\python3.dll', 'BINARY'),
+ ('libffi-7.dll',
+ 'C:\\Program Files\\Python310\\DLLs\\libffi-7.dll',
+ 'BINARY'),
+ ('base_library.zip',
+ 'X:\\__GITHUB\\python\\build\\mqtt_srv\\base_library.zip',
+ 'DATA'),
+ ('certifi\\py.typed',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\certifi\\py.typed',
+ 'DATA'),
+ ('certifi\\cacert.pem',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\certifi\\cacert.pem',
+ 'DATA')],
+ False,
+ False,
+ False,
+ [],
+ None,
+ None,
+ None)
diff --git a/build/mqtt_srv/PYZ-00.pyz b/build/mqtt_srv/PYZ-00.pyz
new file mode 100644
index 0000000..fa53da2
Binary files /dev/null and b/build/mqtt_srv/PYZ-00.pyz differ
diff --git a/build/mqtt_srv/PYZ-00.toc b/build/mqtt_srv/PYZ-00.toc
new file mode 100644
index 0000000..41963d4
--- /dev/null
+++ b/build/mqtt_srv/PYZ-00.toc
@@ -0,0 +1,770 @@
+('X:\\__GITHUB\\python\\build\\mqtt_srv\\PYZ-00.pyz',
+ [('multiprocessing.popen_spawn_posix',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\popen_spawn_posix.py',
+ 'PYMODULE'),
+ ('multiprocessing.resource_tracker',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\resource_tracker.py',
+ 'PYMODULE'),
+ ('threading', 'C:\\Program Files\\Python310\\lib\\threading.py', 'PYMODULE'),
+ ('_threading_local',
+ 'C:\\Program Files\\Python310\\lib\\_threading_local.py',
+ 'PYMODULE'),
+ ('contextlib',
+ 'C:\\Program Files\\Python310\\lib\\contextlib.py',
+ 'PYMODULE'),
+ ('signal', 'C:\\Program Files\\Python310\\lib\\signal.py', 'PYMODULE'),
+ ('multiprocessing.util',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\util.py',
+ 'PYMODULE'),
+ ('multiprocessing.forkserver',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\forkserver.py',
+ 'PYMODULE'),
+ ('multiprocessing.connection',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\connection.py',
+ 'PYMODULE'),
+ ('multiprocessing.resource_sharer',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\resource_sharer.py',
+ 'PYMODULE'),
+ ('xmlrpc.client',
+ 'C:\\Program Files\\Python310\\lib\\xmlrpc\\client.py',
+ 'PYMODULE'),
+ ('xmlrpc',
+ 'C:\\Program Files\\Python310\\lib\\xmlrpc\\__init__.py',
+ 'PYMODULE'),
+ ('gzip', 'C:\\Program Files\\Python310\\lib\\gzip.py', 'PYMODULE'),
+ ('argparse', 'C:\\Program Files\\Python310\\lib\\argparse.py', 'PYMODULE'),
+ ('textwrap', 'C:\\Program Files\\Python310\\lib\\textwrap.py', 'PYMODULE'),
+ ('copy', 'C:\\Program Files\\Python310\\lib\\copy.py', 'PYMODULE'),
+ ('gettext', 'C:\\Program Files\\Python310\\lib\\gettext.py', 'PYMODULE'),
+ ('_compression',
+ 'C:\\Program Files\\Python310\\lib\\_compression.py',
+ 'PYMODULE'),
+ ('xml.parsers.expat',
+ 'C:\\Program Files\\Python310\\lib\\xml\\parsers\\expat.py',
+ 'PYMODULE'),
+ ('xml.parsers',
+ 'C:\\Program Files\\Python310\\lib\\xml\\parsers\\__init__.py',
+ 'PYMODULE'),
+ ('xml', 'C:\\Program Files\\Python310\\lib\\xml\\__init__.py', 'PYMODULE'),
+ ('xml.sax.expatreader',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\expatreader.py',
+ 'PYMODULE'),
+ ('xml.sax.saxutils',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\saxutils.py',
+ 'PYMODULE'),
+ ('xml.sax',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\__init__.py',
+ 'PYMODULE'),
+ ('xml.sax.handler',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\handler.py',
+ 'PYMODULE'),
+ ('xml.sax._exceptions',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\_exceptions.py',
+ 'PYMODULE'),
+ ('xml.sax.xmlreader',
+ 'C:\\Program Files\\Python310\\lib\\xml\\sax\\xmlreader.py',
+ 'PYMODULE'),
+ ('http.client',
+ 'C:\\Program Files\\Python310\\lib\\http\\client.py',
+ 'PYMODULE'),
+ ('ssl', 'C:\\Program Files\\Python310\\lib\\ssl.py', 'PYMODULE'),
+ ('calendar', 'C:\\Program Files\\Python310\\lib\\calendar.py', 'PYMODULE'),
+ ('http', 'C:\\Program Files\\Python310\\lib\\http\\__init__.py', 'PYMODULE'),
+ ('email.message',
+ 'C:\\Program Files\\Python310\\lib\\email\\message.py',
+ 'PYMODULE'),
+ ('email.policy',
+ 'C:\\Program Files\\Python310\\lib\\email\\policy.py',
+ 'PYMODULE'),
+ ('email.contentmanager',
+ 'C:\\Program Files\\Python310\\lib\\email\\contentmanager.py',
+ 'PYMODULE'),
+ ('email.quoprimime',
+ 'C:\\Program Files\\Python310\\lib\\email\\quoprimime.py',
+ 'PYMODULE'),
+ ('string', 'C:\\Program Files\\Python310\\lib\\string.py', 'PYMODULE'),
+ ('email.headerregistry',
+ 'C:\\Program Files\\Python310\\lib\\email\\headerregistry.py',
+ 'PYMODULE'),
+ ('email._header_value_parser',
+ 'C:\\Program Files\\Python310\\lib\\email\\_header_value_parser.py',
+ 'PYMODULE'),
+ ('email.iterators',
+ 'C:\\Program Files\\Python310\\lib\\email\\iterators.py',
+ 'PYMODULE'),
+ ('email.generator',
+ 'C:\\Program Files\\Python310\\lib\\email\\generator.py',
+ 'PYMODULE'),
+ ('email._encoded_words',
+ 'C:\\Program Files\\Python310\\lib\\email\\_encoded_words.py',
+ 'PYMODULE'),
+ ('email.charset',
+ 'C:\\Program Files\\Python310\\lib\\email\\charset.py',
+ 'PYMODULE'),
+ ('email.encoders',
+ 'C:\\Program Files\\Python310\\lib\\email\\encoders.py',
+ 'PYMODULE'),
+ ('email.base64mime',
+ 'C:\\Program Files\\Python310\\lib\\email\\base64mime.py',
+ 'PYMODULE'),
+ ('email._policybase',
+ 'C:\\Program Files\\Python310\\lib\\email\\_policybase.py',
+ 'PYMODULE'),
+ ('email.header',
+ 'C:\\Program Files\\Python310\\lib\\email\\header.py',
+ 'PYMODULE'),
+ ('email.errors',
+ 'C:\\Program Files\\Python310\\lib\\email\\errors.py',
+ 'PYMODULE'),
+ ('email.utils',
+ 'C:\\Program Files\\Python310\\lib\\email\\utils.py',
+ 'PYMODULE'),
+ ('email._parseaddr',
+ 'C:\\Program Files\\Python310\\lib\\email\\_parseaddr.py',
+ 'PYMODULE'),
+ ('email',
+ 'C:\\Program Files\\Python310\\lib\\email\\__init__.py',
+ 'PYMODULE'),
+ ('quopri', 'C:\\Program Files\\Python310\\lib\\quopri.py', 'PYMODULE'),
+ ('uu', 'C:\\Program Files\\Python310\\lib\\uu.py', 'PYMODULE'),
+ ('optparse', 'C:\\Program Files\\Python310\\lib\\optparse.py', 'PYMODULE'),
+ ('email.parser',
+ 'C:\\Program Files\\Python310\\lib\\email\\parser.py',
+ 'PYMODULE'),
+ ('email.feedparser',
+ 'C:\\Program Files\\Python310\\lib\\email\\feedparser.py',
+ 'PYMODULE'),
+ ('decimal', 'C:\\Program Files\\Python310\\lib\\decimal.py', 'PYMODULE'),
+ ('_pydecimal',
+ 'C:\\Program Files\\Python310\\lib\\_pydecimal.py',
+ 'PYMODULE'),
+ ('contextvars',
+ 'C:\\Program Files\\Python310\\lib\\contextvars.py',
+ 'PYMODULE'),
+ ('numbers', 'C:\\Program Files\\Python310\\lib\\numbers.py', 'PYMODULE'),
+ ('base64', 'C:\\Program Files\\Python310\\lib\\base64.py', 'PYMODULE'),
+ ('hmac', 'C:\\Program Files\\Python310\\lib\\hmac.py', 'PYMODULE'),
+ ('hashlib', 'C:\\Program Files\\Python310\\lib\\hashlib.py', 'PYMODULE'),
+ ('struct', 'C:\\Program Files\\Python310\\lib\\struct.py', 'PYMODULE'),
+ ('selectors', 'C:\\Program Files\\Python310\\lib\\selectors.py', 'PYMODULE'),
+ ('tempfile', 'C:\\Program Files\\Python310\\lib\\tempfile.py', 'PYMODULE'),
+ ('shutil', 'C:\\Program Files\\Python310\\lib\\shutil.py', 'PYMODULE'),
+ ('zipfile', 'C:\\Program Files\\Python310\\lib\\zipfile.py', 'PYMODULE'),
+ ('py_compile',
+ 'C:\\Program Files\\Python310\\lib\\py_compile.py',
+ 'PYMODULE'),
+ ('importlib.machinery',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\machinery.py',
+ 'PYMODULE'),
+ ('importlib',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\__init__.py',
+ 'PYMODULE'),
+ ('importlib._common',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\_common.py',
+ 'PYMODULE'),
+ ('importlib._adapters',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\_adapters.py',
+ 'PYMODULE'),
+ ('typing', 'C:\\Program Files\\Python310\\lib\\typing.py', 'PYMODULE'),
+ ('importlib.abc',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\abc.py',
+ 'PYMODULE'),
+ ('importlib._abc',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\_abc.py',
+ 'PYMODULE'),
+ ('importlib._bootstrap',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\_bootstrap.py',
+ 'PYMODULE'),
+ ('importlib._bootstrap_external',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\_bootstrap_external.py',
+ 'PYMODULE'),
+ ('importlib.metadata',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\__init__.py',
+ 'PYMODULE'),
+ ('importlib.metadata._itertools',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_itertools.py',
+ 'PYMODULE'),
+ ('importlib.metadata._functools',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_functools.py',
+ 'PYMODULE'),
+ ('importlib.metadata._collections',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_collections.py',
+ 'PYMODULE'),
+ ('importlib.metadata._meta',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_meta.py',
+ 'PYMODULE'),
+ ('importlib.metadata._adapters',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_adapters.py',
+ 'PYMODULE'),
+ ('importlib.metadata._text',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\metadata\\_text.py',
+ 'PYMODULE'),
+ ('csv', 'C:\\Program Files\\Python310\\lib\\csv.py', 'PYMODULE'),
+ ('importlib.readers',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\readers.py',
+ 'PYMODULE'),
+ ('importlib.util',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\util.py',
+ 'PYMODULE'),
+ ('tarfile', 'C:\\Program Files\\Python310\\lib\\tarfile.py', 'PYMODULE'),
+ ('lzma', 'C:\\Program Files\\Python310\\lib\\lzma.py', 'PYMODULE'),
+ ('bz2', 'C:\\Program Files\\Python310\\lib\\bz2.py', 'PYMODULE'),
+ ('logging',
+ 'C:\\Program Files\\Python310\\lib\\logging\\__init__.py',
+ 'PYMODULE'),
+ ('pickle', 'C:\\Program Files\\Python310\\lib\\pickle.py', 'PYMODULE'),
+ ('pprint', 'C:\\Program Files\\Python310\\lib\\pprint.py', 'PYMODULE'),
+ ('dataclasses',
+ 'C:\\Program Files\\Python310\\lib\\dataclasses.py',
+ 'PYMODULE'),
+ ('inspect', 'C:\\Program Files\\Python310\\lib\\inspect.py', 'PYMODULE'),
+ ('dis', 'C:\\Program Files\\Python310\\lib\\dis.py', 'PYMODULE'),
+ ('opcode', 'C:\\Program Files\\Python310\\lib\\opcode.py', 'PYMODULE'),
+ ('ast', 'C:\\Program Files\\Python310\\lib\\ast.py', 'PYMODULE'),
+ ('_compat_pickle',
+ 'C:\\Program Files\\Python310\\lib\\_compat_pickle.py',
+ 'PYMODULE'),
+ ('multiprocessing.process',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\process.py',
+ 'PYMODULE'),
+ ('multiprocessing.context',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\context.py',
+ 'PYMODULE'),
+ ('multiprocessing.popen_forkserver',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\popen_forkserver.py',
+ 'PYMODULE'),
+ ('multiprocessing.sharedctypes',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\sharedctypes.py',
+ 'PYMODULE'),
+ ('multiprocessing.heap',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\heap.py',
+ 'PYMODULE'),
+ ('bisect', 'C:\\Program Files\\Python310\\lib\\bisect.py', 'PYMODULE'),
+ ('multiprocessing.pool',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\pool.py',
+ 'PYMODULE'),
+ ('multiprocessing.dummy',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\dummy\\__init__.py',
+ 'PYMODULE'),
+ ('multiprocessing.dummy.connection',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\dummy\\connection.py',
+ 'PYMODULE'),
+ ('queue', 'C:\\Program Files\\Python310\\lib\\queue.py', 'PYMODULE'),
+ ('multiprocessing.queues',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\queues.py',
+ 'PYMODULE'),
+ ('multiprocessing.synchronize',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\synchronize.py',
+ 'PYMODULE'),
+ ('multiprocessing.managers',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\managers.py',
+ 'PYMODULE'),
+ ('multiprocessing.shared_memory',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\shared_memory.py',
+ 'PYMODULE'),
+ ('secrets', 'C:\\Program Files\\Python310\\lib\\secrets.py', 'PYMODULE'),
+ ('multiprocessing.reduction',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\reduction.py',
+ 'PYMODULE'),
+ ('multiprocessing.popen_fork',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\popen_fork.py',
+ 'PYMODULE'),
+ ('multiprocessing.popen_spawn_win32',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\popen_spawn_win32.py',
+ 'PYMODULE'),
+ ('multiprocessing.spawn',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\spawn.py',
+ 'PYMODULE'),
+ ('runpy', 'C:\\Program Files\\Python310\\lib\\runpy.py', 'PYMODULE'),
+ ('pkgutil', 'C:\\Program Files\\Python310\\lib\\pkgutil.py', 'PYMODULE'),
+ ('zipimport', 'C:\\Program Files\\Python310\\lib\\zipimport.py', 'PYMODULE'),
+ ('multiprocessing',
+ 'C:\\Program Files\\Python310\\lib\\multiprocessing\\__init__.py',
+ 'PYMODULE'),
+ ('getpass', 'C:\\Program Files\\Python310\\lib\\getpass.py', 'PYMODULE'),
+ ('nturl2path',
+ 'C:\\Program Files\\Python310\\lib\\nturl2path.py',
+ 'PYMODULE'),
+ ('ftplib', 'C:\\Program Files\\Python310\\lib\\ftplib.py', 'PYMODULE'),
+ ('netrc', 'C:\\Program Files\\Python310\\lib\\netrc.py', 'PYMODULE'),
+ ('shlex', 'C:\\Program Files\\Python310\\lib\\shlex.py', 'PYMODULE'),
+ ('mimetypes', 'C:\\Program Files\\Python310\\lib\\mimetypes.py', 'PYMODULE'),
+ ('http.cookiejar',
+ 'C:\\Program Files\\Python310\\lib\\http\\cookiejar.py',
+ 'PYMODULE'),
+ ('stringprep',
+ 'C:\\Program Files\\Python310\\lib\\stringprep.py',
+ 'PYMODULE'),
+ ('tracemalloc',
+ 'C:\\Program Files\\Python310\\lib\\tracemalloc.py',
+ 'PYMODULE'),
+ ('_py_abc', 'C:\\Program Files\\Python310\\lib\\_py_abc.py', 'PYMODULE'),
+ ('ping3',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\ping3\\__init__.py',
+ 'PYMODULE'),
+ ('ping3.enums',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\ping3\\enums.py',
+ 'PYMODULE'),
+ ('ping3.errors',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\ping3\\errors.py',
+ 'PYMODULE'),
+ ('psutil',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\__init__.py',
+ 'PYMODULE'),
+ ('psutil._psaix',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_psaix.py',
+ 'PYMODULE'),
+ ('glob', 'C:\\Program Files\\Python310\\lib\\glob.py', 'PYMODULE'),
+ ('psutil._pssunos',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_pssunos.py',
+ 'PYMODULE'),
+ ('psutil._psbsd',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_psbsd.py',
+ 'PYMODULE'),
+ ('xml.etree.ElementTree',
+ 'C:\\Program Files\\Python310\\lib\\xml\\etree\\ElementTree.py',
+ 'PYMODULE'),
+ ('xml.etree.cElementTree',
+ 'C:\\Program Files\\Python310\\lib\\xml\\etree\\cElementTree.py',
+ 'PYMODULE'),
+ ('xml.etree.ElementInclude',
+ 'C:\\Program Files\\Python310\\lib\\xml\\etree\\ElementInclude.py',
+ 'PYMODULE'),
+ ('xml.etree.ElementPath',
+ 'C:\\Program Files\\Python310\\lib\\xml\\etree\\ElementPath.py',
+ 'PYMODULE'),
+ ('xml.etree',
+ 'C:\\Program Files\\Python310\\lib\\xml\\etree\\__init__.py',
+ 'PYMODULE'),
+ ('psutil._psosx',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_psosx.py',
+ 'PYMODULE'),
+ ('psutil._pswindows',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_pswindows.py',
+ 'PYMODULE'),
+ ('psutil._pslinux',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_pslinux.py',
+ 'PYMODULE'),
+ ('psutil._psposix',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_psposix.py',
+ 'PYMODULE'),
+ ('psutil._compat',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_compat.py',
+ 'PYMODULE'),
+ ('psutil._common',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\psutil\\_common.py',
+ 'PYMODULE'),
+ ('curses',
+ 'C:\\Program Files\\Python310\\lib\\curses\\__init__.py',
+ 'PYMODULE'),
+ ('curses.has_key',
+ 'C:\\Program Files\\Python310\\lib\\curses\\has_key.py',
+ 'PYMODULE'),
+ ('__future__',
+ 'C:\\Program Files\\Python310\\lib\\__future__.py',
+ 'PYMODULE'),
+ ('requests',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\__init__.py',
+ 'PYMODULE'),
+ ('requests.status_codes',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\requests\\status_codes.py',
+ 'PYMODULE'),
+ ('requests.structures',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\structures.py',
+ 'PYMODULE'),
+ ('requests.compat',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\compat.py',
+ 'PYMODULE'),
+ ('http.cookies',
+ 'C:\\Program Files\\Python310\\lib\\http\\cookies.py',
+ 'PYMODULE'),
+ ('requests.models',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\models.py',
+ 'PYMODULE'),
+ ('idna',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\__init__.py',
+ 'PYMODULE'),
+ ('idna.intranges',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\intranges.py',
+ 'PYMODULE'),
+ ('idna.core',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\core.py',
+ 'PYMODULE'),
+ ('idna.uts46data',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\uts46data.py',
+ 'PYMODULE'),
+ ('idna.idnadata',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\idnadata.py',
+ 'PYMODULE'),
+ ('idna.package_data',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\idna\\package_data.py',
+ 'PYMODULE'),
+ ('requests.hooks',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\hooks.py',
+ 'PYMODULE'),
+ ('requests.cookies',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\cookies.py',
+ 'PYMODULE'),
+ ('requests.auth',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\auth.py',
+ 'PYMODULE'),
+ ('requests._internal_utils',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\requests\\_internal_utils.py',
+ 'PYMODULE'),
+ ('urllib3.util',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\__init__.py',
+ 'PYMODULE'),
+ ('urllib3.util.wait',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\wait.py',
+ 'PYMODULE'),
+ ('urllib3.util.url',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\url.py',
+ 'PYMODULE'),
+ ('urllib3.packages.six',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\packages\\six.py',
+ 'PYMODULE'),
+ ('urllib3.packages',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\packages\\__init__.py',
+ 'PYMODULE'),
+ ('urllib3.util.timeout',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\timeout.py',
+ 'PYMODULE'),
+ ('urllib3.util.ssl_',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\ssl_.py',
+ 'PYMODULE'),
+ ('urllib3.util.ssltransport',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\ssltransport.py',
+ 'PYMODULE'),
+ ('urllib3.util.retry',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\retry.py',
+ 'PYMODULE'),
+ ('urllib3.util.response',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\response.py',
+ 'PYMODULE'),
+ ('urllib3.util.request',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\request.py',
+ 'PYMODULE'),
+ ('urllib3.util.connection',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\connection.py',
+ 'PYMODULE'),
+ ('urllib3.contrib._appengine_environ',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\contrib\\_appengine_environ.py',
+ 'PYMODULE'),
+ ('urllib3.filepost',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\filepost.py',
+ 'PYMODULE'),
+ ('urllib3.fields',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\fields.py',
+ 'PYMODULE'),
+ ('requests.api',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\api.py',
+ 'PYMODULE'),
+ ('requests.sessions',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\sessions.py',
+ 'PYMODULE'),
+ ('requests.adapters',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\adapters.py',
+ 'PYMODULE'),
+ ('urllib3.contrib.socks',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\contrib\\socks.py',
+ 'PYMODULE'),
+ ('urllib3.connectionpool',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\connectionpool.py',
+ 'PYMODULE'),
+ ('urllib3.util.ssl_match_hostname',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\util\\ssl_match_hostname.py',
+ 'PYMODULE'),
+ ('ipaddress', 'C:\\Program Files\\Python310\\lib\\ipaddress.py', 'PYMODULE'),
+ ('urllib3.util.queue',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\queue.py',
+ 'PYMODULE'),
+ ('urllib3.util.proxy',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\util\\proxy.py',
+ 'PYMODULE'),
+ ('urllib3.request',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\request.py',
+ 'PYMODULE'),
+ ('urllib3.connection',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\connection.py',
+ 'PYMODULE'),
+ ('urllib3._version',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\_version.py',
+ 'PYMODULE'),
+ ('urllib3._collections',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\_collections.py',
+ 'PYMODULE'),
+ ('urllib3.response',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\response.py',
+ 'PYMODULE'),
+ ('urllib3.poolmanager',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\poolmanager.py',
+ 'PYMODULE'),
+ ('requests.__version__',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\__version__.py',
+ 'PYMODULE'),
+ ('requests.utils',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\utils.py',
+ 'PYMODULE'),
+ ('requests.certs',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\certs.py',
+ 'PYMODULE'),
+ ('certifi',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\certifi\\__init__.py',
+ 'PYMODULE'),
+ ('certifi.core',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\certifi\\core.py',
+ 'PYMODULE'),
+ ('importlib.resources',
+ 'C:\\Program Files\\Python310\\lib\\importlib\\resources.py',
+ 'PYMODULE'),
+ ('requests.packages',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\packages.py',
+ 'PYMODULE'),
+ ('urllib3.exceptions',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\exceptions.py',
+ 'PYMODULE'),
+ ('urllib3.contrib.pyopenssl',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\contrib\\pyopenssl.py',
+ 'PYMODULE'),
+ ('urllib3.packages.backports.makefile',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\packages\\backports\\makefile.py',
+ 'PYMODULE'),
+ ('urllib3.packages.backports',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\packages\\backports\\__init__.py',
+ 'PYMODULE'),
+ ('urllib3.contrib',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\urllib3\\contrib\\__init__.py',
+ 'PYMODULE'),
+ ('charset_normalizer',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\__init__.py',
+ 'PYMODULE'),
+ ('charset_normalizer.version',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\version.py',
+ 'PYMODULE'),
+ ('charset_normalizer.utils',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\utils.py',
+ 'PYMODULE'),
+ ('charset_normalizer.constant',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\constant.py',
+ 'PYMODULE'),
+ ('charset_normalizer.assets',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\assets\\__init__.py',
+ 'PYMODULE'),
+ ('charset_normalizer.models',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\models.py',
+ 'PYMODULE'),
+ ('charset_normalizer.cd',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\cd.py',
+ 'PYMODULE'),
+ ('charset_normalizer.md',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\md.py',
+ 'PYMODULE'),
+ ('charset_normalizer.legacy',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\legacy.py',
+ 'PYMODULE'),
+ ('charset_normalizer.api',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\charset_normalizer\\api.py',
+ 'PYMODULE'),
+ ('requests.exceptions',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\requests\\exceptions.py',
+ 'PYMODULE'),
+ ('urllib3',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\urllib3\\__init__.py',
+ 'PYMODULE'),
+ ('random', 'C:\\Program Files\\Python310\\lib\\random.py', 'PYMODULE'),
+ ('statistics',
+ 'C:\\Program Files\\Python310\\lib\\statistics.py',
+ 'PYMODULE'),
+ ('fractions', 'C:\\Program Files\\Python310\\lib\\fractions.py', 'PYMODULE'),
+ ('getopt', 'C:\\Program Files\\Python310\\lib\\getopt.py', 'PYMODULE'),
+ ('ctypes',
+ 'C:\\Program Files\\Python310\\lib\\ctypes\\__init__.py',
+ 'PYMODULE'),
+ ('ctypes._endian',
+ 'C:\\Program Files\\Python310\\lib\\ctypes\\_endian.py',
+ 'PYMODULE'),
+ ('datetime', 'C:\\Program Files\\Python310\\lib\\datetime.py', 'PYMODULE'),
+ ('_strptime', 'C:\\Program Files\\Python310\\lib\\_strptime.py', 'PYMODULE'),
+ ('json', 'C:\\Program Files\\Python310\\lib\\json\\__init__.py', 'PYMODULE'),
+ ('json.encoder',
+ 'C:\\Program Files\\Python310\\lib\\json\\encoder.py',
+ 'PYMODULE'),
+ ('json.decoder',
+ 'C:\\Program Files\\Python310\\lib\\json\\decoder.py',
+ 'PYMODULE'),
+ ('json.scanner',
+ 'C:\\Program Files\\Python310\\lib\\json\\scanner.py',
+ 'PYMODULE'),
+ ('subprocess',
+ 'C:\\Program Files\\Python310\\lib\\subprocess.py',
+ 'PYMODULE'),
+ ('socket', 'C:\\Program Files\\Python310\\lib\\socket.py', 'PYMODULE'),
+ ('platform', 'C:\\Program Files\\Python310\\lib\\platform.py', 'PYMODULE'),
+ ('getmac',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\getmac\\__init__.py',
+ 'PYMODULE'),
+ ('getmac.getmac',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\getmac\\getmac.py',
+ 'PYMODULE'),
+ ('uuid', 'C:\\Program Files\\Python310\\lib\\uuid.py', 'PYMODULE'),
+ ('paho.mqtt.client',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\paho\\mqtt\\client.py',
+ 'PYMODULE'),
+ ('paho.mqtt',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\paho\\mqtt\\__init__.py',
+ 'PYMODULE'),
+ ('paho',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\paho\\__init__.py',
+ 'PYMODULE'),
+ ('paho.mqtt.subscribeoptions',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\paho\\mqtt\\subscribeoptions.py',
+ 'PYMODULE'),
+ ('paho.mqtt.reasoncodes',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\paho\\mqtt\\reasoncodes.py',
+ 'PYMODULE'),
+ ('paho.mqtt.packettypes',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\paho\\mqtt\\packettypes.py',
+ 'PYMODULE'),
+ ('paho.mqtt.properties',
+ 'C:\\Program '
+ 'Files\\Python310\\lib\\site-packages\\paho\\mqtt\\properties.py',
+ 'PYMODULE'),
+ ('paho.mqtt.matcher',
+ 'C:\\Program Files\\Python310\\lib\\site-packages\\paho\\mqtt\\matcher.py',
+ 'PYMODULE'),
+ ('asyncio.log',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\log.py',
+ 'PYMODULE'),
+ ('asyncio',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\__init__.py',
+ 'PYMODULE'),
+ ('asyncio.unix_events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\unix_events.py',
+ 'PYMODULE'),
+ ('asyncio.windows_events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\windows_events.py',
+ 'PYMODULE'),
+ ('asyncio.windows_utils',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\windows_utils.py',
+ 'PYMODULE'),
+ ('asyncio.selector_events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\selector_events.py',
+ 'PYMODULE'),
+ ('asyncio.proactor_events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\proactor_events.py',
+ 'PYMODULE'),
+ ('asyncio.base_subprocess',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\base_subprocess.py',
+ 'PYMODULE'),
+ ('asyncio.threads',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\threads.py',
+ 'PYMODULE'),
+ ('asyncio.subprocess',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\subprocess.py',
+ 'PYMODULE'),
+ ('asyncio.streams',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\streams.py',
+ 'PYMODULE'),
+ ('asyncio.queues',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\queues.py',
+ 'PYMODULE'),
+ ('asyncio.runners',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\runners.py',
+ 'PYMODULE'),
+ ('asyncio.base_events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\base_events.py',
+ 'PYMODULE'),
+ ('concurrent.futures',
+ 'C:\\Program Files\\Python310\\lib\\concurrent\\futures\\__init__.py',
+ 'PYMODULE'),
+ ('concurrent.futures.thread',
+ 'C:\\Program Files\\Python310\\lib\\concurrent\\futures\\thread.py',
+ 'PYMODULE'),
+ ('concurrent.futures.process',
+ 'C:\\Program Files\\Python310\\lib\\concurrent\\futures\\process.py',
+ 'PYMODULE'),
+ ('concurrent.futures._base',
+ 'C:\\Program Files\\Python310\\lib\\concurrent\\futures\\_base.py',
+ 'PYMODULE'),
+ ('concurrent',
+ 'C:\\Program Files\\Python310\\lib\\concurrent\\__init__.py',
+ 'PYMODULE'),
+ ('asyncio.trsock',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\trsock.py',
+ 'PYMODULE'),
+ ('asyncio.staggered',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\staggered.py',
+ 'PYMODULE'),
+ ('asyncio.tasks',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\tasks.py',
+ 'PYMODULE'),
+ ('asyncio.base_tasks',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\base_tasks.py',
+ 'PYMODULE'),
+ ('asyncio.locks',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\locks.py',
+ 'PYMODULE'),
+ ('asyncio.mixins',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\mixins.py',
+ 'PYMODULE'),
+ ('asyncio.sslproto',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\sslproto.py',
+ 'PYMODULE'),
+ ('asyncio.transports',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\transports.py',
+ 'PYMODULE'),
+ ('asyncio.protocols',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\protocols.py',
+ 'PYMODULE'),
+ ('asyncio.futures',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\futures.py',
+ 'PYMODULE'),
+ ('asyncio.exceptions',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\exceptions.py',
+ 'PYMODULE'),
+ ('asyncio.events',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\events.py',
+ 'PYMODULE'),
+ ('asyncio.coroutines',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\coroutines.py',
+ 'PYMODULE'),
+ ('asyncio.base_futures',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\base_futures.py',
+ 'PYMODULE'),
+ ('asyncio.format_helpers',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\format_helpers.py',
+ 'PYMODULE'),
+ ('asyncio.constants',
+ 'C:\\Program Files\\Python310\\lib\\asyncio\\constants.py',
+ 'PYMODULE')])
diff --git a/build/mqtt_srv/base_library.zip b/build/mqtt_srv/base_library.zip
new file mode 100644
index 0000000..212f0ad
Binary files /dev/null and b/build/mqtt_srv/base_library.zip differ
diff --git a/build/mqtt_srv/localpycs/pyimod01_archive.pyc b/build/mqtt_srv/localpycs/pyimod01_archive.pyc
new file mode 100644
index 0000000..6d14367
Binary files /dev/null and b/build/mqtt_srv/localpycs/pyimod01_archive.pyc differ
diff --git a/build/mqtt_srv/localpycs/pyimod02_importers.pyc b/build/mqtt_srv/localpycs/pyimod02_importers.pyc
new file mode 100644
index 0000000..1fc7736
Binary files /dev/null and b/build/mqtt_srv/localpycs/pyimod02_importers.pyc differ
diff --git a/build/mqtt_srv/localpycs/pyimod03_ctypes.pyc b/build/mqtt_srv/localpycs/pyimod03_ctypes.pyc
new file mode 100644
index 0000000..d64ffd9
Binary files /dev/null and b/build/mqtt_srv/localpycs/pyimod03_ctypes.pyc differ
diff --git a/build/mqtt_srv/localpycs/pyimod04_pywin32.pyc b/build/mqtt_srv/localpycs/pyimod04_pywin32.pyc
new file mode 100644
index 0000000..00397ca
Binary files /dev/null and b/build/mqtt_srv/localpycs/pyimod04_pywin32.pyc differ
diff --git a/build/mqtt_srv/localpycs/struct.pyc b/build/mqtt_srv/localpycs/struct.pyc
new file mode 100644
index 0000000..9251ff0
Binary files /dev/null and b/build/mqtt_srv/localpycs/struct.pyc differ
diff --git a/build/mqtt_srv/mqtt_srv.exe.manifest b/build/mqtt_srv/mqtt_srv.exe.manifest
new file mode 100644
index 0000000..5358d10
--- /dev/null
+++ b/build/mqtt_srv/mqtt_srv.exe.manifest
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
\ No newline at end of file
diff --git a/build/mqtt_srv/mqtt_srv.pkg b/build/mqtt_srv/mqtt_srv.pkg
new file mode 100644
index 0000000..3447a62
Binary files /dev/null and b/build/mqtt_srv/mqtt_srv.pkg differ
diff --git a/build/mqtt_srv/warn-mqtt_srv.txt b/build/mqtt_srv/warn-mqtt_srv.txt
new file mode 100644
index 0000000..f41c4ec
--- /dev/null
+++ b/build/mqtt_srv/warn-mqtt_srv.txt
@@ -0,0 +1,70 @@
+
+This file lists modules PyInstaller was not able to find. This does not
+necessarily mean this module is required for running your program. Python and
+Python 3rd-party packages include a lot of conditional or optional modules. For
+example the module 'ntpath' only exists on Windows, whereas the module
+'posixpath' only exists on Posix systems.
+
+Types if import:
+* top-level: imported at the top-level - look at these first
+* conditional: imported within an if-statement
+* delayed: imported within a function
+* optional: imported within a try-except-statement
+
+IMPORTANT: Do NOT post this list to the issue-tracker. Use it as a basis for
+ tracking down the missing module yourself. Thanks!
+
+missing module named _posixshmem - imported by multiprocessing.resource_tracker (conditional), multiprocessing.shared_memory (conditional)
+missing module named org - imported by copy (optional)
+missing module named 'org.python' - imported by pickle (optional), xml.sax (delayed, conditional)
+missing module named 'java.lang' - imported by platform (delayed, optional), getmac.getmac (conditional, optional), xml.sax._exceptions (conditional)
+missing module named multiprocessing.BufferTooShort - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
+missing module named multiprocessing.AuthenticationError - imported by multiprocessing (top-level), multiprocessing.connection (top-level)
+missing module named _posixsubprocess - imported by subprocess (optional), multiprocessing.util (delayed)
+missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (top-level)
+excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), zipimport (top-level)
+missing module named pep517 - imported by importlib.metadata (delayed)
+missing module named pwd - imported by posixpath (delayed, conditional), shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional), netrc (delayed, conditional), getpass (delayed), psutil (optional)
+missing module named grp - imported by shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional)
+missing module named posix - imported by os (conditional, optional), shutil (conditional), importlib._bootstrap_external (conditional)
+missing module named resource - imported by posix (top-level), psutil._pslinux (optional)
+missing module named multiprocessing.get_context - imported by multiprocessing (top-level), multiprocessing.pool (top-level), multiprocessing.managers (top-level), multiprocessing.sharedctypes (top-level)
+missing module named multiprocessing.TimeoutError - imported by multiprocessing (top-level), multiprocessing.pool (top-level)
+missing module named multiprocessing.set_start_method - imported by multiprocessing (top-level), multiprocessing.spawn (top-level)
+missing module named multiprocessing.get_start_method - imported by multiprocessing (top-level), multiprocessing.spawn (top-level)
+missing module named pyimod02_importers - imported by C:\Program Files\Python310\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py (top-level)
+missing module named _scproxy - imported by urllib.request (conditional)
+missing module named termios - imported by getpass (optional), psutil._compat (delayed, optional)
+missing module named autorandr - imported by \\192.168.77.106\Data\__GITHUB\python\mqtt_srv.pyw (conditional)
+missing module named psutil._psutil_aix - imported by psutil (top-level), psutil._psaix (top-level)
+missing module named psutil._psutil_sunos - imported by psutil (top-level), psutil._pssunos (top-level)
+missing module named psutil._psutil_bsd - imported by psutil (top-level), psutil._psbsd (top-level)
+missing module named psutil._psutil_linux - imported by psutil (top-level), psutil._pslinux (top-level)
+missing module named psutil._psutil_osx - imported by psutil (conditional), psutil._psposix (conditional), psutil._psosx (top-level)
+missing module named fcntl - imported by subprocess (optional), getmac.getmac (delayed), psutil._compat (delayed, optional)
+missing module named dummy_threading - imported by requests.cookies (optional), psutil._compat (optional)
+missing module named _curses - imported by curses (top-level), curses.has_key (top-level)
+missing module named simplejson - imported by requests.compat (conditional, optional)
+missing module named StringIO - imported by urllib3.packages.six (conditional)
+runtime module named urllib3.packages.six.moves - imported by http.client (top-level), urllib3.util.response (top-level), urllib3.connectionpool (top-level), 'urllib3.packages.six.moves.urllib' (top-level), urllib3.util.queue (top-level)
+missing module named brotli - imported by urllib3.util.request (optional), urllib3.response (optional)
+missing module named brotlicffi - imported by urllib3.util.request (optional), urllib3.response (optional)
+missing module named Queue - imported by urllib3.util.queue (conditional)
+missing module named "'urllib3.packages.six.moves.urllib'.parse" - imported by urllib3.request (top-level), urllib3.poolmanager (top-level)
+missing module named socks - imported by paho.mqtt.client (optional), urllib3.contrib.socks (optional)
+missing module named 'typing.io' - imported by importlib.resources (top-level)
+missing module named cryptography - imported by urllib3.contrib.pyopenssl (top-level), requests (conditional, optional)
+missing module named 'OpenSSL.crypto' - imported by urllib3.contrib.pyopenssl (delayed)
+missing module named 'cryptography.x509' - imported by urllib3.contrib.pyopenssl (delayed, optional)
+missing module named 'cryptography.hazmat' - imported by urllib3.contrib.pyopenssl (top-level)
+missing module named 'OpenSSL.SSL' - imported by urllib3.contrib.pyopenssl (top-level)
+missing module named OpenSSL - imported by urllib3.contrib.pyopenssl (top-level)
+missing module named chardet - imported by requests.compat (optional), requests (optional), requests.packages (optional)
+missing module named unicodedata2 - imported by charset_normalizer.utils (optional)
+missing module named urllib3_secure_extra - imported by urllib3 (optional)
+missing module named vms_lib - imported by platform (delayed, optional)
+missing module named java - imported by platform (delayed)
+missing module named _winreg - imported by platform (delayed, optional)
+missing module named dns - imported by paho.mqtt.client (optional)
+missing module named urlparse - imported by paho.mqtt.client (optional)
+missing module named asyncio.DefaultEventLoopPolicy - imported by asyncio (delayed, conditional), asyncio.events (delayed, conditional)
diff --git a/build/mqtt_srv/xref-mqtt_srv.html b/build/mqtt_srv/xref-mqtt_srv.html
new file mode 100644
index 0000000..a53b1a5
--- /dev/null
+++ b/build/mqtt_srv/xref-mqtt_srv.html
@@ -0,0 +1,13794 @@
+
+
+
+
+ modulegraph cross reference for mqtt_srv.pyw, pyi_rth_inspect.py, pyi_rth_multiprocessing.py, pyi_rth_pkgutil.py, pyi_rth_subprocess.py
+
+
+
+ modulegraph cross reference for mqtt_srv.pyw, pyi_rth_inspect.py, pyi_rth_multiprocessing.py, pyi_rth_pkgutil.py, pyi_rth_subprocess.py
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Queue
+
MissingModule
+
+
+
+
+
+
+
+
+
+
_abc (builtin module)
+
+
+
+
+
+
_ast (builtin module)
+
+
+
+
+
+
_asyncio C:\Program Files\Python310\DLLs\_asyncio.pyd
+
+
+
+
+
+
_bisect (builtin module)
+
+
+
+
+
+
_blake2 (builtin module)
+
+
+
+
+
+
_bz2 C:\Program Files\Python310\DLLs\_bz2.pyd
+
+
+
+
+
+
_codecs (builtin module)
+
+
+
+
+
+
_codecs_cn (builtin module)
+
+
+
+
+
+
_codecs_hk (builtin module)
+
+
+
+
+
+
_codecs_iso2022 (builtin module)
+
+
+
+
+
+
_codecs_jp (builtin module)
+
+
+
+
+
+
_codecs_kr (builtin module)
+
+
+
+
+
+
_codecs_tw (builtin module)
+
+
+
+
+
+
_collections (builtin module)
+
+
+
+
+
+
+
+
+
+
+
+
_contextvars (builtin module)
+
+
+
+
+
+
_csv (builtin module)
+
+
+
+
+
+
_ctypes C:\Program Files\Python310\DLLs\_ctypes.pyd
+
+
+
+
+
+
+
+
_datetime (builtin module)
+
+
+
+
+
+
+
_decimal C:\Program Files\Python310\DLLs\_decimal.pyd
+
+
+
+
+
+
_elementtree C:\Program Files\Python310\DLLs\_elementtree.pyd
+
+
+
+
+
+
+
+
+
+
+
_functools (builtin module)
+
+
+
+
+
+
_hashlib C:\Program Files\Python310\DLLs\_hashlib.pyd
+
+
+
+
+
+
_heapq (builtin module)
+imported by:
+
heapq
+
+
+
+
+
+
+
+
_imp (builtin module)
+
+
+
+
+
+
_io (builtin module)
+
+
+
+
+
+
_json (builtin module)
+
+
+
+
+
+
+
_locale (builtin module)
+
+
+
+
+
+
_lzma C:\Program Files\Python310\DLLs\_lzma.pyd
+
+
+
+
+
+
_md5 (builtin module)
+
+
+
+
+
+
_multibytecodec (builtin module)
+
+
+
+
+
+
_multiprocessing C:\Program Files\Python310\DLLs\_multiprocessing.pyd
+
+
+
+
+
+
_opcode (builtin module)
+
+
+
+
+
+
_operator (builtin module)
+
+
+
+
+
+
_overlapped C:\Program Files\Python310\DLLs\_overlapped.pyd
+
+
+
+
+
+
_pickle (builtin module)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
_queue C:\Program Files\Python310\DLLs\_queue.pyd
+imported by:
+
queue
+
+
+
+
+
+
+
+
_random (builtin module)
+
+
+
+
+
+
+
+
_sha1 (builtin module)
+
+
+
+
+
+
_sha256 (builtin module)
+
+
+
+
+
+
_sha3 (builtin module)
+
+
+
+
+
+
_sha512 (builtin module)
+
+
+
+
+
+
_signal (builtin module)
+
+
+
+
+
+
_socket C:\Program Files\Python310\DLLs\_socket.pyd
+
+
+
+
+
+
_sre (builtin module)
+
+
+
+
+
+
+
_ssl C:\Program Files\Python310\DLLs\_ssl.pyd
+
+
+
+
+
+
+
_stat (builtin module)
+
+
+
+
+
+
_statistics (builtin module)
+
+
+
+
+
+
_string (builtin module)
+
+
+
+
+
+
+
+
_struct (builtin module)
+
+
+
+
+
+
_thread (builtin module)
+
+
+
+
+
+
+
+
_tracemalloc (builtin module)
+
+
+
+
+
+
_uuid C:\Program Files\Python310\DLLs\_uuid.pyd
+
+
+
+
+
+
_warnings (builtin module)
+
+
+
+
+
+
_weakref (builtin module)
+
+
+
+
+
+
+
+
_winapi (builtin module)
+
+
+
+
+
+
+
+
abc
+
SourceModule
+
+
+
+
+
+
+
+
+
array (builtin module)
+
+
+
+
+
+
ast
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
atexit (builtin module)
+
+
+
+
+
+
+
+
base64
+
SourceModule
+
+
+
+
+
+
+
binascii (builtin module)
+
+
+
+
+
+
bisect
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
builtins (builtin module)
+
+
+
+
+
+
bz2
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
codecs
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
copy
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
csv
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
dis
+
SourceModule
+
+
+
+
+
+
+
dns
+
MissingModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
enum
+
SourceModule
+
+
+
+
+
+
+
errno (builtin module)
+
+
+
+
+
+
fcntl
+
MissingModule
+
+
+
+
+
+
+
+
+
+
ftplib
+
SourceModule
+
+
+
+
+
+
+
+
+
gc (builtin module)
+
+
+
+
+
+
+
+
+
+
+
+
+
getopt
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
glob
+
SourceModule
+
+
+
+
+
+
+
grp
+
MissingModule
+
+
+
+
+
+
gzip
+
SourceModule
+
+
+
+
+
+
+
+
+
heapq
+
SourceModule
+
+
+
+
+
+
+
hmac
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
io
+
SourceModule
+
+
+
+
+
+
+
+
+
itertools (builtin module)
+
+
+
+
+
+
java
+
MissingModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
locale
+
SourceModule
+
+
+
+
+
+
+
+
+
lzma
+
SourceModule
+
+
+
+
+
+
+
marshal (builtin module)
+
+
+
+
+
+
math (builtin module)
+
+
+
+
+
+
+
+
mmap (builtin module)
+
+
+
+
+
+
msvcrt (builtin module)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
netrc
+
SourceModule
+
+
+
+
+
+
+
nt (builtin module)
+
+
+
+
+
+
ntpath
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
opcode
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
org
+
MissingModule
+
+
+
+
+
+
os
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
pickle
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
posix
+
MissingModule
+
+
+
+
+
+
+
+
+
pprint
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
psutil._psutil_windows C:\Program Files\Python310\lib\site-packages\psutil\_psutil_windows.pyd
+
+
+
+
+
+
+
+
+
pwd
+
MissingModule
+
+
+
+
+
+
+
+
pyexpat C:\Program Files\Python310\DLLs\pyexpat.pyd
+
+
+
+
+
+
+
+
queue
+
SourceModule
+
+
+
+
+
+
+
queue
+
AliasNode
+
+
+
+
+
+
+
quopri
+
SourceModule
+
+
+
+
+
+
+
random
+
SourceModule
+
+
+
+
+
+
+
re
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
runpy
+
SourceModule
+
+
+
+
+
+
+
+
+
select C:\Program Files\Python310\DLLs\select.pyd
+
+
+
+
+
+
+
+
shlex
+
SourceModule
+
+
+
+
+
+
+
shutil
+
SourceModule
+
+
+
+
+
+
+
signal
+
SourceModule
+
+
+
+
+
+
+
+
+
socket
+
SourceModule
+
+
+
+
+
+
+
socks
+
MissingModule
+
+
+
+
+
+
+
+
+
+
+
+
ssl
+
SourceModule
+
+
+
+
+
+
+
stat
+
SourceModule
+
+
+
+
+
+
+
+
+
string
+
SourceModule
+
+
+
+
+
+
+
+
+
struct
+
SourceModule
+
+
+
+
+
+
+
+
+
sys (builtin module)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
time (builtin module)
+
+
+
+
+
+
+
token
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
types
+
SourceModule
+
+
+
+
+
+
+
typing
+
SourceModule
+
+
+
+
+
+
+
unicodedata C:\Program Files\Python310\DLLs\unicodedata.pyd
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
uu
+
SourceModule
+
+
+
+
+
+
+
uuid
+
SourceModule
+
+
+
+
+
+
+
+
+
+
+
+
+
winreg (builtin module)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
zlib (builtin module)
+
+
+
+
+
diff --git a/builder.py b/builder.py
new file mode 100644
index 0000000..22b7978
--- /dev/null
+++ b/builder.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+import getopt
+import sys
+import platform
+import subprocess
+import os
+
+curos = platform.system()
+pth = os.path.abspath(__file__)
+wd = os.path.dirname(pth)
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "h:", ["command=", "help", "output="])
+except getopt.GetoptError as err:
+ # print help information and exit:
+ print(str(err)) # will print something like "option -a not recognized"
+ #usage()
+ sys.exit(2)
+output = None
+# QJ : getopts
+
+for o, a in opts:
+ if o == "-h":
+ _ACTION = True
+ elif o in ("-m", "--publish"):
+ _MESSAGE = a
+ else:
+ _WIZZARD = True
+
+print(wd)
+
+if curos == "Windows":
+ cmnd = ["scp.exe mqtt_srv.py root@192.168.77.1:/root/", "copy mqtt_srv.py mqtt_srv.pyw", "python.exe -m PyInstaller --onefile mqtt_srv.pyw --distpath .\dist", "Rmdir /Q /S .\\__pycache__", "Rmdir /Q /S .\\build"]
+ #out = subprocess.Popen(cmnd.split())
+else:
+ cmnd = ["cp mqtt_srv.py mqtt_srv.pyw", "python -m pyinstaller --onefile mqtt_srv.pyw --distpath ./dist", "rm -rf ./__pycache__", "rm -rf ./build"]
+
+for c in cmnd:
+ status, output = subprocess.getstatusoutput(c)
+ print(output)
+
+
+if curos == "Windows":
+ cmnd = ["copy .\\dist\\mqtt_srv.exe ..\\MyApp\\source\\"]
+
+for c in cmnd:
+ status, output = subprocess.getstatusoutput(c)
+ print(output)
+
+
+
+
diff --git a/cue.py b/cue.py
new file mode 100644
index 0000000..15fb467
--- /dev/null
+++ b/cue.py
@@ -0,0 +1,65 @@
+from cuesdk import CueSdk
+import time
+import subprocess
+global sdk
+sdk = CueSdk()
+sdk.connect()
+
+global activity_flag
+global control_flag
+global keyboard_index
+print(sdk.protocol_details)
+keyboard_index = 0
+print(sdk.get_devices())
+print(CueSdk().get_device_count())
+def get_available_leds():
+ """
+ Output: list of leds available to control
+ Taken from a code sample of Cuesdk
+ """
+ leds = list()
+ device_count = sdk.get_device_count()
+ for device_index in range(device_count):
+ led_positions = sdk.get_led_positions_by_device_index(device_index)
+ leds.append(led_positions)
+ return leds
+
+def turn_off_leds(all_leds):
+ """
+ Input: list of leds
+ Applies zero RGB values to all the leds available so the keyboard lights will shut off
+ """
+
+ print("turn off")
+ cmnd = "powershell (New-Object -ComObject WScript.Shell).SendKeys('{NUMLOCK}')"
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(status)
+ print(output)
+ for led in all_leds[keyboard_index]:
+ print(led)
+ all_leds[keyboard_index][led] = (0, 0, 0)
+ sdk.set_led_colors_buffer_by_device_index(keyboard_index, all_leds[keyboard_index])
+ sdk.set_led_colors_flush_buffer()
+ print("sleep1")
+ time.sleep(2)
+
+
+ while True:
+ time.sleep(4)
+
+for i in sdk.get_devices():
+ print(str(i.type))
+ if str(i.type) == 'CorsairDeviceType.Keyboard':
+ break
+ else:
+ keyboard_index += 1
+print(keyboard_index)
+colors = get_available_leds()
+print(str(sdk.get_devices()[keyboard_index].type))
+print("\nModel: " + str(sdk.get_devices()[keyboard_index]) + "\n")
+print("keyboard_index :" + str(keyboard_index))
+print("keyboard lights will shutdown after: " + str(60 / 60) + " minutes")
+print("Checking idle")
+
+print(colors)
+turn_off_leds(colors)
\ No newline at end of file
diff --git a/cue_con.py b/cue_con.py
new file mode 100644
index 0000000..026c3ab
--- /dev/null
+++ b/cue_con.py
@@ -0,0 +1,2 @@
+from cue_sdk import *
+
\ No newline at end of file
diff --git a/dist/mqtt_srv b/dist/mqtt_srv
new file mode 100644
index 0000000..69d28d4
Binary files /dev/null and b/dist/mqtt_srv differ
diff --git a/dist/mqtt_srv.exe b/dist/mqtt_srv.exe
new file mode 100644
index 0000000..76a1f0c
Binary files /dev/null and b/dist/mqtt_srv.exe differ
diff --git a/dist/scan_tasmotas b/dist/scan_tasmotas
new file mode 100644
index 0000000..31b11dc
Binary files /dev/null and b/dist/scan_tasmotas differ
diff --git a/gg.py b/gg.py
new file mode 100644
index 0000000..1aa3d7e
--- /dev/null
+++ b/gg.py
@@ -0,0 +1,192 @@
+import requests
+import time
+
+DOMAIN = "ptz_camera"
+
+ATTR_HOST = "host"
+ATTR_PROFILE = "profile"
+DEFAULT_HOST = "192.168.77.237"
+DEFAULT_PROFILE = "Profile_1"
+ATTR_PAN_TIME = "pan_time"
+DEFAULT_PANT_TIME = 0.1
+ATTR_MOVE_TIME = "move_time"
+DEFAULT_MOVE_TIME = 0.05
+DEFAULT_HEADERS = {'Content-Type':'application/soap+xml;charset=UTF8'}
+
+def setup(hass, config):
+
+ def stop(call):
+ host = call.data.get(ATTR_HOST, DEFAULT_HOST)
+ print(host)
+ profile = call.data.get(ATTR_PROFILE, DEFAULT_PROFILE)
+
+ xml = """
+
+
+
+ Profile_1
+ true
+ true
+
+
+ """
+
+ r = requests.post('http://'+host+'/onvif/PTZ', data=xml, headers=DEFAULT_HEADERS)
+
+ def move_left(call):
+ host = call.data.get(ATTR_HOST, DEFAULT_HOST)
+ profile = call.data.get(ATTR_PROFILE, DEFAULT_PROFILE)
+ move_time = call.data.get(ATTR_MOVE_TIME, DEFAULT_MOVE_TIME)
+
+ xml = """
+
+
+
+ Profile_1
+
+
+
+
+
+
+ """
+
+ r = requests.post('http://'+host+'/onvif/PTZ', data=xml, headers=DEFAULT_HEADERS)
+ time.sleep(move_time)
+ stop(call)
+
+ def move_right(call):
+ host = call.data.get(ATTR_HOST, DEFAULT_HOST)
+ profile = call.data.get(ATTR_PROFILE, DEFAULT_PROFILE)
+ move_time = call.data.get(ATTR_MOVE_TIME, DEFAULT_MOVE_TIME)
+
+ xml = """
+
+
+
+ Profile_1
+
+
+
+
+
+
+ """
+
+ r = requests.post('http://'+host+'/onvif/PTZ', data=xml, headers=DEFAULT_HEADERS)
+ time.sleep(move_time)
+ stop(call)
+
+ def move_up(call):
+ host = call.data.get(ATTR_HOST, DEFAULT_HOST)
+ profile = call.data.get(ATTR_PROFILE, DEFAULT_PROFILE)
+ move_time = call.data.get(ATTR_MOVE_TIME, DEFAULT_MOVE_TIME)
+
+ xml = """
+
+
+
+ Profile_1
+
+
+
+
+
+
+ """
+
+ r = requests.post('http://'+host+'/onvif/PTZ', data=xml, headers=DEFAULT_HEADERS)
+ time.sleep(move_time)
+ stop(call)
+
+ def move_down(call):
+ host = call.data.get(ATTR_HOST, DEFAULT_HOST)
+ profile = call.data.get(ATTR_PROFILE, DEFAULT_PROFILE)
+ move_time = call.data.get(ATTR_MOVE_TIME, DEFAULT_MOVE_TIME)
+
+ xml = """
+
+
+
+ Profile_1
+
+
+
+
+
+
+ """
+
+ r = requests.post('http://'+host+'/onvif/PTZ', data=xml, headers=DEFAULT_HEADERS)
+ time.sleep(move_time)
+ stop(call)
+
+ def move_origin_pan(call):
+ host = call.data.get(ATTR_HOST, DEFAULT_HOST)
+ profile = call.data.get(ATTR_PROFILE, DEFAULT_PROFILE)
+
+ xml = """
+
+
+
+ Profile_1
+
+
+
+
+
+
+ """
+
+ r = requests.post('http://'+host+'/onvif/PTZ', data=xml, headers=DEFAULT_HEADERS)
+
+ def move_origin_tilt(call):
+ host = call.data.get(ATTR_HOST, DEFAULT_HOST)
+ profile = call.data.get(ATTR_PROFILE, DEFAULT_PROFILE)
+
+ xml = """
+
+
+
+ Profile_1
+
+
+
+
+
+
+ """
+
+ r = requests.post('http://'+host+'/onvif/PTZ', data=xml, headers=DEFAULT_HEADERS)
+
+ def move_origin(call):
+ pan_time = call.data.get(ATTR_PAN_TIME, DEFAULT_PANT_TIME)
+ move_origin_pan(call)
+ time.sleep(pan_time)
+ move_origin_tilt(call)
+
+
+ hass.services.register(DOMAIN, "move_left", move_left)
+ hass.services.register(DOMAIN, "move_right", move_right)
+ hass.services.register(DOMAIN, "move_up", move_up)
+ hass.services.register(DOMAIN, "move_down", move_down)
+ hass.services.register(DOMAIN, "stop", stop)
+ hass.services.register(DOMAIN, "move_origin", move_origin)
+ hass.services.register(DOMAIN, "move_origin_pan", move_origin_pan)
+ hass.services.register(DOMAIN, "move_origin_tilt", move_origin_tilt)
+
+ # Return boolean to indicate that initialization was successfully.
+ return True
diff --git a/ha.py b/ha.py
new file mode 100644
index 0000000..e73016b
--- /dev/null
+++ b/ha.py
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+import subprocess
+import getopt
+import sys
+import time
+import requests
+import re
+__IP = '192.168.77.106'
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "d:p:", ["destination=", "publish", "output="])
+except getopt.GetoptError as err:
+ # print help information and exit:
+ print(str(err)) # will print something like "option -a not recognized"
+ #usage()
+ sys.exit(2)
+output = None
+# QJ : getopts
+
+for o, a in opts:
+ if o in ("-d", "--destination"):
+ __IP = a
+ elif o in ("-p", "--publish"):
+ _PUBLISH = True
+ else:
+ _WIZZARD = True
+
+
+__RULES = ["EMAIL993", "EMAIL25", "EMAIL143", "EMAIL995", "EMAIL465", "HTTPS", "HTTP"]
+
+for i in __RULES:
+ print(i)
+ status, output = subprocess.getstatusoutput("uci set firewall." + i + ".dest_ip='" + __IP + "'")
+status, output = subprocess.getstatusoutput("uci commit")
+
+
+for i in __RULES:
+ status, output = subprocess.getstatusoutput("uci get firewall." + i + ".dest_ip")
+ #print(output)
+time.sleep(3)
+status, output = subprocess.getstatusoutput("/etc/init.d/firewall restart")
+
+if __IP == "192.168.77.246":
+ act = "start"
+ print("Starting containers on Raspbian!")
+else:
+ act = "stop"
+ print("Stopping containers on Raspbian!")
+
+status, output = subprocess.getstatusoutput("docker -H ssh://root@192.168.77.246 " + act + " mosquitto_mosquitto_1 HomeAssistant mailu_resolver_1 mailu_redis_1 mailu_smtp_1 mailu_imap_1 mailu_antispam_1 mailu_webmail_1 mailu_admin_1 mailu_front_1 nextcloud_db_1 nextcloud_app_1 webhub_client_1 nginx-proxy-manager_db_1 nginx-proxy-manager_app_1 ")
+
+MQTT_BROKER = __IP
+MQTT_USER = "jaydee"
+MQTT_PASS = "jaydee1"
+
+cmnd = "nmap -sP 192.168.77.*|grep \"Nmap scan report\"|egrep -o \"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\""
+#print(cmnd)
+status, output = subprocess.getstatusoutput(cmnd)
+
+print(output)
+
+ips = output.splitlines()
+tasm_data = {}
+for sys_ip in ips:
+ if not re.match('([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})', sys_ip):
+ print("wrong ip : " + str(sys_ip))
+ continue
+ print("This is ip : " + sys_ip)
+
+ cmnd = "nmap " + sys_ip + " -p80|grep \"80/tcp open http\""
+ status, output = subprocess.getstatusoutput(cmnd)
+ # print("status of 80 : " + str(status))
+ if status == 0:
+ try:
+ # url = "http://" + sys_ip + "/cm?user=admin&password=l4c1j4yd33Du5l0&cmnd=STATUS+5"
+
+ url = "http://" + sys_ip + "/cm?cmnd=Backlog%20MqttHost%20" + MQTT_BROKER + "%3BMqttUser%20" + MQTT_USER + "%3BMqttPassword%20" + MQTT_PASS
+ print(url)
+ requests.get(url)
+
+ except:
+ #print(sys_ip + " : Not a tasmota!")
+ pass
+ else:
+ #print(sys_ip + " : Not a listening")
+ pass
diff --git a/handle_backups.py b/handle_backups.py
new file mode 100644
index 0000000..dd06c30
--- /dev/null
+++ b/handle_backups.py
@@ -0,0 +1,184 @@
+import requests
+import untangle
+import socket
+import sys
+import time
+import random
+import json
+import getopt
+from urllib3.exceptions import InsecureRequestWarning
+from urllib3 import disable_warnings
+disable_warnings(InsecureRequestWarning)
+from paho.mqtt import client as mqtt_client
+import datetime
+
+jobId = "0ceadf5e-0b9e-11ed-9806-9a2cbecf0a5f"
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "cT:", ["command=", "help", "output="])
+except getopt.GetoptError as err:
+ # print help information and exit:
+ print(str(err)) # will print something like "option -a not recognized"
+ #usage()
+ sys.exit(2)
+output = None
+# QJ : getopts
+_ACTION = "default"
+for o, a in opts:
+ if o == "-c":
+ _ACTION = "check"
+ elif o in ("-p", "--publish"):
+ _PUBLISH = True
+ elif o in ("-m", "--publish"):
+ _MESSAGE = a
+ elif o in ("-t", "--publish"):
+ _TOPIC = a
+ elif o in ("-S", "--setvar"):
+ _SETVAR = True
+ _THR_NAME = sys.argv[2]
+ _THR_VAL = sys.argv[3]
+ elif o in ("-T", "--task"):
+ if a == "task1":
+ jobId = "0ceadf5e-0b9e-11ed-9806-9a2cbecf0a5f"
+ elif a == "task2":
+ jobId = "1bba7e36-6ea9-11ed-91cb-d63dc5df381e"
+ else:
+ _WIZZARD = True
+nasIp = "192.168.77.106"
+nasPort = "4443"
+user = "jaydee"
+password = "l4c1j4yd33Du5lo"
+
+def get_sid():
+ headers = {"Content-type": "application/x-www-form-urlencoded"}
+ params = {
+ "user": "jaydee",
+ "serviceKey": 1,
+ "pwd": "bDRjMWo0eWQzM0R1NWxv"
+ }
+ url = "https://{}:{}/cgi-bin/authLogin.cgi".format(nasIp, nasPort)
+
+ response = requests.get(url, headers=headers, params=params, verify=False)
+
+ #print("Status Code", response.status_code)
+ #print("JSON Response ", response.text)
+ obj = untangle.parse(response.text)
+ sid = (obj.QDocRoot.authSid.cdata)
+ return sid
+
+def check_status():
+ sid = get_sid()
+ headers = {"X-QNAP-SID": sid}
+ params = {}
+
+ url = "https://{}:{}/cc3/v1/users/system/jobs".format(nasIp, nasPort)
+ response = requests.get(url, headers=headers, params=params, verify=False)
+
+
+
+ # print("JSON Response ", response.text)
+ data = json.loads(response.text)
+ wait_for_done = True
+ while wait_for_done:
+ for i in data["jobs"]:
+
+ #print(i["_id"])
+ #print(data["jobs"][i]["_id"])
+ if i["_id"] == jobId:
+ # print(i)
+ print(i["statistics"]["progress"])
+ time.sleep(3)
+
+
+ '''
+ auth=$(curl --insecure "https://$nasIp/cgi-bin/authLogin.cgi" -H "Content-type: application/x-www-form-urlencoded" --data-urlencode "user=$user" --data-urlencode "serviceKey=1" --data-urlencode "pwd=$(echo -n $password | base64)" --silent)
+ echo $auth
+ sidXML=$(echo "$auth" | grep -Eo "(.+?)")
+ sidStrip="${sidXML/<\/authSid>/}"
+ curl "https://$nasIp/cc3/v1/users/system/jobs/$1?command=start" -H "X-QNAP-SID: $sid" --data-raw '{}' --silent --insecure
+ curl 'https://192.168.77.106:4443/cc3/v1/users/system/jobs' -H 'X-QNAP-SID: r299e6x3' --silent --insecure
+ '''
+
+
+
+if _ACTION == "default":
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ service_online = False
+ broker = '192.168.77.106'
+ port = 1883
+ topic = "sectorq/systems/hbs"
+ mqtt_username = 'jaydee'
+ mqtt_password = 'jaydee1'
+
+ while not service_online:
+ result = sock.connect_ex(('192.168.77.189',873))
+ if result == 0:
+ print("Port is open")
+ service_online = True
+ else:
+ print("Port is not open")
+ time.sleep(5)
+ sock.close()
+
+ sid = get_sid()
+
+ #print("-----------------")
+ #print(sid)
+ #print("-----------------")
+
+ headers = {"X-QNAP-SID": sid}
+ params = {}
+
+ url = "https://{}:{}/cc3/v1/users/system/jobs/{}?command=start".format(nasIp, nasPort, jobId)
+ #print(url)
+ response = requests.post(url, headers=headers, params=params, verify=False)
+
+
+ #print("Status Code", response.status_code)
+ #print("JSON Response ", response.text)
+ client = mqtt_client.Client()
+ client.username_pw_set(mqtt_username, mqtt_password)
+ client.connect(broker,1883,60)
+ msg = {"status":"initializing","start_time":"now","progress":0}
+ client.publish(topic, json.dumps(msg));
+ client.disconnect();
+
+ wait_for_done = True
+ task1_done = False
+ task2_done = False
+ url = "https://{}:{}/cc3/v1/users/system/jobs".format(nasIp, nasPort)
+ client = mqtt_client.Client()
+ client.username_pw_set(mqtt_username, mqtt_password)
+ client.connect(broker,1883,60)
+
+ while wait_for_done:
+ response = requests.get(url, headers=headers, params=params, verify=False)
+ print("Status Code", response.status_code)
+ #print("JSON Response ", response.text)
+ data = json.loads(response.text)
+ # print(data["jobs"])
+ for i in data["jobs"]:
+ time.sleep(3)
+ #print(i["_id"])
+ #print(data["jobs"][i]["_id"])
+ #if i["_id"] == jobId:
+ # print(i)
+ # print(i["statistics"])
+
+ try:
+ msg = {"status":i["statistics"]["status"],"name":i["name"],"start_time":i["statistics"]["start_time"],"stop_time":i["statistics"]["stop_time"],"elapsed_time":str(datetime.timedelta(seconds=round(i["statistics"]["elapse_time"],0))),"progress":i["statistics"]["progress"]}
+
+ except:
+ msg = {"status":i["statistics"]["status"],"name":i["name"],"start_time": i["statistics"]["start_time"]}
+ client.publish(topic, json.dumps(msg));
+ if i["statistics"]["status"] == "Finished":
+ wait_for_done = False
+
+ client.disconnect();
+ #curl "https://$nasIp/cc3/v1/users/system/jobs/$1?command=start" -H "X-QNAP-SID: $sid" --data-raw '{}' --silent --insecure
+
+
+
+
+if _ACTION == "check":
+ check_status()
\ No newline at end of file
diff --git a/handle_backups.py.bak b/handle_backups.py.bak
new file mode 100644
index 0000000..9ac5d5c
--- /dev/null
+++ b/handle_backups.py.bak
@@ -0,0 +1,184 @@
+import requests
+import untangle
+import socket
+import sys
+import time
+import random
+import json
+import getopt
+from urllib3.exceptions import InsecureRequestWarning
+from urllib3 import disable_warnings
+disable_warnings(InsecureRequestWarning)
+from paho.mqtt import client as mqtt_client
+import datetime
+
+jobId = "0ceadf5e-0b9e-11ed-9806-9a2cbecf0a5f"
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "cT:", ["command=", "help", "output="])
+except getopt.GetoptError as err:
+ # print help information and exit:
+ print(str(err)) # will print something like "option -a not recognized"
+ #usage()
+ sys.exit(2)
+output = None
+# QJ : getopts
+_ACTION = "default"
+for o, a in opts:
+ if o == "-c":
+ _ACTION = "check"
+ elif o in ("-p", "--publish"):
+ _PUBLISH = True
+ elif o in ("-m", "--publish"):
+ _MESSAGE = a
+ elif o in ("-t", "--publish"):
+ _TOPIC = a
+ elif o in ("-S", "--setvar"):
+ _SETVAR = True
+ _THR_NAME = sys.argv[2]
+ _THR_VAL = sys.argv[3]
+ elif o in ("-T", "--task"):
+ if a == "task1":
+ jobId = "0ceadf5e-0b9e-11ed-9806-9a2cbecf0a5f"
+ elif a == "task2":
+ jobId = "1bba7e36-6ea9-11ed-91cb-d63dc5df381e"
+ else:
+ _WIZZARD = True
+nasIp = "192.168.77.106"
+nasPort = "4443"
+user = "jaydee"
+password = "l4c1j4yd33Du5lo"
+
+def get_sid():
+ headers = {"Content-type": "application/x-www-form-urlencoded"}
+ params = {
+ "user": "jaydee",
+ "serviceKey": 1,
+ "pwd": "bDRjMWo0eWQzM0R1NWxv"
+ }
+ url = "https://{}:{}/cgi-bin/authLogin.cgi".format(nasIp, nasPort)
+
+ response = requests.get(url, headers=headers, params=params, verify=False)
+
+ #print("Status Code", response.status_code)
+ #print("JSON Response ", response.text)
+ obj = untangle.parse(response.text)
+ sid = (obj.QDocRoot.authSid.cdata)
+ return sid
+
+def check_status():
+ sid = get_sid()
+ headers = {"X-QNAP-SID": sid}
+ params = {}
+
+ url = "https://{}:{}/cc3/v1/users/system/jobs".format(nasIp, nasPort)
+ response = requests.get(url, headers=headers, params=params, verify=False)
+
+
+
+ # print("JSON Response ", response.text)
+ data = json.loads(response.text)
+ wait_for_done = True
+ while wait_for_done:
+ for i in data["jobs"]:
+
+ #print(i["_id"])
+ #print(data["jobs"][i]["_id"])
+ if i["_id"] == jobId:
+ # print(i)
+ print(i["statistics"]["progress"])
+ time.sleep(3)
+
+
+ '''
+ auth=$(curl --insecure "https://$nasIp/cgi-bin/authLogin.cgi" -H "Content-type: application/x-www-form-urlencoded" --data-urlencode "user=$user" --data-urlencode "serviceKey=1" --data-urlencode "pwd=$(echo -n $password | base64)" --silent)
+ echo $auth
+ sidXML=$(echo "$auth" | grep -Eo "(.+?)")
+ sidStrip="${sidXML/<\/authSid>/}"
+ curl "https://$nasIp/cc3/v1/users/system/jobs/$1?command=start" -H "X-QNAP-SID: $sid" --data-raw '{}' --silent --insecure
+ curl 'https://192.168.77.106:4443/cc3/v1/users/system/jobs' -H 'X-QNAP-SID: r299e6x3' --silent --insecure
+ '''
+
+
+
+if _ACTION == "default":
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ service_online = False
+ broker = '192.168.77.106'
+ port = 1883
+ topic = "sectorq/systems/hbs"
+ mqtt_username = 'jaydee'
+ mqtt_password = 'jaydee1'
+
+ while not service_online:
+ result = sock.connect_ex(('192.168.77.189',873))
+ if result == 0:
+ print("Port is open")
+ service_online = True
+ else:
+ print("Port is not open")
+ time.sleep(5)
+ sock.close()
+
+ sid = get_sid()
+
+ #print("-----------------")
+ #print(sid)
+ #print("-----------------")
+
+ headers = {"X-QNAP-SID": sid}
+ params = {}
+
+ url = "https://{}:{}/cc3/v1/users/system/jobs/{}?command=start".format(nasIp, nasPort, jobId)
+ #print(url)
+ response = requests.post(url, headers=headers, params=params, verify=False)
+
+
+ #print("Status Code", response.status_code)
+ #print("JSON Response ", response.text)
+ client = mqtt_client.Client()
+ client.username_pw_set(mqtt_username, mqtt_password)
+ client.connect(broker,1883,60)
+ msg = {"status":"initializing","start_time":"now","progress":0}
+ client.publish(topic, json.dumps(msg));
+ client.disconnect();
+
+ wait_for_done = True
+ task1_done = False
+ task2_done = False
+ url = "https://{}:{}/cc3/v1/users/system/jobs".format(nasIp, nasPort)
+ client = mqtt_client.Client()
+ client.username_pw_set(mqtt_username, mqtt_password)
+ client.connect(broker,1883,60)
+
+ while wait_for_done:
+ response = requests.get(url, headers=headers, params=params, verify=False)
+ print("Status Code", response.status_code)
+ #print("JSON Response ", response.text)
+ data = json.loads(response.text)
+ # print(data["jobs"])
+ for i in data["jobs"]:
+ time.sleep(3)
+ #print(i["_id"])
+ #print(data["jobs"][i]["_id"])
+ if i["_id"] == jobId:
+ # print(i)
+ # print(i["statistics"])
+
+ try:
+ msg = {"status":i["statistics"]["status"],"name":i["name"],"start_time":i["statistics"]["start_time"],"stop_time":i["statistics"]["stop_time"],"elapsed_time":str(datetime.timedelta(seconds=round(i["statistics"]["elapse_time"],0))),"progress":i["statistics"]["progress"]}
+
+ except:
+ msg = {"status":i["statistics"]["status"],"name":i["name"],"start_time": i["statistics"]["start_time"]}
+ client.publish(topic, json.dumps(msg));
+ if i["statistics"]["status"] == "Finished":
+ wait_for_done = False
+
+ client.disconnect();
+ #curl "https://$nasIp/cc3/v1/users/system/jobs/$1?command=start" -H "X-QNAP-SID: $sid" --data-raw '{}' --silent --insecure
+
+
+
+
+if _ACTION == "check":
+ check_status()
\ No newline at end of file
diff --git a/hello_world.py b/hello_world.py
new file mode 100644
index 0000000..3fdf82d
--- /dev/null
+++ b/hello_world.py
@@ -0,0 +1,5 @@
+name = data.get("name", "world")
+logger.info("Hello %s", name)
+logger.error("Hello %s", name)
+logger.warning("Hello %s", name)
+hass.bus.fire(name, {"wow": "from a Python script!"})
\ No newline at end of file
diff --git a/lala b/lala
new file mode 100644
index 0000000..e69de29
diff --git a/mqtt_srv-wrt.py b/mqtt_srv-wrt.py
new file mode 100644
index 0000000..23d6722
--- /dev/null
+++ b/mqtt_srv-wrt.py
@@ -0,0 +1,911 @@
+#!/usr/bin/env python3
+
+from asyncio.log import logger
+import paho.mqtt.client as mqtt
+from getmac import get_mac_address
+import platform
+import socket
+import re
+import subprocess
+import os
+import json
+import sys
+import time
+import json
+import datetime
+import ctypes
+import getopt
+import random
+import requests
+
+stats = {}
+VERSION = "1.0.8"
+curos = platform.system()
+host = platform.node().lower()
+print(host)
+if curos == "Windows":
+ import python_aida64
+
+def writeLog(msg, svr="INFO"):
+ ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ if curos == "Windows":
+ log_path = "c:\Program Files\jaydee\jaydee.log"
+ else:
+ log_path = "/tmp/mqtt_srv.log"
+ f = open(log_path, "a")
+ f.write(ts + " | " + svr + " | " + str(msg) + "\n")
+ f.close()
+
+if host != "router" and host != "nas":
+ import psutil
+
+ processes = list(p.name() for p in psutil.process_iter())
+ # print(processes)
+ count = processes.count("mqtt_srv.exe")
+ if int(count) >= 3:
+ writeLog("script exist")
+ sys.exit()
+else:
+ cmnd = "ps |grep mqtt_srv.py|grep -v grep |wc -l"
+ status, output = subprocess.getstatusoutput(cmnd)
+ count = output
+ if int(count) >= 2:
+ writeLog("script exist")
+ sys.exit()
+# Stops duplicate instance from running
+
+writeLog(count)
+
+writeLog("Starting : " + str(VERSION))
+writeLog("Getting running proccesses", "DEBUG")
+
+
+writeLog("done", "DEBUG")
+
+FILE_TIMESTAMP = os.path.getmtime(sys.argv[0])
+def get_sys_env(name):
+ key = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, r"System\CurrentControlSet\Control\Session Manager\Environment")
+ return winreg.QueryValueEx(key, name)[0]
+
+def get_user_env(name):
+ key = winreg.CreateKey(winreg.HKEY_CURRENT_USER, r"Environment")
+ return winreg.QueryValueEx(key, name)[0]
+
+
+_PUBLISH = _SETVAR = False
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "Sspmt:", ["command=", "help", "output="])
+except getopt.GetoptError as err:
+ # print help information and exit:
+ print(str(err)) # will print something like "option -a not recognized"
+ #usage()
+ sys.exit(2)
+output = None
+# QJ : getopts
+
+for o, a in opts:
+ if o == "-d":
+ _ACTION = True
+ elif o in ("-p", "--publish"):
+ _PUBLISH = True
+ elif o in ("-m", "--publish"):
+ _MESSAGE = a
+ elif o in ("-t", "--publish"):
+ _TOPIC = a
+ elif o in ("-S", "--setvar"):
+ _SETVAR = True
+ _THR_NAME = sys.argv[2]
+ _THR_VAL = sys.argv[3]
+ else:
+ _WIZZARD = True
+MQTT_HOST = "192.168.77.106"
+MQTT_PORT = 1883
+
+if _PUBLISH:
+ # generate client ID with pub prefix randomly
+ #client_id = f'python-mqtt-{random.randint(0, 1000)}'
+ client_id = 'python-mqtt-1004'
+ username = 'jaydee'
+ password = 'jaydee1'
+
+ def connect_mqtt():
+ def on_connect(client, userdata, flags, rc):
+ if rc == 0:
+ print("Connected to MQTT Broker!")
+ else:
+ print("Failed to connect, return code %d\n", rc)
+
+ client = mqtt.Client(client_id)
+ client.username_pw_set(username, password)
+ client.on_connect = on_connect
+ client.connect(MQTT_HOST, MQTT_PORT)
+ return client
+
+
+ def publish(client):
+ result = client.publish(_TOPIC, _MESSAGE)
+ # result: [0, 1]
+ status = result[0]
+ if status == 0:
+ print(f"Send `{_MESSAGE}` to topic `{_TOPIC}`")
+ else:
+ print(f"Failed to send message to topic {_TOPIC}")
+
+ client = connect_mqtt()
+ publish(client)
+ sys.exit()
+
+if _SETVAR:
+ #myCmd = "setx " + _THR_NAME + " " + _THR_VAL + " -m"
+ myCmd = "setx " + _THR_NAME + " " + _THR_VAL
+ subprocess.Popen(myCmd.split(), shell=True)
+ sys.exit()
+
+from ping3 import ping, verbose_ping
+
+
+
+
+'''
+curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
+python get-pip.py
+pip3 install getmac
+pip3 install paho.mqttdasdas
+"""
+
+'''
+
+writeLog("Starting daemon in versin : " + VERSION)
+
+VERS = '1.3'
+'''
+print("pinging")
+lala = ping(MQTT_HOST)
+
+connected = 0
+while connected == 0:
+ if type(lala) == float:
+ print("Oleee connected")
+ writeLog("Mqtt connected", "INFO")
+ connected = 1
+ else:
+ print("blaaah not connected, waiting...(5)")
+ writeLog("blaaah not connected, waiting...(5)")
+ time.sleep(5)
+ lala = ping(MQTT_HOST)
+'''
+
+# Function to display hostname and
+# IP address
+def get_ip():
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ try:
+ # doesn't even have to be reachable
+ s.connect(('192.168.77.1', 1))
+ IP = s.getsockname()[0]
+ except ValueError:
+ IP = '127.0.0.1'
+ finally:
+ s.close()
+ return IP
+
+
+IP = get_ip()
+
+
+print("OS : " + curos)
+writeLog("OS : " + curos)
+if curos != "Windows":
+ import autorandr
+else:
+ import winreg
+
+
+if host == "raspberrypi":
+ mac = str(get_mac_address("eth0"))
+elif host == "SERVER":
+ mac = str(get_mac_address("enp2s0"))
+elif host == "ASUS" and curos != "Windows":
+ mac = str(get_mac_address("enp3s0f1"))
+else:
+ mac = str(get_mac_address("Ethernet"))
+
+
+print("MAC : " + mac)
+writeLog("MAC : " + mac)
+print("SYSTEM : " + host)
+writeLog("SYSTEM : " + host)
+print("IP : " + IP)
+writeLog("IP : " + IP)
+
+flag_connected = 0
+# The callback for when the client receives a CONNACK response from the server.
+def on_connect(client, userdata, flags, rc):
+ print("Connected with result code " + str(rc))
+ writeLog("Connected with result code " + str(rc))
+ global flag_connected
+ flag_connected = 1
+ # Subscribing in on_connect() means that if we lose the connection and
+ # reconnect then subscriptions will be renewed.
+ topic = "sectorq/systems/" + host.lower()
+ print(topic)
+ writeLog(topic)
+ time.sleep(1)
+ client.publish("sectorq/status", payload="{'action':'connect', 'system':'" + host.lower() + "', 'ip': '" + IP + "', 'mac':'" + mac + "', 'ver':'" + VERS + "'}", qos=0, retain=False)
+ client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
+ if host.lower() == "router":
+ print("Getting fw info")
+ cmnd = "/etc/init.d/banip running"
+ status, output = subprocess.getstatusoutput(cmnd)
+ if status == 0:
+ stats["banip"] = "running"
+ else:
+ stats["banip"] = "stopped"
+
+ cmnd = "/root/router_cmd.sh -t firewall -n TOSHIBA-WIFI -m get"
+ #out = subprocess.Popen(cmnd.split())
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ if output == 1:
+ stats["fw"] = 1
+ else:
+ stats["fw"] = 0
+ print("Getting wifi info")
+ cmnd = "/root/router_cmd.sh -t wireless -m get"
+ #out = subprocess.Popen(cmnd.split())
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ if output == "allow":
+ stats["macfilter"] = "allow"
+ else:
+ stats["macfilter"] = "off"
+ client.publish("sectorq/systems/router/stats", json.dumps(stats), qos=0, retain=True)
+ if host.lower() == "nas":
+ print("Getting VM info")
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh list --all"
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ l = 1
+ lines = output.splitlines()
+ VMS = {}
+ for i in lines:
+ l = l + 1
+ if l < 4:
+ continue
+ line = re.split(r" {2,}", i)
+ print(str(line[0].strip()) + " " + str(line[1].strip()) + " " + str(line[2].strip()))
+ VMS[str(line[1].strip())] = str(line[2].strip())
+
+
+
+ for m in VMS:
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + m
+ #out = subprocess.Popen(cmnd.split())
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ if output.strip() == "running":
+ client.publish("sectorq/systems/nas/" + m, payload=1, qos=0, retain=True)
+ else:
+ client.publish("sectorq/systems/nas/" + m, payload=0, qos=0, retain=True)
+
+
+ client.subscribe(topic)
+
+def on_disconnect(client, userdata, rc):
+ print("disconnecting reason " +str(rc))
+ writeLog("disconnecting reason " +str(rc))
+ client.connected_flag=False
+ client.disconnect_flag=True
+ global flag_connected
+ flag_connected = 0
+
+
+# The callback for when a PUBLISH message is received from the server.
+def on_message(client, userdata, msg):
+ print(msg.topic)
+ print(msg.payload)
+ myObj = msg.payload.decode('utf-8')
+ # command = re.sub(r"^b\'|\'$", "", str(msg.payload))
+ # command = json.loads(msg.payload.decode("utf-8"))
+ try:
+ myObj = json.loads(msg.payload)
+ try:
+ writeLog(myObj["action"])
+ print(myObj["action"])
+ except:
+ print("Action not set")
+ writeLog("Action not set", "WARNING")
+
+ try:
+ print(myObj["cmd"])
+ writeLog(myObj["cmd"])
+ except:
+ print("Cmd not set")
+ writeLog("Cmd not set", "WARNING")
+
+ try:
+ print(myObj["target"])
+ writeLog(myObj["target"])
+ except:
+ print("Target Not Set")
+ writeLog("Target Not Set", "WARNING")
+ try:
+ print(myObj["status"])
+ writeLog(myObj["status"])
+ except:
+ print("Status Not Set")
+ writeLog("Status Not Set")
+
+ try:
+ print(myObj["command"])
+ writeLog(myObj["command"])
+ except:
+ print("Command Not Set")
+ writeLog("Command Not Set")
+
+ try:
+ print(myObj["cmd_line"])
+ writeLog(myObj["cmd_line"])
+ except:
+ print("Cmd_line Not Set")
+ writeLog("Cmd_line Not Set")
+
+
+ if myObj["cmd"] == "command":
+
+ print("Executing " + myObj["cmd_line"])
+ writeLog("Executing " + myObj["cmd_line"])
+ #os.system('start /b "' + myObj["cmd_line"] + '"')
+ try:
+ subprocess.Popen(myObj["cmd_line"].split(), shell=True)
+ #subprocess.Popen(myObj["cmd_line"].split())
+ # ctypes.windll.user32.MessageBoxW(0, myObj["cmd_line"], "Executed", 64)
+ except:
+ ctypes.windll.user32.MessageBoxW(0, "Your text", "Your title", 16)
+ print("Executed " + myObj["cmd_line"])
+ writeLog("Executed " + myObj["cmd_line"])
+
+ if myObj["cmd"] == "nas_cmd":
+ print("Executing NAS")
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + str(myObj["target"])
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ cmd_type = myObj["command"]
+ if myObj["command"] == "start":
+ if output.strip() == "paused":
+ print("System suspended")
+ cmd_type = "resume"
+ else:
+ print("System Off")
+ cmd_type = "start"
+ if myObj["command"] == "suspend":
+ cmd_type = "shutdown"
+
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh " + cmd_type + " " + str(myObj["target"])
+ subprocess.Popen(cmnd.split())
+ print(cmnd)
+ if myObj["command"] == "start":
+ try:
+ print("sending")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload=1, qos=0, retain=False)
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload="failed", qos=0, retain=False)
+ else:
+ try:
+ print("sending")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload=0, qos=0, retain=False)
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload="failed", qos=0, retain=False)
+
+
+ if myObj["cmd"] == "distrib":
+ print("distributin313g")
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ subprocess.Popen(['/bin/systemctl', 'restart', 'mqtt'])
+
+ if myObj["cmd"] == "uci":
+ print("uci1")
+ print("Executing " + myObj["cmd_line"])
+ writeLog("Executing " + myObj["cmd_line"])
+
+ if myObj["cmd_line"] == "wireless1":
+ cmnd = "/root/router_cmd.sh -t wireless -v 1 -m set"
+ try:
+ subprocess.Popen(cmnd.split())
+ print("sending")
+ stats["macfilter"] = "allow"
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+
+ elif myObj["cmd_line"] == "wireless0":
+ cmnd = "/root/router_cmd.sh -t wireless -v 0 -m set"
+ try:
+ subprocess.Popen(cmnd.split())
+ print("sending")
+ stats["macfilter"] = "off"
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+ elif myObj["cmd_line"] == "fw0":
+ cmnd = "/root/router_cmd.sh -t firewall -n TOSHIBA-WIFI -p enabled -v 0 -m set"
+ try:
+ subprocess.Popen(cmnd.split())
+ print("sending")
+ stats["fw"] = 0
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+ elif myObj["cmd_line"] == "fw1":
+ cmnd = "/root/router_cmd.sh -t firewall -n TOSHIBA-WIFI -p enabled -v 1 -m set"
+ try:
+ #subprocess.Popen(myObj["cmd_line"].split(), shell=True)
+ subprocess.Popen(cmnd.split())
+ # ctypes.windll.user32.MessageBoxW(0, myObj["cmd_line"], "Executed", 64)
+ print("sending")
+ stats["fw"] = 1
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+ elif myObj["cmd_line"] == "serv_dest":
+ writeLog("Payload111111 : " + myObj["target"].lower())
+
+ if myObj["target"].lower() == "192.168.77.246":
+ dest_ip = "192.168.77.246"
+ elif myObj["target"].lower() == "192.168.77.106":
+ dest_ip = "192.168.77.106"
+
+ RULES = ["EMAIL993", "EMAIL995", "EMAIL143", "EMAIL25", "EMAIL993", "EMAIL465", "HTTPS", "HTTP"]
+ for i in RULES:
+ cmnd = "uci set firewall.{}.dest_ip={}".format(i,dest_ip)
+ writeLog(cmnd)
+ subprocess.Popen(cmnd.split())
+
+ #cmnd = "uci set dhcp.@dnsmasq[0].address=/mqtt_broker/" + dest_ip
+ #writeLog(cmnd)
+ #subprocess.Popen(cmnd.split())
+ time.sleep(1)
+ cmnd = "uci commit"
+
+ subprocess.Popen(cmnd.split())
+
+ writeLog("Starting " + myObj["target"].lower())
+ if myObj["target"].lower() == "192.168.77.246":
+ dest_ip = "192.168.77.246"
+
+
+ cmnd = "ssh root@192.168.77.246 'docker start mailu_resolver_1 mailu_redis_1 mailu_front_1 mailu_antispam_1 mailu_imap_1 mailu_admin_1 mailu_smtp_1 mailu_webmail_1 watchtower_watchtower_1 nginx-proxy-manager_db_1 nginx-proxy-manager_app_1 HomeAssistant webhub_client_1 dockermon_docker_mon_1 mosquitto_mosquitto_1 node-red_node-red_1 nextcloud_db_1 nextcloud_app_1'"
+ status, output = subprocess.getstatusoutput(cmnd)
+ elif myObj["target"].lower() == "192.168.77.106":
+ dest_ip = "192.168.77.106"
+ cmnd = "ssh root@192.168.77.246 'docker stop mailu_resolver_1 mailu_redis_1 mailu_front_1 mailu_antispam_1 mailu_imap_1 mailu_admin_1 mailu_smtp_1 mailu_webmail_1 watchtower_watchtower_1 nginx-proxy-manager_db_1 nginx-proxy-manager_app_1 HomeAssistant webhub_client_1 dockermon_docker_mon_1 mosquitto_mosquitto_1 node-red_node-red_1 nextcloud_db_1 nextcloud_app_1'"
+ status, output = subprocess.getstatusoutput(cmnd)
+ time.sleep(1)
+ cmnd = "/etc/init.d/firewall restart"
+ subprocess.Popen(cmnd.split())
+ #cmnd = "/etc/init.d/dnsmasq restart"
+ #subprocess.Popen(cmnd.split())
+ writeLog("reconfigure iot")
+ MQTT_BROKER = dest_ip
+ MQTT_USER = "jaydee"
+ MQTT_PASS = "jaydee1"
+
+ cmnd = "nmap -sP 192.168.77.*|grep \"Nmap scan report\"|egrep -o \"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\""
+ #print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ # print(output)
+
+ ips = output.splitlines()
+ tasm_data = {}
+ for sys_ip in ips:
+ # print("Thsis is ip : " + sys_ip)
+ cmnd = "nmap " + sys_ip + " -p80|grep \"80/tcp open http\""
+ status, output = subprocess.getstatusoutput(cmnd)
+ # print("status of 80 : " + str(status))
+ if status == 0:
+ try:
+ # url = "http://" + sys_ip + "/cm?user=admin&password=l4c1j4yd33Du5l0&cmnd=STATUS+5"
+
+ url = "http://" + sys_ip + "/cm?cmnd=Backlog%20MqttHost%20" + MQTT_BROKER + "%3BMqttUser%20" + MQTT_USER + "%3BMqttPassword%20" + MQTT_PASS
+ print(url)
+ requests.get(url)
+
+ except:
+ #print(sys_ip + " : Not a tasmota!")
+ pass
+ else:
+ #print(sys_ip + " : Not a listening")
+ pass
+
+
+
+ time.sleep(1)
+ cmnd = "sed -i 's/^MQTT_HOST = .*/MQTT_HOST = \"" + dest_ip + "\"/' /root/mqtt_srv.py"
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ #for i in ;do uci set firewall.${i}.dest_ip=192.168.77.246;done;uci set firewall.HTTPS.dest_port='443';uci set firewall.HTTP.dest_port='80' ;uci commit;/etc/init.d/firewall restart
+ else:
+ pass
+ #cmnd = "/root/router_cmd.sh -t wireless -v 0"
+
+
+ print("Executed " + cmnd)
+ writeLog("Executed " + cmnd)
+
+
+ if myObj["cmd"] == "banip":
+ if myObj["status"] == "ban":
+ cmnd = "echo " + str(myObj["target"]) + " >> /etc/banip/banip.blacklist; /etc/init.d/banip refresh"
+ elif myObj["status"] == "enable":
+ cmnd = "/etc/init.d/banip resume"
+ stats["banip"] = "enabled"
+ elif myObj["status"] == "disable":
+ cmnd = "/etc/init.d/banip suspend"
+ stats["banip"] = "paused"
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=True)
+
+ if myObj["cmd"] == "vnc":
+ print(myObj["target"])
+ writeLog(myObj["target"])
+
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ myCmd = 'c:\\Program Files\\RealVNC\\VNC Viewer\\vncviewer.exe C:\\Users\\jaydee\\' + myObj["target"].upper() + '.vnc'
+ print(myCmd)
+ writeLog(myCmd)
+ subprocess.Popen(myCmd.split())
+ if myObj["cmd"] == "getstats":
+ print("lalaa1")
+ try:
+ client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":" + get_user_env('mb_temp') + ",\"mem_usage\":" + get_user_env('mem_usage') + ",\"cpu_temp\":" + get_user_env('cpu_temp') + ",\"cpu_usage\":" + get_user_env('cpu_usage') + ",\"gpu_temp\":" + get_user_env('gpu_temp') + ",\"gpu_usage\":" + get_user_env('gpu_usage') + "}", qos=0, retain=False)
+ print("ok")
+ except:
+ print("failed")
+ client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
+
+ print("lalaa2")
+
+ if myObj["cmd"] == "display":
+ if curos == "Windows1":
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ #print("reconfigure")
+ myCmd = 'MonitorSwitcher.exe -load:' + myObj["target"] + '.xml'
+ writeLog(myCmd)
+ #writeLog(os.path.realpath(__file__))
+ print("lalaa2")
+ #subprocess.Popen(r'"{}"'.format(myCmd), shell=True)
+ print("lalaa3")
+ subprocess.Popen(myCmd.split(), shell=True,cwd=r'c:\Progra~1\jaydee')
+ else:
+ '''
+ myCmd = ""
+ if myObj["target"] == "mid":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --off --output eDP-1 --off"
+ elif myObj["target"] == "all":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-2 --mode 1920x1080 --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --auto --right-of HDMI-2 --mode 1920x1080"
+ elif myObj["target"] == "midleft":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --off"
+ elif myObj["target"] == "midtop":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-2 --mode 1920x1080 --output HDMI-1 --off --output eDP-1 --off"
+ elif myObj["target"] == "midleftbuild":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --auto --right-of HDMI-2 --mode 1920x1080"
+ elif myObj["target"] == "midbuild":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --off --output eDP-1 --auto --right-of HDMI-2 --mode 1920x1080"
+ elif myObj["target"] == "midlefttop":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-2 --mode 1920x1080 --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --off"
+ else:
+ pass
+
+ if myCmd != "":
+ print(myCmd)
+ subprocess.Popen(myCmd.split())
+ '''
+ myCmd = ""
+ writeLog(myObj["target"])
+ if curos == "Windows":
+ if myObj["target"] == "mid":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile mid"
+ elif myObj["target"] == "all":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile all"
+ elif myObj["target"] == "midleft":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midleft"
+ elif myObj["target"] == "midtop":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midtop"
+ elif myObj["target"] == "midleftbuild":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midleftbuild"
+ elif myObj["target"] == "midbuild":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midbuild"
+ elif myObj["target"] == "midlefttop":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midlefttop"
+ elif myObj["target"] == "build":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile build"
+ elif myObj["target"] == "midtopbuild":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midtopbuild"
+ else:
+ pass
+ else:
+ if myObj["target"] == "mid":
+ myCmd = "xrandr --output HDMI-1-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1-1 --off --output eDP-1-1 --off"
+ elif myObj["target"] == "all":
+ myCmd = "xrandr --output HDMI-1-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-1-2 --mode 1920x1080 --output HDMI-1-1 --auto --left-of HDMI-1-2 --mode 1920x1080 --output eDP-1-1 --auto --right-of HDMI-1-2 --mode 1920x1080"
+ elif myObj["target"] == "midleft":
+ myCmd = "xrandr --output HDMI-1-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1-1 --auto --left-of HDMI-1-2 --mode 1920x1080 --output eDP-1-1 --off"
+ elif myObj["target"] == "midtop":
+ myCmd = "xrandr --output HDMI-1-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-1-2 --mode 1920x1080 --output HDMI-1-1 --off --output eDP-1-1 --off"
+ elif myObj["target"] == "midleftbuild":
+ myCmd = "xrandr --output HDMI-1-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1-1 --auto --left-of HDMI-1-2 --mode 1920x1080 --output eDP-1-1 --auto --right-of HDMI-1-2 --mode 1920x1080"
+ elif myObj["target"] == "midbuild":
+ myCmd = "xrandr --output HDMI-1-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1-1 --off --output eDP-1-1 --auto --right-of HDMI-1-2 --mode 1920x1080"
+ elif myObj["target"] == "midlefttop":
+ myCmd = "xrandr --output HDMI-1-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-1-2 --mode 1920x1080 --output HDMI-1-1 --auto --left-of HDMI-1-2 --mode 1920x1080 --output eDP-1-1 --off"
+ elif myObj["target"] == "build":
+ myCmd = "xrandr --output HDMI-1-2 --off --output DVI-I-2-1 --off --output HDMI-1-1 --off --output eDP-1-1 --auto --mode 1920x1080"
+ else:
+ pass
+
+ writeLog(myCmd)
+ if myCmd != "":
+ print(myCmd)
+ subprocess.Popen(myCmd.split())
+
+ if myObj["cmd"] == "display2":
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ #print("reconfigure")
+ subprocess.Popen(['MultiMonitorTool.exe', '/SaveConfig', 'c:\\Program Files\\jaydee\\switcher.cfg'])
+ myCmd = "powershell switcher.ps1 " + str(myObj["target"]) + " " + str(myObj["status"])
+ writeLog(myCmd)
+ subprocess.Popen(myCmd.split())
+ time.sleep(1)
+ subprocess.Popen(['MultiMonitorTool.exe', '/LoadConfig', 'c:\\Program Files\\jaydee\\switcher.cfg'])
+ client.publish("sectorq/feedback", payload='{"action":"resp", "source":"ASUS", "dev":{"display' + str(myObj["target"]) + '":'+ str(myObj["status"]) +'} }' , qos=0, retain=False)
+ if myObj["cmd"] == "displ":
+ print("Display")
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ subprocess.Popen(['/usr/bin/xrandr', '--output', 'HDMI-1-1', '--off'])
+
+ if myObj["cmd"] == "xrandr":
+ if curos == "Windows":
+ subprocess.Popen(['MultiMonitorTool.exe', '/LoadConfig', 'c:\\Program Files\\jaydee\\all_on.cfg'])
+ else:
+ print("Display")
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ os.system("export DISPLAY=:0")
+ subprocess.Popen(['/usr/bin/xrandr'])
+
+ if myObj["cmd"] == "suspend":
+ print("suspending")
+ if curos == "Windows":
+ os.system("rundll32.exe powrprof.dll,SetSuspendState 0,1,0")
+ #cmnd = "psshutdown -d -t 1"
+ writeLog(cmnd)
+ #status, output = subprocess.getstatusoutput(cmnd)
+ #subprocess.Popen(["psshutdown", "-d", "-t", "1"])
+ #writeLog(output)
+ else:
+ if host == "nas" or host == "octopi":
+ subprocess.Popen(["/sbin/poweroff"])
+ else:
+ #subprocess.Popen(["/bin/systemctl", "suspend", "-i"])
+ subprocess.Popen(["sudo", "pm-suspend"])
+ if myObj["cmd"] == "stats":
+ grep = subprocess.Popen(['grep', 'cpu', '/proc/stat'],
+ stdout=subprocess.PIPE,
+ )
+
+ awk = subprocess.Popen(['awk', '{print ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}'],
+ stdin=grep.stdout,
+ stdout=subprocess.PIPE,
+ )
+
+ # cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS="" '{print ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}'
+
+ end_of_pipe = awk.stdout
+
+ for line in end_of_pipe:
+ # print(line.strip())
+ # usage = re.sub(r"^b\'|\'$", "", (line.strip()))
+ cpu = round(float(line.strip().decode("utf-8")))
+ free = subprocess.Popen(['free'],
+ stdout=subprocess.PIPE,
+ )
+
+ grep = subprocess.Popen(['grep', 'Mem'],
+ stdout=subprocess.PIPE,
+ stdin=free.stdout,
+ )
+
+ awk = subprocess.Popen(['awk', '{print $3/$2 * 100.0}'],
+ stdin=grep.stdout,
+ stdout=subprocess.PIPE,
+ )
+
+ end_of_pipe = awk.stdout
+
+ for line in end_of_pipe:
+ # print(line.strip())
+ # mem = re.sub(r"^b\'|\'$", "", (line.strip()))
+ mem = round(float(line.strip().decode("utf-8")))
+ # mem = re.sub(r"^b\'|\'$", "", mem)
+ # cpu = re.sub(r"^b\'|\'$", "", cpu)
+ # print(mem)
+ jn = {"cpu": cpu, "mem": mem}
+ jn = json.dumps(jn)
+ client.publish("sectorq/status/" + host, payload=jn, qos=0, retain=False)
+ except:
+ print("not a json!")
+
+client = mqtt.Client()
+payload = "off"
+client.username_pw_set("jaydee", password="jaydee1")
+client.will_set("sectorq/systems/" + host.lower() + "/stat", payload=payload, qos=0, retain=False)
+client.on_connect = on_connect
+client.on_message = on_message
+writeLog(MQTT_HOST)
+client.connect(MQTT_HOST, MQTT_PORT, 5)
+
+# client.publish("sectorq/status", payload="{'action':'connect', 'system':'" + host + "', 'ip': '" + IP + "', 'mac':'" + mac + "', 'ver':'?'}", qos=0, retain=False)
+
+
+# Blocking call that processes network traffic, dispatches callbacks and
+# handles reconnecting.
+# Other loop*() functions are available that give a threaded interface and a
+# manual interface.
+
+if curos == "Windows":
+ #client.loop_forever()
+ client.loop_start()
+ NEXT_CHECK = 0
+ while True:
+ print(VERSION)
+ time.sleep(5)
+ try:
+ mtime = os.path.getmtime(sys.argv[0])
+ except OSError:
+ mtime = 0
+ print(mtime)
+ if NEXT_CHECK < int(time.time()):
+ NEXT_CHECK = int(time.time()) + 10
+ writeLog("Blalala : Next : " + str(NEXT_CHECK))
+ if curos == "Windows":
+ data = python_aida64.getData()
+ #print(json.dumps(data))
+ stats = {}
+ for i in data:
+ for j in data[i]:
+ stats[j["id"]] = j["value"]
+
+
+ jn = json.dumps(stats)
+ client.publish("home-assistant/" + host + "/hwstats", payload=jn, qos=0, retain=False)
+ #print(json.dumps(stats))
+ #writeLog(json.dumps(stats))
+else:
+
+
+ client.loop_start()
+
+ NEXT_CHECK = 0
+ while True:
+ print(VERSION)
+ time.sleep(5)
+ try:
+ mtime = os.path.getmtime(sys.argv[0])
+ except OSError:
+ mtime = 0
+ print(mtime)
+ if NEXT_CHECK < int(time.time()):
+ NEXT_CHECK = int(time.time()) + 60
+ writeLog("Blalala : Next : " + str(NEXT_CHECK))
+
+
+ if host.lower() == "router":
+ cmnd = "/etc/init.d/banip status|grep \"+ status\"|awk '{ print $4 }'"
+ status, output = subprocess.getstatusoutput(cmnd)
+ writeLog("BanIP Status : " + str(status))
+ stats["banip"] = output
+
+ cmnd = "ncat -z 192.168.77.106 25"
+ status, output = subprocess.getstatusoutput(cmnd)
+ if status == 0:
+ stats["mail_nas"] = "available"
+ else:
+ stats["mail_nas"] = "unavailable"
+ cmnd = "ncat -z 192.168.77.246 25"
+ status, output = subprocess.getstatusoutput(cmnd)
+ if status == 0:
+ stats["mail_rasp"] = "available"
+ else:
+ stats["mail_rasp"] = "unavailable"
+ cmnd = "/root/router_cmd.sh -t serv_dest -m get"
+ status, output = subprocess.getstatusoutput(cmnd)
+ stats["serv_dest"] = output
+ #out = subprocess.Popen(cmnd.split())
+ status, output = subprocess.getstatusoutput(cmnd)
+ print("Getting fw info")
+ cmnd = "/root/router_cmd.sh -t firewall -n TOSHIBA-WIFI -m get"
+ #out = subprocess.Popen(cmnd.split())
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ stats["fw"] = output
+ #client.publish("sectorq/systems/router/fw", payload=str(output), qos=0, retain=True)
+ print("Getting wifi info")
+ cmnd = "/root/router_cmd.sh -t wireless -m get"
+ #out = subprocess.Popen(cmnd.split())
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ if output != 'allow':
+ output = 'off'
+ stats["macfilter"] = output
+ # if output == "allow":\
+ writeLog("Payload : " + str(json.dumps(stats)))
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=True)
+ #else:
+ # client.publish("sectorq/systems/router/macfilter", payload=0, qos=0, retain=True)
+ if host.lower() == "nas":
+ print("Getting VM info")
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh list --all"
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ l = 1
+ lines = output.splitlines()
+ VMS = {}
+ for i in lines:
+ l = l + 1
+ if l < 4:
+ continue
+ line = re.split(r" {2,}", i)
+ print(str(line[0].strip()) + " " + str(line[1].strip()) + " " + str(line[2].strip()))
+ VMS[str(line[1].strip())] = str(line[2].strip())
+
+
+
+ for m in VMS:
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + m
+ #out = subprocess.Popen(cmnd.split())
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ writeLog(output)
+ if output.strip() == "running":
+ client.publish("sectorq/systems/nas/" + m, payload=1, qos=0, retain=True)
+ else:
+ client.publish("sectorq/systems/nas/" + m, payload=0, qos=0, retain=True)
+
+
+ if FILE_TIMESTAMP != mtime:
+ writeLog("Script updated ! restarting...")
+ #os.execv(sys.executable, ['python'] + sys.argv)
+ #os.system("/share/ZFS530_DATA/.qpkg/QPython39/bin/python3 mqtt_srv.py")
+
+ if host.lower() == "nas":
+ sys.stdout.flush()
+ os.execv("/share/ZFS530_DATA/.qpkg/QPython39/bin/python3", sys.argv)
+ if host.lower() == "router":
+ #sys.stdout.flush()
+ sys.exit()
+ #os.execv("/usr/bin/python3", sys.argv)
\ No newline at end of file
diff --git a/mqtt_srv.py b/mqtt_srv.py
new file mode 100644
index 0000000..8abaed0
--- /dev/null
+++ b/mqtt_srv.py
@@ -0,0 +1,1185 @@
+#!/usr/bin/env python3
+
+from asyncio.log import logger
+import paho.mqtt.client as mqtt
+from getmac import get_mac_address
+import platform
+import socket
+import re
+import subprocess
+import os
+import json
+import sys
+import time
+import json
+import datetime
+import ctypes
+import getopt
+import random
+import requests
+#import psutil
+
+
+stats = {}
+VERSION = "1.0.20"
+curos = platform.system()
+host = platform.node().lower()
+print(host)
+if curos == "Windows":
+ import winreg
+
+
+def uptime():
+
+ try:
+ f = open( "/proc/uptime" )
+ contents = f.read().split()
+ f.close()
+ except:
+ return "Cannot open uptime file: /proc/uptime"
+
+ total_seconds = float(contents[0])
+
+ # Helper vars:
+ MINUTE = 60
+ HOUR = MINUTE * 60
+ DAY = HOUR * 24
+
+ # Get the days, hours, etc:
+ days = int( total_seconds / DAY )
+ hours = int( ( total_seconds % DAY ) / HOUR )
+ minutes = int( ( total_seconds % HOUR ) / MINUTE )
+ seconds = int( total_seconds % MINUTE )
+
+ # Build up the pretty string (like this: "N days, N hours, N minutes, N seconds")
+ string = ""
+ # if days > 0:
+ # string += str(days) + " " + (days == 1 and "d" or "d" ) + ", "
+ # if len(string) > 0 or hours > 0:
+ # string += str(hours) + " " + (hours == 1 and "h" or "h" ) + ", "
+ # if len(string) > 0 or minutes > 0:
+ # string += str(minutes) + " " + (minutes == 1 and "m" or "m" ) + ", "
+ if days > 0:
+ string += str(days) + " " + (days == 1 and "d" or "d" ) + ", "
+ if len(string) > 0 or hours > 0:
+ string += str(hours) + ":"
+ if len(string) > 0 or minutes > 0:
+ string += str(minutes) + ":"
+ string += str(seconds)
+
+ return string;
+
+def writeLog(msg, svr="INFO"):
+ ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ if curos == "Windows":
+ log_path = "c:\Program Files\jaydee\jaydee.log"
+ else:
+ log_path = "/tmp/mqtt_srv.log"
+ f = open(log_path, "a")
+ f.write(ts + " | " + svr + " | " + str(msg) + "\n")
+ f.close()
+
+def check_router():
+ stats["uptime"] = uptime()
+ stats["version"] = VERSION
+ cmnd = "crontab -l"
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ if "#Skynet_banmalware#" in output:
+ stats["skynet"] = "on"
+ else:
+ stats["skynet"] = "off"
+ if "#Diversion_CountAds#" in output:
+ stats["diversion"] = "on"
+ else:
+ stats["diversion"] = "off"
+
+
+ cmnd = "nvram get vpn_client1_state"
+ status, output = subprocess.getstatusoutput(cmnd)
+ writeLog("Openvpn1 Status : " + str(output))
+ stats["vpnclient1"] = output
+ cmnd = "nvram get vpn_client2_state"
+ status, output = subprocess.getstatusoutput(cmnd)
+ writeLog("Openvpn2 Status : " + str(output))
+ stats["vpnclient2"] = output
+ cmnd = "ncat -z 192.168.77.106 25"
+ status, output = subprocess.getstatusoutput(cmnd)
+ if status == 0:
+ stats["mail_nas"] = "available"
+ else:
+ stats["mail_nas"] = "unavailable"
+ cmnd = "ncat -z 192.168.77.246 25"
+ status, output = subprocess.getstatusoutput(cmnd)
+ if status == 0:
+ stats["mail_rasp"] = "available"
+ else:
+ stats["mail_rasp"] = "unavailable"
+ cmnd = "nvram get vts_rulelist"
+ status, output = subprocess.getstatusoutput(cmnd)
+ rule_data = output.split("<")
+ serv_d = {}
+ for l in rule_data:
+ rul = l.split(">")
+ if len(rul) > 3:
+ if rul[0] == "HTTPS":
+ serv_d[rul[0]] = {"src_port":rul[1],"dest_ip":rul[2],"dest_port":rul[3],"prot":rul[4]}
+ stats["serv_dest"] = rul[2]
+ break
+ #stats["serv_dest"] = json.dumps(serv_d)
+ #stats["serv_dest"] = json.dumps(serv_d)
+ #out = subprocess.Popen(cmnd.split())
+ #status, output = subprocess.getstatusoutput(cmnd)
+
+
+ '''
+
+
+ print("Getting fw info")
+ cmnd = "/root/router_cmd.sh -t firewall -n TOSHIBA-WIFI -m get"
+ #out = subprocess.Popen(cmnd.split())
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ stats["fw"] = output
+ #client.publish("sectorq/systems/router/fw", payload=str(output), qos=0, retain=True)
+ print("Getting wifi info")
+ cmnd = "/root/router_cmd.sh -t wireless -m get"
+ #out = subprocess.Popen(cmnd.split())
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ if output != 'allow':
+ output = 'off'
+ stats["macfilter"] = output
+ # if output == "allow":\
+ writeLog("Payload : " + str(json.dumps(stats)))
+ '''
+ client.publish("home-assistant/router/hwstats", json.dumps(stats), qos=0, retain=True)
+ #client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=True)
+ #else:
+ # client.publish("sectorq/systems/router/macfilter", payload=0, qos=0, retain=True)
+
+if host != "router" and host != "nas":
+ import psutil
+
+ processes = list(p.name() for p in psutil.process_iter())
+ # print(processes)
+ count = processes.count("mqtt_srv.exe")
+ if int(count) >= 3:
+ writeLog("script exist")
+ sys.exit()
+else:
+ cmnd = "ps |grep mqtt_srv.py|grep -v grep |wc -l"
+ status, output = subprocess.getstatusoutput(cmnd)
+ count = output
+ if int(count) >= 2:
+ writeLog("script exist")
+ sys.exit()
+# Stops duplicate instance from running
+
+writeLog(count)
+
+writeLog("Starting : " + str(VERSION))
+writeLog("Getting running proccesses", "DEBUG")
+
+
+writeLog("done", "DEBUG")
+
+FILE_TIMESTAMP = os.path.getmtime(sys.argv[0])
+def get_sys_env(name):
+ key = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, r"System\CurrentControlSet\Control\Session Manager\Environment")
+ return winreg.QueryValueEx(key, name)[0]
+
+def get_user_env(name):
+ key = winreg.CreateKey(winreg.HKEY_CURRENT_USER, r"Environment")
+ return winreg.QueryValueEx(key, name)[0]
+
+
+_PUBLISH = _SETVAR = False
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "Sspmt:", ["command=", "help", "output="])
+except getopt.GetoptError as err:
+ # print help information and exit:
+ print(str(err)) # will print something like "option -a not recognized"
+ #usage()
+ sys.exit(2)
+output = None
+# QJ : getopts
+
+for o, a in opts:
+ if o == "-d":
+ _ACTION = True
+ elif o in ("-p", "--publish"):
+ _PUBLISH = True
+ elif o in ("-m", "--publish"):
+ _MESSAGE = a
+ elif o in ("-t", "--publish"):
+ _TOPIC = a
+ elif o in ("-S", "--setvar"):
+ _SETVAR = True
+ _THR_NAME = sys.argv[2]
+ _THR_VAL = sys.argv[3]
+ else:
+ _WIZZARD = True
+MQTT_HOST = "192.168.77.106"
+MQTT_PORT = 1883
+
+if _PUBLISH:
+ # generate client ID with pub prefix randomly
+ #client_id = f'python-mqtt-{random.randint(0, 1000)}'
+ client_id = 'python-mqtt-1004'
+ username = 'jaydee'
+ password = 'jaydee1'
+
+ def connect_mqtt():
+ def on_connect(client, userdata, flags, rc):
+ if rc == 0:
+ print("Connected to MQTT Broker!")
+ else:
+ print("Failed to connect, return code %d\n", rc)
+
+ client = mqtt.Client(client_id)
+ client.username_pw_set(username, password)
+ client.on_connect = on_connect
+ client.connect(MQTT_HOST, MQTT_PORT)
+ return client
+
+
+ def publish(client):
+ result = client.publish(_TOPIC, _MESSAGE)
+ # result: [0, 1]
+ status = result[0]
+ if status == 0:
+ print(f"Send `{_MESSAGE}` to topic `{_TOPIC}`")
+ else:
+ print(f"Failed to send message to topic {_TOPIC}")
+
+ client = connect_mqtt()
+ publish(client)
+ sys.exit()
+
+if _SETVAR:
+ #myCmd = "setx " + _THR_NAME + " " + _THR_VAL + " -m"
+ myCmd = "setx " + _THR_NAME + " " + _THR_VAL
+ subprocess.Popen(myCmd.split(), shell=True)
+ sys.exit()
+
+from ping3 import ping, verbose_ping
+
+
+
+
+'''
+curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
+python get-pip.py
+pip3 install getmac
+pip3 install paho.mqttdasdas
+"""
+
+'''
+
+writeLog("Starting daemon in versin : " + VERSION)
+
+VERS = '1.3'
+'''
+print("pinging")
+lala = ping(MQTT_HOST)
+
+connected = 0
+while connected == 0:
+ if type(lala) == float:
+ print("Oleee connected")
+ writeLog("Mqtt connected", "INFO")
+ connected = 1
+ else:
+ print("blaaah not connected, waiting...(5)")
+ writeLog("blaaah not connected, waiting...(5)")
+ time.sleep(5)
+ lala = ping(MQTT_HOST)
+'''
+
+# Function to display hostname and
+# IP address
+def get_ip():
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ try:
+ # doesn't even have to be reachable
+ s.connect(('192.168.77.1', 1))
+ IP = s.getsockname()[0]
+ except ValueError:
+ IP = '127.0.0.1'
+ finally:
+ s.close()
+ return IP
+
+
+IP = get_ip()
+
+
+print("OS : " + curos)
+writeLog("OS : " + curos)
+if curos != "Windows":
+ import autorandr
+else:
+ import winreg
+
+
+if host == "raspberrypi":
+ mac = str(get_mac_address("eth0"))
+elif host == "SERVER":
+ mac = str(get_mac_address("enp2s0"))
+elif host == "ASUS" and curos != "Windows":
+ mac = str(get_mac_address("enp3s0f1"))
+else:
+ mac = str(get_mac_address("Ethernet"))
+
+
+print("MAC : " + mac)
+writeLog("MAC : " + mac)
+print("SYSTEM : " + host)
+writeLog("SYSTEM : " + host)
+print("IP : " + IP)
+writeLog("IP : " + IP)
+
+flag_connected = 0
+# The callback for when the client receives a CONNACK response from the server.
+def on_connect(client, userdata, flags, rc):
+ print("Connected with result code " + str(rc))
+ writeLog("Connected with result code " + str(rc))
+ global flag_connected
+ flag_connected = 1
+ # Subscribing in on_connect() means that if we lose the connection and
+ # reconnect then subscriptions will be renewed.
+ topic = "sectorq/systems/" + host.lower()
+ print(topic)
+ writeLog(topic)
+ time.sleep(1)
+ client.publish("sectorq/status", payload="{'action':'connect', 'system':'" + host.lower() + "', 'ip': '" + IP + "', 'mac':'" + mac + "', 'ver':'" + VERS + "'}", qos=0, retain=False)
+ client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
+ if host.lower() == "router":
+ check_router()
+
+ if host.lower() == "nas":
+ print("Getting VM info")
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh list --all"
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ l = 1
+ lines = output.splitlines()
+ VMS = {}
+ for i in lines:
+ l = l + 1
+ if l < 4:
+ continue
+ line = re.split(r" {2,}", i)
+ print(str(line[0].strip()) + " " + str(line[1].strip()) + " " + str(line[2].strip()))
+ VMS[str(line[1].strip())] = str(line[2].strip())
+
+
+
+ for m in VMS:
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + m
+ #out = subprocess.Popen(cmnd.split())
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ if output.strip() == "running":
+ client.publish("sectorq/systems/nas/" + m, payload=1, qos=0, retain=True)
+ else:
+ client.publish("sectorq/systems/nas/" + m, payload=0, qos=0, retain=True)
+
+
+ client.subscribe(topic)
+
+def on_disconnect(client, userdata, rc):
+ print("disconnecting reason " +str(rc))
+ writeLog("disconnecting reason " +str(rc))
+ client.connected_flag=False
+ client.disconnect_flag=True
+ global flag_connected
+ flag_connected = 0
+
+
+# The callback for when a PUBLISH message is received from the server.
+def on_message(client, userdata, msg):
+ print(msg.topic)
+ print(msg.payload)
+ myObj = msg.payload.decode('utf-8')
+ # command = re.sub(r"^b\'|\'$", "", str(msg.payload))
+ # command = json.loads(msg.payload.decode("utf-8"))
+ try:
+ myObj = json.loads(msg.payload)
+ try:
+ writeLog(myObj["action"])
+ print(myObj["action"])
+ except:
+ print("Action not set")
+ writeLog("Action not set", "WARNING")
+
+ try:
+ print(myObj["cmd"])
+ writeLog(myObj["cmd"])
+ except:
+ print("Cmd not set")
+ writeLog("Cmd not set", "WARNING")
+
+ try:
+ print(myObj["target"])
+ writeLog(myObj["target"])
+ except:
+ print("Target Not Set")
+ writeLog("Target Not Set", "WARNING")
+ try:
+ print(myObj["status"])
+ writeLog(myObj["status"])
+ except:
+ print("Status Not Set")
+ writeLog("Status Not Set")
+
+ try:
+ print(myObj["command"])
+ writeLog(myObj["command"])
+ except:
+ print("Command Not Set")
+ writeLog("Command Not Set")
+
+ try:
+ print(myObj["cmd_line"])
+ writeLog(myObj["cmd_line"])
+ except:
+ print("Cmd_line Not Set")
+ writeLog("Cmd_line Not Set")
+
+
+ if myObj["cmd"] == "command":
+
+ print("Executing " + myObj["cmd_line"])
+ writeLog("Executing " + myObj["cmd_line"])
+ #os.system('start /b "' + myObj["cmd_line"] + '"')
+ try:
+ subprocess.Popen(myObj["cmd_line"].split(), shell=True)
+ #subprocess.Popen(myObj["cmd_line"].split())
+ # ctypes.windll.user32.MessageBoxW(0, myObj["cmd_line"], "Executed", 64)
+ except:
+ ctypes.windll.user32.MessageBoxW(0, "Your text", "Your title", 16)
+ print("Executed " + myObj["cmd_line"])
+ writeLog("Executed " + myObj["cmd_line"])
+
+ if myObj["cmd"] == "nas_cmd":
+ print("Executing NAS")
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + str(myObj["target"])
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ cmd_type = myObj["command"]
+ if myObj["command"] == "start":
+ if output.strip() == "paused":
+ print("System suspended")
+ cmd_type = "resume"
+ else:
+ print("System Off")
+ cmd_type = "start"
+ if myObj["command"] == "suspend":
+ cmd_type = "shutdown"
+
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh " + cmd_type + " " + str(myObj["target"])
+ subprocess.Popen(cmnd.split())
+ print(cmnd)
+ if myObj["command"] == "start":
+ try:
+ print("sending")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload=1, qos=0, retain=False)
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload="failed", qos=0, retain=False)
+ else:
+ try:
+ print("sending")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload=0, qos=0, retain=False)
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload="failed", qos=0, retain=False)
+
+
+ if myObj["cmd"] == "distrib":
+ print("distributin313g")
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ subprocess.Popen(['/bin/systemctl', 'restart', 'mqtt'])
+
+ if myObj["cmd"] == "uci":
+ print("uci1")
+ print("Executing " + myObj["cmd_line"])
+ writeLog("Executing " + myObj["cmd_line"])
+
+ if myObj["cmd_line"] == "wireless1":
+ cmnd = "/root/router_cmd.sh -t wireless -v 1 -m set"
+ try:
+ subprocess.Popen(cmnd.split())
+ print("sending")
+ stats["macfilter"] = "allow"
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+
+ elif myObj["cmd_line"] == "wireless0":
+ cmnd = "/root/router_cmd.sh -t wireless -v 0 -m set"
+ try:
+ subprocess.Popen(cmnd.split())
+ print("sending")
+ stats["macfilter"] = "off"
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+ elif myObj["cmd_line"] == "fw0":
+ cmnd = "/root/router_cmd.sh -t firewall -n TOSHIBA-WIFI -p enabled -v 0 -m set"
+ try:
+ subprocess.Popen(cmnd.split())
+ print("sending")
+ stats["fw"] = 0
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+ elif myObj["cmd_line"] == "fw1":
+ cmnd = "/root/router_cmd.sh -t firewall -n TOSHIBA-WIFI -p enabled -v 1 -m set"
+ try:
+ #subprocess.Popen(myObj["cmd_line"].split(), shell=True)
+ subprocess.Popen(cmnd.split())
+ # ctypes.windll.user32.MessageBoxW(0, myObj["cmd_line"], "Executed", 64)
+ print("sending")
+ stats["fw"] = 1
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+ elif myObj["cmd_line"] == "openvpn":
+ cmnd = "service {}".format(myObj["target"])
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ elif myObj["cmd_line"] == "serv_dest":
+ writeLog("Payload111111 : " + myObj["target"].lower())
+
+ cmnd = "nvram get vts_rulelist"
+ status, output = subprocess.getstatusoutput(cmnd)
+ rule_data = output.split("<")
+ serv_d = {}
+ writeLog("Payload111112")
+ for l in rule_data:
+ rul = l.split(">")
+ if len(rul) > 3:
+ serv_d[rul[0]] = {"src_port":rul[1],"dest_ip":rul[2],"dest_port":rul[3],"prot":rul[4]}
+ stats["serv_dest"] = rul[2]
+ writeLog("Payload111113")
+ rules = {"HTTPS":{"dest_ip":"192.168.77.106","src_port":443,"dest_port":443,"prot":"TCP"},
+ "HTTP":{"dest_ip":"192.168.77.106","src_port":80,"dest_port":80,"prot":"TCP"},
+ "EMAIL_25":{"dest_ip":"192.168.77.106","src_port":25,"dest_port":25,"prot":"TCP"},
+ "EMAIL_465":{"dest_ip":"192.168.77.106","src_port":465,"dest_port":465,"prot":"TCP"},
+ "EMAIL_993":{"dest_ip":"192.168.77.106","src_port":993,"dest_port":993,"prot":"TCP"},
+ "EMAIL_995":{"dest_ip":"192.168.77.106","src_port":995,"dest_port":995,"prot":"TCP"},
+ "EMAIL_587":{"dest_ip":"192.168.77.106","src_port":587,"dest_port":587,"prot":"TCP"},
+ "EMAIL_143":{"dest_ip":"192.168.77.106","src_port":143,"dest_port":143,"prot":"TCP"}}
+ writeLog("Payload1111135")
+ print(json.dumps(serv_d))
+ for r in rules:
+ print(r)
+ try:
+ serv_d[r]["dest_ip"] = myObj["target"]
+ except:
+ serv_d[r] = rules[r]
+
+ lala = []
+ for sr in serv_d:
+ lala.append("{}>{}>{}>{}>{}>".format(sr,serv_d[sr]["src_port"],serv_d[sr]["dest_ip"],serv_d[sr]["dest_port"],serv_d[sr]["prot"]))
+ la = "<".join(lala)
+ la = "<{}".format(la)
+ print(la)
+ cmnd = "nvram set vts_rulelist=\"{}\"".format(la)
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ cmnd = "nvram commit"
+ status, output = subprocess.getstatusoutput(cmnd)
+ cmnd = "service restart_firewall"
+ status, output = subprocess.getstatusoutput(cmnd)
+ writeLog("Payload111114")
+ writeLog(output)
+ print(json.dumps(serv_d))
+ '''
+ if myObj["target"].lower() == "192.168.77.246":
+ dest_ip = "192.168.77.246"
+ elif myObj["target"].lower() == "192.168.77.106":
+ dest_ip = "192.168.77.106"
+
+
+
+
+ RULES = ["EMAIL993", "EMAIL995", "EMAIL143", "EMAIL25", "EMAIL993", "EMAIL465", "HTTPS", "HTTP"]
+ for i in RULES:
+ cmnd = "uci set firewall.{}.dest_ip={}".format(i,dest_ip)
+ writeLog(cmnd)
+ subprocess.Popen(cmnd.split())
+
+ #cmnd = "uci set dhcp.@dnsmasq[0].address=/mqtt_broker/" + dest_ip
+ #writeLog(cmnd)
+ #subprocess.Popen(cmnd.split())
+ time.sleep(1)
+ cmnd = "uci commit"
+
+ subprocess.Popen(cmnd.split())
+
+ writeLog("Starting " + myObj["target"].lower())
+ if myObj["target"].lower() == "192.168.77.246":
+ dest_ip = "192.168.77.246"
+
+
+ cmnd = "ssh root@192.168.77.246 'docker start mailu_resolver_1 mailu_redis_1 mailu_front_1 mailu_antispam_1 mailu_imap_1 mailu_admin_1 mailu_smtp_1 mailu_webmail_1 watchtower_watchtower_1 nginx-proxy-manager_db_1 nginx-proxy-manager_app_1 HomeAssistant webhub_client_1 dockermon_docker_mon_1 mosquitto_mosquitto_1 node-red_node-red_1 nextcloud_db_1 nextcloud_app_1'"
+ status, output = subprocess.getstatusoutput(cmnd)
+ elif myObj["target"].lower() == "192.168.77.106":
+ dest_ip = "192.168.77.106"
+ cmnd = "ssh root@192.168.77.246 'docker stop mailu_resolver_1 mailu_redis_1 mailu_front_1 mailu_antispam_1 mailu_imap_1 mailu_admin_1 mailu_smtp_1 mailu_webmail_1 watchtower_watchtower_1 nginx-proxy-manager_db_1 nginx-proxy-manager_app_1 HomeAssistant webhub_client_1 dockermon_docker_mon_1 mosquitto_mosquitto_1 node-red_node-red_1 nextcloud_db_1 nextcloud_app_1'"
+ status, output = subprocess.getstatusoutput(cmnd)
+ time.sleep(1)
+ cmnd = "/etc/init.d/firewall restart"
+ subprocess.Popen(cmnd.split())
+ #cmnd = "/etc/init.d/dnsmasq restart"
+ #subprocess.Popen(cmnd.split())
+ writeLog("reconfigure iot")
+ MQTT_BROKER = dest_ip
+ MQTT_USER = "jaydee"
+ MQTT_PASS = "jaydee1"
+
+ cmnd = "nmap -sP 192.168.77.*|grep \"Nmap scan report\"|egrep -o \"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\""
+ #print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ # print(output)
+
+ ips = output.splitlines()
+ tasm_data = {}
+ for sys_ip in ips:
+ # print("Thsis is ip : " + sys_ip)
+ cmnd = "nmap " + sys_ip + " -p80|grep \"80/tcp open http\""
+ status, output = subprocess.getstatusoutput(cmnd)
+ # print("status of 80 : " + str(status))
+ if status == 0:
+ try:
+ # url = "http://" + sys_ip + "/cm?user=admin&password=l4c1j4yd33Du5l0&cmnd=STATUS+5"
+
+ url = "http://" + sys_ip + "/cm?cmnd=Backlog%20MqttHost%20" + MQTT_BROKER + "%3BMqttUser%20" + MQTT_USER + "%3BMqttPassword%20" + MQTT_PASS
+ print(url)
+ requests.get(url)
+
+ except:
+ #print(sys_ip + " : Not a tasmota!")
+ pass
+ else:
+ #print(sys_ip + " : Not a listening")
+ pass
+
+
+
+ time.sleep(1)
+ cmnd = "sed -i 's/^MQTT_HOST = .*/MQTT_HOST = \"" + dest_ip + "\"/' /root/mqtt_srv.py"
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ #for i in ;do uci set firewall.${i}.dest_ip=192.168.77.246;done;uci set firewall.HTTPS.dest_port='443';uci set firewall.HTTP.dest_port='80' ;uci commit;/etc/init.d/firewall restart
+ else:
+ pass
+ #cmnd = "/root/router_cmd.sh -t wireless -v 0"
+
+
+ print("Executed " + cmnd)
+ writeLog("Executed " + cmnd)
+ '''
+
+
+ if myObj["cmd"] == "banip":
+ if myObj["status"] == "ban":
+ cmnd = "echo " + str(myObj["target"]) + " >> /etc/banip/banip.blacklist; /etc/init.d/banip refresh"
+ elif myObj["status"] == "enable":
+ cmnd = "/etc/init.d/banip resume"
+ stats["banip"] = "enabled"
+ elif myObj["status"] == "disable":
+ cmnd = "/etc/init.d/banip suspend"
+ stats["banip"] = "paused"
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=True)
+
+ if myObj["cmd"] == "vnc":
+ print(myObj["target"])
+ writeLog(myObj["target"])
+
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ myCmd = 'c:\\Program Files\\RealVNC\\VNC Viewer\\vncviewer.exe C:\\Users\\jaydee\\' + myObj["target"].upper() + '.vnc'
+ print(myCmd)
+ writeLog(myCmd)
+ subprocess.Popen(myCmd.split())
+ if myObj["cmd"] == "getstats":
+ print("lalaa1")
+ try:
+ client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":" + get_user_env('mb_temp') + ",\"mem_usage\":" + get_user_env('mem_usage') + ",\"cpu_temp\":" + get_user_env('cpu_temp') + ",\"cpu_usage\":" + get_user_env('cpu_usage') + ",\"gpu_temp\":" + get_user_env('gpu_temp') + ",\"gpu_usage\":" + get_user_env('gpu_usage') + "}", qos=0, retain=False)
+ print("ok")
+ except:
+ print("failed")
+ client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
+
+ print("lalaa2")
+
+ if myObj["cmd"] == "display":
+ if curos == "Windows1":
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ #print("reconfigure")
+ myCmd = 'MonitorSwitcher.exe -load:' + myObj["target"] + '.xml'
+ writeLog(myCmd)
+ #writeLog(os.path.realpath(__file__))
+ print("lalaa2")
+ #subprocess.Popen(r'"{}"'.format(myCmd), shell=True)
+ print("lalaa3")
+ subprocess.Popen(myCmd.split(), shell=True,cwd=r'c:\Progra~1\jaydee')
+ else:
+ '''
+ myCmd = ""
+ if myObj["target"] == "mid":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --off --output eDP-1 --off"
+ elif myObj["target"] == "all":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-2 --mode 1920x1080 --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --auto --right-of HDMI-2 --mode 1920x1080"
+ elif myObj["target"] == "midleft":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --off"
+ elif myObj["target"] == "midtop":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-2 --mode 1920x1080 --output HDMI-1 --off --output eDP-1 --off"
+ elif myObj["target"] == "midleftbuild":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --auto --right-of HDMI-2 --mode 1920x1080"
+ elif myObj["target"] == "midbuild":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --off --output eDP-1 --auto --right-of HDMI-2 --mode 1920x1080"
+ elif myObj["target"] == "midlefttop":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-2 --mode 1920x1080 --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --off"
+ else:
+ pass
+
+ if myCmd != "":
+ print(myCmd)
+ subprocess.Popen(myCmd.split())
+ '''
+ myCmd = ""
+ writeLog(myObj["target"])
+ if curos == "Windows":
+ if myObj["target"] == "mid":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile mid"
+ elif myObj["target"] == "all":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile all"
+ elif myObj["target"] == "left":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile left"
+ elif myObj["target"] == "midleft":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midleft"
+ elif myObj["target"] == "midtop":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midtop"
+ elif myObj["target"] == "midleftbuild":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midleftbuild"
+ elif myObj["target"] == "midbuild":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midbuild"
+ elif myObj["target"] == "midlefttop":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midlefttop"
+ elif myObj["target"] == "build":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile build"
+ elif myObj["target"] == "midtopbuild":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midtopbuild"
+ else:
+ pass
+ else:
+ '''
+ mon1 = "HDMI-1-1"
+ mon2 = "HDMI-1-2"
+ mon3 = "DVI-I-2-1"
+ mon4 = "eDP-1-1"
+ '''
+ mon1 = "HDMI-1"
+ mon2 = "HDMI-2"
+ mon3 = "DVI-I-2-1"
+ mon4 = "eDP-1"
+
+ if myObj["target"] == "mid":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " +mon1 + " --off --output " + mon4 + " --off"
+ elif myObj["target"] == "left":
+ myCmd = "xrandr --output " + mon1 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " +mon2 + " --off --output " + mon4 + " --off"
+
+ elif myObj["target"] == "all":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --auto --right-of " + mon2 + " --mode 1920x1080 --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --auto --right-of " + mon2 + " --mode 1920x1080"
+ elif myObj["target"] == "midleft":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --off"
+ elif myObj["target"] == "midtop":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --auto --right-of " + mon2 + " --mode 1920x1080 --output " + mon1 + " --off --output " + mon4 + " --off"
+ elif myObj["target"] == "midleftbuild":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --auto --right-of " + mon2 + " --mode 1920x1080"
+ elif myObj["target"] == "midbuild":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " + mon1 + " --off --output " + mon4 + " --auto --right-of " + mon2 + " --mode 1920x1080"
+ elif myObj["target"] == "midlefttop":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --auto --right-of " + mon2 + " --mode 1920x1080 --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --off"
+ elif myObj["target"] == "build":
+ myCmd = "xrandr --output " + mon2 + " --off --output " + mon3 + " --off --output " + mon1 + " --off --output " + mon4 + " --auto --mode 1920x1080"
+ else:
+ pass
+
+ writeLog(myCmd)
+ if myCmd != "":
+ print(myCmd)
+ subprocess.Popen(myCmd.split())
+
+ if myObj["cmd"] == "display2":
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ #print("reconfigure")
+ subprocess.Popen(['MultiMonitorTool.exe', '/SaveConfig', 'c:\\Program Files\\jaydee\\switcher.cfg'])
+ myCmd = "powershell switcher.ps1 " + str(myObj["target"]) + " " + str(myObj["status"])
+ writeLog(myCmd)
+ subprocess.Popen(myCmd.split())
+ time.sleep(1)
+ subprocess.Popen(['MultiMonitorTool.exe', '/LoadConfig', 'c:\\Program Files\\jaydee\\switcher.cfg'])
+ client.publish("sectorq/feedback", payload='{"action":"resp", "source":"ASUS", "dev":{"display' + str(myObj["target"]) + '":'+ str(myObj["status"]) +'} }' , qos=0, retain=False)
+ if myObj["cmd"] == "displ":
+ print("Display")
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ subprocess.Popen(['/usr/bin/xrandr', '--output', 'HDMI-1-1', '--off'])
+
+ if myObj["cmd"] == "xrandr":
+ if curos == "Windows":
+ subprocess.Popen(['MultiMonitorTool.exe', '/LoadConfig', 'c:\\Program Files\\jaydee\\all_on.cfg'])
+ else:
+ print("Display")
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ os.system("export DISPLAY=:0")
+ subprocess.Popen(['/usr/bin/xrandr'])
+
+ if myObj["cmd"] == "suspend":
+ print("suspending")
+ if curos == "Windows":
+ if host == "amd" or host == "amd1":
+ os.system("shutdown /s /t 1")
+ else:
+ os.system("rundll32.exe powrprof.dll,SetSuspendState 0,1,0")
+ #cmnd = "psshutdown -d -t 1"
+ writeLog(cmnd)
+ #status, output = subprocess.getstatusoutput(cmnd)
+ #subprocess.Popen(["psshutdown", "-d", "-t", "1"])
+ #writeLog(output)
+ else:
+ if host == "nas" or host == "octopi":
+ subprocess.Popen(["/sbin/poweroff"])
+ elif host == "openmediavault" or host == "omv":
+ subprocess.Popen(["poweroff"])
+ else:
+ #subprocess.Popen(["/bin/systemctl", "suspend", "-i"])
+ #subprocess.Popen(["sudo", "pm-suspend"])
+ cmnd = "pm-suspend"
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ print(status)
+ if myObj["cmd"] == "stats":
+ grep = subprocess.Popen(['grep', 'cpu', '/proc/stat'],
+ stdout=subprocess.PIPE,
+ )
+
+ awk = subprocess.Popen(['awk', '{print ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}'],
+ stdin=grep.stdout,
+ stdout=subprocess.PIPE,
+ )
+
+ # cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS="" '{print ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}'
+
+ end_of_pipe = awk.stdout
+
+ for line in end_of_pipe:
+ # print(line.strip())
+ # usage = re.sub(r"^b\'|\'$", "", (line.strip()))
+ cpu = round(float(line.strip().decode("utf-8")))
+ free = subprocess.Popen(['free'],
+ stdout=subprocess.PIPE,
+ )
+
+ grep = subprocess.Popen(['grep', 'Mem'],
+ stdout=subprocess.PIPE,
+ stdin=free.stdout,
+ )
+
+ awk = subprocess.Popen(['awk', '{print $3/$2 * 100.0}'],
+ stdin=grep.stdout,
+ stdout=subprocess.PIPE,
+ )
+
+ end_of_pipe = awk.stdout
+
+ for line in end_of_pipe:
+ # print(line.strip())
+ # mem = re.sub(r"^b\'|\'$", "", (line.strip()))
+ mem = round(float(line.strip().decode("utf-8")))
+ # mem = re.sub(r"^b\'|\'$", "", mem)
+ # cpu = re.sub(r"^b\'|\'$", "", cpu)
+ # print(mem)
+ jn = {"cpu": cpu, "mem": mem}
+ jn = json.dumps(jn)
+ client.publish("sectorq/status/" + host, payload=jn, qos=0, retain=False)
+ except:
+ print("not a json!")
+
+client = mqtt.Client()
+payload = "off"
+client.username_pw_set("jaydee", password="jaydee1")
+client.will_set("sectorq/systems/" + host.lower() + "/stat", payload=payload, qos=0, retain=False)
+client.on_connect = on_connect
+client.on_message = on_message
+writeLog(MQTT_HOST)
+client.connect(MQTT_HOST, MQTT_PORT, 5)
+
+# client.publish("sectorq/status", payload="{'action':'connect', 'system':'" + host + "', 'ip': '" + IP + "', 'mac':'" + mac + "', 'ver':'?'}", qos=0, retain=False)
+
+
+# Blocking call that processes network traffic, dispatches callbacks and
+# handles reconnecting.
+# Other loop*() functions are available that give a threaded interface and a
+# manual interface.
+
+def checkIfProcessRunning(processName):
+ '''
+ Check if there is any running process that contains the given name processName.
+ '''
+ #Iterate over the all the running process
+ for proc in psutil.process_iter():
+ try:
+ # Check if process name contains the given name string.
+ if processName.lower() in proc.name().lower():
+ return True
+ except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
+ pass
+ return False;
+
+
+
+if curos == "Windows":
+ print("WINDOWS")
+ #client.loop_forever()
+ client.loop_start()
+ NEXT_CHECK = 0
+ while True:
+ print("Version: {}".format(VERSION))
+ time.sleep(5)
+ try:
+ mtime = os.path.getmtime(sys.argv[0])
+ except OSError:
+ mtime = 0
+ print(mtime)
+ if NEXT_CHECK < int(time.time()):
+ NEXT_CHECK = int(time.time()) + 10
+ writeLog("Blalala : Next : " + str(NEXT_CHECK))
+ if curos == "Windows":
+ if checkIfProcessRunning("aida64.exe"):
+ aide_refs = {
+ 'TPCHDIO':"MB_TEMP",
+ 'TCPU':'CPU_TEMP',
+ 'SMEMUTI': 'MEM_UTIL',
+ 'SVIRTMEMUTI': 'VMEM_UTIL',
+ 'SCPUUTI': 'CPU_UTIL',
+ 'FCPU': 'FAN_CPU',
+ 'TGPU1DIO': 'GPU_TEMP',
+ 'SGPU1BIUTI': 'GPU_UTIL',
+ 'TMOBO':'MB_TEMP'
+ }
+ #ks = ["TCPU", "TPCHDIO", "SMEMUTI", "SVIRTMEMUTI", "SCPUUTI", "FCPU", "TGPU1DIO", "SGPU1BIUTI"]
+
+
+
+
+ path = winreg.HKEY_CURRENT_USER
+ try:
+ key = winreg.OpenKeyEx(path, r"SOFTWARE\\FinalWire\\AIDA64\\SensorValues")
+ results = {}
+ for k in aide_refs:
+ k2 = "Value." + str(k)
+ try:
+ value = winreg.QueryValueEx(key,k2)
+ print("{} : {}".format(k, value[0]))
+ results[aide_refs[k]] = value[0]
+ except:
+ pass
+ except:
+ print("aida initializing...")
+ results = {}
+
+
+ else:
+ print("CPU Cnt : {}".format(psutil.cpu_count()))
+ print(psutil.virtual_memory())
+ cpu_usage = psutil.cpu_percent(interval=None)
+ swap_data = psutil.swap_memory()
+ print("CPU : {}".format(cpu_usage))
+ mem_data = psutil.virtual_memory()
+ print(mem_data)
+ print(swap_data)
+ print("MEM : {}".format(mem_data.percent))
+ print(psutil.getloadavg())
+ try:
+ print(psutil.sensors_temperatures())
+ except:
+ pass
+ try:
+ print(psutil.sensors_fans())
+ except:
+ pass
+ results = {"version":VERSION,"MB_TEMP":"NA", "MEM_UTIL":str(mem_data.percent), "CPU_TEMP":"NA", "FAN_CPU":"NA", "VMEM_UTIL":swap_data.percent, "CPU_UTIL":cpu_usage, "GPU_TEMP":"NA", "GPU_UTIL":"NA"}
+ print(json.dumps(results))
+ r = json.dumps(results)
+ #client.publish("home-assistant/" + host + "/hwstats", payload='{"TPCHDIO":"' + str(results["TPCHDIO"]) + '", "SMEMUTI":"' + str(results["SMEMUTI"]) + '", "TCPU":"' + str(results["TCPU"]) + '", "TGPU1DIO":"' + str(results["TGPU1DIO"]) + '", "SGPU1BIUTI":"' + str(results["SGPU1BIUTI"]) + '", "FCPU":"' + str(results["FCPU"]) + '", "SVIRTMEMUTI":"' + str(results["SVIRTMEMUTI"]) + '", "SCPUUTI":"' + str(results["SCPUUTI"]) + '"}', qos=0, retain=False)
+ client.publish("home-assistant/" + host + "/hwstats", payload=r, qos=0, retain=False)
+ #print(json.dumps(stats))
+ #writeLog(json.dumps(stats))
+else:
+ print("Linux")
+ client.loop_start()
+
+ NEXT_CHECK = 0
+ while True:
+ print(VERSION)
+ time.sleep(5)
+ try:
+ mtime = os.path.getmtime(sys.argv[0])
+ except OSError:
+ mtime = 0
+ print(mtime)
+ if NEXT_CHECK < int(time.time()):
+ NEXT_CHECK = int(time.time()) + 20
+ writeLog("Blalala : Next : " + str(NEXT_CHECK))
+
+ if host.lower() == "asus":
+ print(psutil.sensors_temperatures())
+ #print(psutil.sensors_fans())
+ sences = psutil.sensors_temperatures()
+ cpu_data = sences["coretemp"][0]
+ mb_data = sences["acpitz"][0]
+ fan_data = psutil.sensors_fans()["asus"][0]
+ mem_data = psutil.virtual_memory()
+ swap_data = psutil.swap_memory()
+ #cpu_usage = psutil.cpu_percent(interval=1)
+ load1, load5, load15 = psutil.getloadavg()
+ cpu_usage = round((load1/os.cpu_count()) * 100, 1)
+
+ print(mem_data)
+ print(mem_data.percent)
+ print(psutil.disk_usage('/'))
+ #print(psutil.virtual_memory())
+ #print(dict(psutil.virtual_memory()._asdict()))
+ #cmnd = "sensors -j|grep -v \"Can't read\""
+ #status, output = subprocess.getstatusoutput(cmnd)
+ #print(output)
+ #print(type(output))
+ #jn1 = json.loads(output)
+
+ #print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
+ #print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
+ #client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
+ client.publish("home-assistant/" + host + "/hwstats", payload='{"version":"' + VERSION + '","MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":' + str(fan_data.current) + ', "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
+ elif host.lower() == "openmediavault" or host.lower() == "omv":
+ #print(psutil.sensors_temperatures())
+ #print(psutil.sensors_fans())
+ sences = psutil.sensors_temperatures()
+ #print(sences)
+ cpu_data = sences["coretemp"][0]
+ mb_data = sences["acpitz"][0]
+ mem_data = psutil.virtual_memory()
+ swap_data = psutil.swap_memory()
+ #cpu_usage = psutil.cpu_percent(interval=1)
+ load1, load5, load15 = psutil.getloadavg()
+ cpu_usage = round((load1/os.cpu_count()) * 100, 1)
+ print(psutil.getloadavg())
+ print("CPU Util : {}".format(cpu_usage))
+ print(mem_data)
+ print(mem_data.percent)
+ raid_data = psutil.disk_usage('/srv/dev-disk-by-uuid-02fbe97a-cd9a-4511-8bd5-21f8516353ee')
+ #print(psutil.virtual_memory())
+ #print(dict(psutil.virtual_memory()._asdict()))
+ #cmnd = "sensors -j|grep -v \"Can't read\""
+ #status, output = subprocess.getstatusoutput(cmnd)
+ #print(output)
+ #print(type(output))
+ #jn1 = json.loads(output)
+ stat_rsync = subprocess.call(["systemctl", "is-active", "--quiet", "rsync"])
+ if(stat_rsync == 0): # if 0 (active), print "Active"
+ stat_rsync = "on"
+ else:
+ stat_rsync = "off"
+ #sdiskusage = psutil.disk_partitions()
+ disk_usage = raid_data[3]
+ print(disk_usage)
+ sys_uptime = str(datetime.timedelta(seconds=round(time.time() - psutil.boot_time(), 0)))
+ reboot_pending = False
+ if os.path.exists("/var/run/reboot-required"):
+ reboot_pending = True
+ #str(datetime.timedelta(seconds=666))
+ #print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
+ #print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
+ #client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
+ client.publish("home-assistant/" + host + "/hwstats", payload='{"version":"' + VERSION + '","reboot":"' + str(reboot_pending) + '", "uptime":"' + str(sys_uptime) + '", "raid_usage": ' + str(disk_usage) + ',"rsync":"' + str(stat_rsync) +'", "MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":0, "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
+ elif host.lower() == "router":
+ check_router()
+ elif host.lower() == "nas":
+ print("Getting VM info")
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh list --all"
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ l = 1
+ lines = output.splitlines()
+ VMS = {}
+ for i in lines:
+ l = l + 1
+ if l < 4:
+ continue
+ line = re.split(r" {2,}", i)
+ print(str(line[0].strip()) + " " + str(line[1].strip()) + " " + str(line[2].strip()))
+ VMS[str(line[1].strip())] = str(line[2].strip())
+
+
+
+ for m in VMS:
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + m
+ #out = subprocess.Popen(cmnd.split())
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ writeLog(output)
+ if output.strip() == "running":
+ client.publish("sectorq/systems/nas/" + m, payload=1, qos=0, retain=True)
+ else:
+ client.publish("sectorq/systems/nas/" + m, payload=0, qos=0, retain=True)
+
+
+ if FILE_TIMESTAMP != mtime:
+ writeLog("Script updated ! restarting...")
+ #os.execv(sys.executable, ['python'] + sys.argv)
+ #os.system("/share/ZFS530_DATA/.qpkg/QPython39/bin/python3 mqtt_srv.py")
+
+ if host.lower() == "nas":
+ sys.stdout.flush()
+ os.execv("/share/ZFS530_DATA/.qpkg/QPython39/bin/python3", sys.argv)
+ if host.lower() == "router" or host.lower() == "omv":
+ #sys.stdout.flush()
+ #os.execv(sys.argv, "")
+ print("argv was",sys.argv)
+ print("sys.executable was", sys.executable)
+ print("restart now")
+
+ os.execv(sys.executable, ['python3'] + sys.argv)
+ #os.startfile(sys.argv[0])
+ sys.exit()
\ No newline at end of file
diff --git a/mqtt_srv.pyw b/mqtt_srv.pyw
new file mode 100644
index 0000000..0863d3f
--- /dev/null
+++ b/mqtt_srv.pyw
@@ -0,0 +1,1123 @@
+#!/usr/bin/env python3
+
+from asyncio.log import logger
+import paho.mqtt.client as mqtt
+from getmac import get_mac_address
+import platform
+import socket
+import re
+import subprocess
+import os
+import json
+import sys
+import time
+import json
+import datetime
+import ctypes
+import getopt
+import random
+import requests
+#import psutil
+
+
+stats = {}
+VERSION = "1.0.10"
+curos = platform.system()
+host = platform.node().lower()
+print(host)
+if curos == "Windows":
+ import winreg
+
+def writeLog(msg, svr="INFO"):
+ ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ if curos == "Windows":
+ log_path = "c:\Program Files\jaydee\jaydee.log"
+ else:
+ log_path = "/tmp/mqtt_srv.log"
+ f = open(log_path, "a")
+ f.write(ts + " | " + svr + " | " + str(msg) + "\n")
+ f.close()
+
+def check_router():
+ cmnd = "nvram get vpn_client1_state"
+ status, output = subprocess.getstatusoutput(cmnd)
+ writeLog("Openvpn1 Status : " + str(output))
+ stats["vpnclient1"] = output
+ cmnd = "nvram get vpn_client2_state"
+ status, output = subprocess.getstatusoutput(cmnd)
+ writeLog("Openvpn2 Status : " + str(output))
+ stats["vpnclient2"] = output
+ cmnd = "ncat -z 192.168.77.106 25"
+ status, output = subprocess.getstatusoutput(cmnd)
+ if status == 0:
+ stats["mail_nas"] = "available"
+ else:
+ stats["mail_nas"] = "unavailable"
+ cmnd = "ncat -z 192.168.77.246 25"
+ status, output = subprocess.getstatusoutput(cmnd)
+ if status == 0:
+ stats["mail_rasp"] = "available"
+ else:
+ stats["mail_rasp"] = "unavailable"
+ cmnd = "nvram get vts_rulelist"
+ status, output = subprocess.getstatusoutput(cmnd)
+ rule_data = output.split("<")
+ serv_d = {}
+ for l in rule_data:
+ rul = l.split(">")
+ if len(rul) > 3:
+ if rul[0] == "HTTPS":
+ serv_d[rul[0]] = {"src_port":rul[1],"dest_ip":rul[2],"dest_port":rul[3],"prot":rul[4]}
+ stats["serv_dest"] = rul[2]
+ break
+ #stats["serv_dest"] = json.dumps(serv_d)
+ #stats["serv_dest"] = json.dumps(serv_d)
+ #out = subprocess.Popen(cmnd.split())
+ #status, output = subprocess.getstatusoutput(cmnd)
+
+
+ '''
+
+
+ print("Getting fw info")
+ cmnd = "/root/router_cmd.sh -t firewall -n TOSHIBA-WIFI -m get"
+ #out = subprocess.Popen(cmnd.split())
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ stats["fw"] = output
+ #client.publish("sectorq/systems/router/fw", payload=str(output), qos=0, retain=True)
+ print("Getting wifi info")
+ cmnd = "/root/router_cmd.sh -t wireless -m get"
+ #out = subprocess.Popen(cmnd.split())
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ if output != 'allow':
+ output = 'off'
+ stats["macfilter"] = output
+ # if output == "allow":\
+ writeLog("Payload : " + str(json.dumps(stats)))
+ '''
+ client.publish("home-assistant/router/hwstats", json.dumps(stats), qos=0, retain=True)
+ #client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=True)
+ #else:
+ # client.publish("sectorq/systems/router/macfilter", payload=0, qos=0, retain=True)
+
+if host != "router" and host != "nas":
+ import psutil
+
+ processes = list(p.name() for p in psutil.process_iter())
+ # print(processes)
+ count = processes.count("mqtt_srv.exe")
+ if int(count) >= 3:
+ writeLog("script exist")
+ sys.exit()
+else:
+ cmnd = "ps |grep mqtt_srv.py|grep -v grep |wc -l"
+ status, output = subprocess.getstatusoutput(cmnd)
+ count = output
+ if int(count) >= 2:
+ writeLog("script exist")
+ sys.exit()
+# Stops duplicate instance from running
+
+writeLog(count)
+
+writeLog("Starting : " + str(VERSION))
+writeLog("Getting running proccesses", "DEBUG")
+
+
+writeLog("done", "DEBUG")
+
+FILE_TIMESTAMP = os.path.getmtime(sys.argv[0])
+def get_sys_env(name):
+ key = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, r"System\CurrentControlSet\Control\Session Manager\Environment")
+ return winreg.QueryValueEx(key, name)[0]
+
+def get_user_env(name):
+ key = winreg.CreateKey(winreg.HKEY_CURRENT_USER, r"Environment")
+ return winreg.QueryValueEx(key, name)[0]
+
+
+_PUBLISH = _SETVAR = False
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "Sspmt:", ["command=", "help", "output="])
+except getopt.GetoptError as err:
+ # print help information and exit:
+ print(str(err)) # will print something like "option -a not recognized"
+ #usage()
+ sys.exit(2)
+output = None
+# QJ : getopts
+
+for o, a in opts:
+ if o == "-d":
+ _ACTION = True
+ elif o in ("-p", "--publish"):
+ _PUBLISH = True
+ elif o in ("-m", "--publish"):
+ _MESSAGE = a
+ elif o in ("-t", "--publish"):
+ _TOPIC = a
+ elif o in ("-S", "--setvar"):
+ _SETVAR = True
+ _THR_NAME = sys.argv[2]
+ _THR_VAL = sys.argv[3]
+ else:
+ _WIZZARD = True
+MQTT_HOST = "192.168.77.106"
+MQTT_PORT = 1883
+
+if _PUBLISH:
+ # generate client ID with pub prefix randomly
+ #client_id = f'python-mqtt-{random.randint(0, 1000)}'
+ client_id = 'python-mqtt-1004'
+ username = 'jaydee'
+ password = 'jaydee1'
+
+ def connect_mqtt():
+ def on_connect(client, userdata, flags, rc):
+ if rc == 0:
+ print("Connected to MQTT Broker!")
+ else:
+ print("Failed to connect, return code %d\n", rc)
+
+ client = mqtt.Client(client_id)
+ client.username_pw_set(username, password)
+ client.on_connect = on_connect
+ client.connect(MQTT_HOST, MQTT_PORT)
+ return client
+
+
+ def publish(client):
+ result = client.publish(_TOPIC, _MESSAGE)
+ # result: [0, 1]
+ status = result[0]
+ if status == 0:
+ print(f"Send `{_MESSAGE}` to topic `{_TOPIC}`")
+ else:
+ print(f"Failed to send message to topic {_TOPIC}")
+
+ client = connect_mqtt()
+ publish(client)
+ sys.exit()
+
+if _SETVAR:
+ #myCmd = "setx " + _THR_NAME + " " + _THR_VAL + " -m"
+ myCmd = "setx " + _THR_NAME + " " + _THR_VAL
+ subprocess.Popen(myCmd.split(), shell=True)
+ sys.exit()
+
+from ping3 import ping, verbose_ping
+
+
+
+
+'''
+curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
+python get-pip.py
+pip3 install getmac
+pip3 install paho.mqttdasdas
+"""
+
+'''
+
+writeLog("Starting daemon in versin : " + VERSION)
+
+VERS = '1.3'
+'''
+print("pinging")
+lala = ping(MQTT_HOST)
+
+connected = 0
+while connected == 0:
+ if type(lala) == float:
+ print("Oleee connected")
+ writeLog("Mqtt connected", "INFO")
+ connected = 1
+ else:
+ print("blaaah not connected, waiting...(5)")
+ writeLog("blaaah not connected, waiting...(5)")
+ time.sleep(5)
+ lala = ping(MQTT_HOST)
+'''
+
+# Function to display hostname and
+# IP address
+def get_ip():
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ try:
+ # doesn't even have to be reachable
+ s.connect(('192.168.77.1', 1))
+ IP = s.getsockname()[0]
+ except ValueError:
+ IP = '127.0.0.1'
+ finally:
+ s.close()
+ return IP
+
+
+IP = get_ip()
+
+
+print("OS : " + curos)
+writeLog("OS : " + curos)
+if curos != "Windows":
+ import autorandr
+else:
+ import winreg
+
+
+if host == "raspberrypi":
+ mac = str(get_mac_address("eth0"))
+elif host == "SERVER":
+ mac = str(get_mac_address("enp2s0"))
+elif host == "ASUS" and curos != "Windows":
+ mac = str(get_mac_address("enp3s0f1"))
+else:
+ mac = str(get_mac_address("Ethernet"))
+
+
+print("MAC : " + mac)
+writeLog("MAC : " + mac)
+print("SYSTEM : " + host)
+writeLog("SYSTEM : " + host)
+print("IP : " + IP)
+writeLog("IP : " + IP)
+
+flag_connected = 0
+# The callback for when the client receives a CONNACK response from the server.
+def on_connect(client, userdata, flags, rc):
+ print("Connected with result code " + str(rc))
+ writeLog("Connected with result code " + str(rc))
+ global flag_connected
+ flag_connected = 1
+ # Subscribing in on_connect() means that if we lose the connection and
+ # reconnect then subscriptions will be renewed.
+ topic = "sectorq/systems/" + host.lower()
+ print(topic)
+ writeLog(topic)
+ time.sleep(1)
+ client.publish("sectorq/status", payload="{'action':'connect', 'system':'" + host.lower() + "', 'ip': '" + IP + "', 'mac':'" + mac + "', 'ver':'" + VERS + "'}", qos=0, retain=False)
+ client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
+ if host.lower() == "router":
+ check_router()
+
+ if host.lower() == "nas":
+ print("Getting VM info")
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh list --all"
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ l = 1
+ lines = output.splitlines()
+ VMS = {}
+ for i in lines:
+ l = l + 1
+ if l < 4:
+ continue
+ line = re.split(r" {2,}", i)
+ print(str(line[0].strip()) + " " + str(line[1].strip()) + " " + str(line[2].strip()))
+ VMS[str(line[1].strip())] = str(line[2].strip())
+
+
+
+ for m in VMS:
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + m
+ #out = subprocess.Popen(cmnd.split())
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ if output.strip() == "running":
+ client.publish("sectorq/systems/nas/" + m, payload=1, qos=0, retain=True)
+ else:
+ client.publish("sectorq/systems/nas/" + m, payload=0, qos=0, retain=True)
+
+
+ client.subscribe(topic)
+
+def on_disconnect(client, userdata, rc):
+ print("disconnecting reason " +str(rc))
+ writeLog("disconnecting reason " +str(rc))
+ client.connected_flag=False
+ client.disconnect_flag=True
+ global flag_connected
+ flag_connected = 0
+
+
+# The callback for when a PUBLISH message is received from the server.
+def on_message(client, userdata, msg):
+ print(msg.topic)
+ print(msg.payload)
+ myObj = msg.payload.decode('utf-8')
+ # command = re.sub(r"^b\'|\'$", "", str(msg.payload))
+ # command = json.loads(msg.payload.decode("utf-8"))
+ try:
+ myObj = json.loads(msg.payload)
+ try:
+ writeLog(myObj["action"])
+ print(myObj["action"])
+ except:
+ print("Action not set")
+ writeLog("Action not set", "WARNING")
+
+ try:
+ print(myObj["cmd"])
+ writeLog(myObj["cmd"])
+ except:
+ print("Cmd not set")
+ writeLog("Cmd not set", "WARNING")
+
+ try:
+ print(myObj["target"])
+ writeLog(myObj["target"])
+ except:
+ print("Target Not Set")
+ writeLog("Target Not Set", "WARNING")
+ try:
+ print(myObj["status"])
+ writeLog(myObj["status"])
+ except:
+ print("Status Not Set")
+ writeLog("Status Not Set")
+
+ try:
+ print(myObj["command"])
+ writeLog(myObj["command"])
+ except:
+ print("Command Not Set")
+ writeLog("Command Not Set")
+
+ try:
+ print(myObj["cmd_line"])
+ writeLog(myObj["cmd_line"])
+ except:
+ print("Cmd_line Not Set")
+ writeLog("Cmd_line Not Set")
+
+
+ if myObj["cmd"] == "command":
+
+ print("Executing " + myObj["cmd_line"])
+ writeLog("Executing " + myObj["cmd_line"])
+ #os.system('start /b "' + myObj["cmd_line"] + '"')
+ try:
+ subprocess.Popen(myObj["cmd_line"].split(), shell=True)
+ #subprocess.Popen(myObj["cmd_line"].split())
+ # ctypes.windll.user32.MessageBoxW(0, myObj["cmd_line"], "Executed", 64)
+ except:
+ ctypes.windll.user32.MessageBoxW(0, "Your text", "Your title", 16)
+ print("Executed " + myObj["cmd_line"])
+ writeLog("Executed " + myObj["cmd_line"])
+
+ if myObj["cmd"] == "nas_cmd":
+ print("Executing NAS")
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + str(myObj["target"])
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ cmd_type = myObj["command"]
+ if myObj["command"] == "start":
+ if output.strip() == "paused":
+ print("System suspended")
+ cmd_type = "resume"
+ else:
+ print("System Off")
+ cmd_type = "start"
+ if myObj["command"] == "suspend":
+ cmd_type = "shutdown"
+
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh " + cmd_type + " " + str(myObj["target"])
+ subprocess.Popen(cmnd.split())
+ print(cmnd)
+ if myObj["command"] == "start":
+ try:
+ print("sending")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload=1, qos=0, retain=False)
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload="failed", qos=0, retain=False)
+ else:
+ try:
+ print("sending")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload=0, qos=0, retain=False)
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/nas/" + str(myObj["target"]), payload="failed", qos=0, retain=False)
+
+
+ if myObj["cmd"] == "distrib":
+ print("distributin313g")
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ subprocess.Popen(['/bin/systemctl', 'restart', 'mqtt'])
+
+ if myObj["cmd"] == "uci":
+ print("uci1")
+ print("Executing " + myObj["cmd_line"])
+ writeLog("Executing " + myObj["cmd_line"])
+
+ if myObj["cmd_line"] == "wireless1":
+ cmnd = "/root/router_cmd.sh -t wireless -v 1 -m set"
+ try:
+ subprocess.Popen(cmnd.split())
+ print("sending")
+ stats["macfilter"] = "allow"
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+
+ elif myObj["cmd_line"] == "wireless0":
+ cmnd = "/root/router_cmd.sh -t wireless -v 0 -m set"
+ try:
+ subprocess.Popen(cmnd.split())
+ print("sending")
+ stats["macfilter"] = "off"
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+ elif myObj["cmd_line"] == "fw0":
+ cmnd = "/root/router_cmd.sh -t firewall -n TOSHIBA-WIFI -p enabled -v 0 -m set"
+ try:
+ subprocess.Popen(cmnd.split())
+ print("sending")
+ stats["fw"] = 0
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+ elif myObj["cmd_line"] == "fw1":
+ cmnd = "/root/router_cmd.sh -t firewall -n TOSHIBA-WIFI -p enabled -v 1 -m set"
+ try:
+ #subprocess.Popen(myObj["cmd_line"].split(), shell=True)
+ subprocess.Popen(cmnd.split())
+ # ctypes.windll.user32.MessageBoxW(0, myObj["cmd_line"], "Executed", 64)
+ print("sending")
+ stats["fw"] = 1
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=False)
+ writeLog("Payload : " + json.dumps(stats))
+ except:
+ print("failed to execute!")
+ client.publish("sectorq/systems/router/stats", payload="failed", qos=0, retain=False)
+ elif myObj["cmd_line"] == "openvpn":
+ cmnd = "service {}".format(myObj["target"])
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ elif myObj["cmd_line"] == "serv_dest":
+ writeLog("Payload111111 : " + myObj["target"].lower())
+
+ cmnd = "nvram get vts_rulelist"
+ status, output = subprocess.getstatusoutput(cmnd)
+ rule_data = output.split("<")
+ serv_d = {}
+ writeLog("Payload111112")
+ for l in rule_data:
+ rul = l.split(">")
+ if len(rul) > 3:
+ serv_d[rul[0]] = {"src_port":rul[1],"dest_ip":rul[2],"dest_port":rul[3],"prot":rul[4]}
+ stats["serv_dest"] = rul[2]
+ writeLog("Payload111113")
+ rules = {"HTTPS":{"dest_ip":"192.168.77.106","src_port":443,"dest_port":443,"prot":"TCP"},
+ "HTTP":{"dest_ip":"192.168.77.106","src_port":80,"dest_port":80,"prot":"TCP"},
+ "EMAIL_25":{"dest_ip":"192.168.77.106","src_port":25,"dest_port":25,"prot":"TCP"},
+ "EMAIL_465":{"dest_ip":"192.168.77.106","src_port":465,"dest_port":465,"prot":"TCP"},
+ "EMAIL_993":{"dest_ip":"192.168.77.106","src_port":993,"dest_port":993,"prot":"TCP"},
+ "EMAIL_995":{"dest_ip":"192.168.77.106","src_port":995,"dest_port":995,"prot":"TCP"},
+ "EMAIL_587":{"dest_ip":"192.168.77.106","src_port":587,"dest_port":587,"prot":"TCP"},
+ "EMAIL_143":{"dest_ip":"192.168.77.106","src_port":143,"dest_port":143,"prot":"TCP"}}
+ writeLog("Payload1111135")
+ print(json.dumps(serv_d))
+ for r in rules:
+ print(r)
+ try:
+ serv_d[r]["dest_ip"] = myObj["target"]
+ except:
+ serv_d[r] = rules[r]
+
+ lala = []
+ for sr in serv_d:
+ lala.append("{}>{}>{}>{}>{}>".format(sr,serv_d[sr]["src_port"],serv_d[sr]["dest_ip"],serv_d[sr]["dest_port"],serv_d[sr]["prot"]))
+ la = "<".join(lala)
+ la = "<{}".format(la)
+ print(la)
+ cmnd = "nvram set vts_rulelist=\"{}\"".format(la)
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ cmnd = "nvram commit"
+ status, output = subprocess.getstatusoutput(cmnd)
+ cmnd = "service restart_firewall"
+ status, output = subprocess.getstatusoutput(cmnd)
+ writeLog("Payload111114")
+ writeLog(output)
+ print(json.dumps(serv_d))
+ '''
+ if myObj["target"].lower() == "192.168.77.246":
+ dest_ip = "192.168.77.246"
+ elif myObj["target"].lower() == "192.168.77.106":
+ dest_ip = "192.168.77.106"
+
+
+
+
+ RULES = ["EMAIL993", "EMAIL995", "EMAIL143", "EMAIL25", "EMAIL993", "EMAIL465", "HTTPS", "HTTP"]
+ for i in RULES:
+ cmnd = "uci set firewall.{}.dest_ip={}".format(i,dest_ip)
+ writeLog(cmnd)
+ subprocess.Popen(cmnd.split())
+
+ #cmnd = "uci set dhcp.@dnsmasq[0].address=/mqtt_broker/" + dest_ip
+ #writeLog(cmnd)
+ #subprocess.Popen(cmnd.split())
+ time.sleep(1)
+ cmnd = "uci commit"
+
+ subprocess.Popen(cmnd.split())
+
+ writeLog("Starting " + myObj["target"].lower())
+ if myObj["target"].lower() == "192.168.77.246":
+ dest_ip = "192.168.77.246"
+
+
+ cmnd = "ssh root@192.168.77.246 'docker start mailu_resolver_1 mailu_redis_1 mailu_front_1 mailu_antispam_1 mailu_imap_1 mailu_admin_1 mailu_smtp_1 mailu_webmail_1 watchtower_watchtower_1 nginx-proxy-manager_db_1 nginx-proxy-manager_app_1 HomeAssistant webhub_client_1 dockermon_docker_mon_1 mosquitto_mosquitto_1 node-red_node-red_1 nextcloud_db_1 nextcloud_app_1'"
+ status, output = subprocess.getstatusoutput(cmnd)
+ elif myObj["target"].lower() == "192.168.77.106":
+ dest_ip = "192.168.77.106"
+ cmnd = "ssh root@192.168.77.246 'docker stop mailu_resolver_1 mailu_redis_1 mailu_front_1 mailu_antispam_1 mailu_imap_1 mailu_admin_1 mailu_smtp_1 mailu_webmail_1 watchtower_watchtower_1 nginx-proxy-manager_db_1 nginx-proxy-manager_app_1 HomeAssistant webhub_client_1 dockermon_docker_mon_1 mosquitto_mosquitto_1 node-red_node-red_1 nextcloud_db_1 nextcloud_app_1'"
+ status, output = subprocess.getstatusoutput(cmnd)
+ time.sleep(1)
+ cmnd = "/etc/init.d/firewall restart"
+ subprocess.Popen(cmnd.split())
+ #cmnd = "/etc/init.d/dnsmasq restart"
+ #subprocess.Popen(cmnd.split())
+ writeLog("reconfigure iot")
+ MQTT_BROKER = dest_ip
+ MQTT_USER = "jaydee"
+ MQTT_PASS = "jaydee1"
+
+ cmnd = "nmap -sP 192.168.77.*|grep \"Nmap scan report\"|egrep -o \"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\""
+ #print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ # print(output)
+
+ ips = output.splitlines()
+ tasm_data = {}
+ for sys_ip in ips:
+ # print("Thsis is ip : " + sys_ip)
+ cmnd = "nmap " + sys_ip + " -p80|grep \"80/tcp open http\""
+ status, output = subprocess.getstatusoutput(cmnd)
+ # print("status of 80 : " + str(status))
+ if status == 0:
+ try:
+ # url = "http://" + sys_ip + "/cm?user=admin&password=l4c1j4yd33Du5l0&cmnd=STATUS+5"
+
+ url = "http://" + sys_ip + "/cm?cmnd=Backlog%20MqttHost%20" + MQTT_BROKER + "%3BMqttUser%20" + MQTT_USER + "%3BMqttPassword%20" + MQTT_PASS
+ print(url)
+ requests.get(url)
+
+ except:
+ #print(sys_ip + " : Not a tasmota!")
+ pass
+ else:
+ #print(sys_ip + " : Not a listening")
+ pass
+
+
+
+ time.sleep(1)
+ cmnd = "sed -i 's/^MQTT_HOST = .*/MQTT_HOST = \"" + dest_ip + "\"/' /root/mqtt_srv.py"
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ #for i in ;do uci set firewall.${i}.dest_ip=192.168.77.246;done;uci set firewall.HTTPS.dest_port='443';uci set firewall.HTTP.dest_port='80' ;uci commit;/etc/init.d/firewall restart
+ else:
+ pass
+ #cmnd = "/root/router_cmd.sh -t wireless -v 0"
+
+
+ print("Executed " + cmnd)
+ writeLog("Executed " + cmnd)
+ '''
+
+
+ if myObj["cmd"] == "banip":
+ if myObj["status"] == "ban":
+ cmnd = "echo " + str(myObj["target"]) + " >> /etc/banip/banip.blacklist; /etc/init.d/banip refresh"
+ elif myObj["status"] == "enable":
+ cmnd = "/etc/init.d/banip resume"
+ stats["banip"] = "enabled"
+ elif myObj["status"] == "disable":
+ cmnd = "/etc/init.d/banip suspend"
+ stats["banip"] = "paused"
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=True)
+
+ if myObj["cmd"] == "vnc":
+ print(myObj["target"])
+ writeLog(myObj["target"])
+
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ myCmd = 'c:\\Program Files\\RealVNC\\VNC Viewer\\vncviewer.exe C:\\Users\\jaydee\\' + myObj["target"].upper() + '.vnc'
+ print(myCmd)
+ writeLog(myCmd)
+ subprocess.Popen(myCmd.split())
+ if myObj["cmd"] == "getstats":
+ print("lalaa1")
+ try:
+ client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":" + get_user_env('mb_temp') + ",\"mem_usage\":" + get_user_env('mem_usage') + ",\"cpu_temp\":" + get_user_env('cpu_temp') + ",\"cpu_usage\":" + get_user_env('cpu_usage') + ",\"gpu_temp\":" + get_user_env('gpu_temp') + ",\"gpu_usage\":" + get_user_env('gpu_usage') + "}", qos=0, retain=False)
+ print("ok")
+ except:
+ print("failed")
+ client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
+
+ print("lalaa2")
+
+ if myObj["cmd"] == "display":
+ if curos == "Windows1":
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ #print("reconfigure")
+ myCmd = 'MonitorSwitcher.exe -load:' + myObj["target"] + '.xml'
+ writeLog(myCmd)
+ #writeLog(os.path.realpath(__file__))
+ print("lalaa2")
+ #subprocess.Popen(r'"{}"'.format(myCmd), shell=True)
+ print("lalaa3")
+ subprocess.Popen(myCmd.split(), shell=True,cwd=r'c:\Progra~1\jaydee')
+ else:
+ '''
+ myCmd = ""
+ if myObj["target"] == "mid":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --off --output eDP-1 --off"
+ elif myObj["target"] == "all":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-2 --mode 1920x1080 --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --auto --right-of HDMI-2 --mode 1920x1080"
+ elif myObj["target"] == "midleft":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --off"
+ elif myObj["target"] == "midtop":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-2 --mode 1920x1080 --output HDMI-1 --off --output eDP-1 --off"
+ elif myObj["target"] == "midleftbuild":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --auto --right-of HDMI-2 --mode 1920x1080"
+ elif myObj["target"] == "midbuild":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --off --output HDMI-1 --off --output eDP-1 --auto --right-of HDMI-2 --mode 1920x1080"
+ elif myObj["target"] == "midlefttop":
+ myCmd = "xrandr --output HDMI-2 --primary --auto --mode 1920x1080 --output DVI-I-2-1 --auto --above HDMI-2 --mode 1920x1080 --output HDMI-1 --auto --left-of HDMI-2 --mode 1920x1080 --output eDP-1 --off"
+ else:
+ pass
+
+ if myCmd != "":
+ print(myCmd)
+ subprocess.Popen(myCmd.split())
+ '''
+ myCmd = ""
+ writeLog(myObj["target"])
+ if curos == "Windows":
+ if myObj["target"] == "mid":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile mid"
+ elif myObj["target"] == "all":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile all"
+ elif myObj["target"] == "left":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile left"
+ elif myObj["target"] == "midleft":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midleft"
+ elif myObj["target"] == "midtop":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midtop"
+ elif myObj["target"] == "midleftbuild":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midleftbuild"
+ elif myObj["target"] == "midbuild":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midbuild"
+ elif myObj["target"] == "midlefttop":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midlefttop"
+ elif myObj["target"] == "build":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile build"
+ elif myObj["target"] == "midtopbuild":
+ myCmd = "DisplayFusionCommand.exe -monitorloadprofile midtopbuild"
+ else:
+ pass
+ else:
+ '''
+ mon1 = "HDMI-1-1"
+ mon2 = "HDMI-1-2"
+ mon3 = "DVI-I-2-1"
+ mon4 = "eDP-1-1"
+ '''
+ mon1 = "HDMI-1"
+ mon2 = "HDMI-2"
+ mon3 = "DVI-I-2-1"
+ mon4 = "eDP-1"
+
+ if myObj["target"] == "mid":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " +mon1 + " --off --output " + mon4 + " --off"
+ elif myObj["target"] == "left":
+ myCmd = "xrandr --output " + mon1 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " +mon2 + " --off --output " + mon4 + " --off"
+
+ elif myObj["target"] == "all":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --auto --right-of " + mon2 + " --mode 1920x1080 --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --auto --right-of " + mon2 + " --mode 1920x1080"
+ elif myObj["target"] == "midleft":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --off"
+ elif myObj["target"] == "midtop":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --auto --right-of " + mon2 + " --mode 1920x1080 --output " + mon1 + " --off --output " + mon4 + " --off"
+ elif myObj["target"] == "midleftbuild":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --auto --right-of " + mon2 + " --mode 1920x1080"
+ elif myObj["target"] == "midbuild":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --off --output " + mon1 + " --off --output " + mon4 + " --auto --right-of " + mon2 + " --mode 1920x1080"
+ elif myObj["target"] == "midlefttop":
+ myCmd = "xrandr --output " + mon2 + " --primary --auto --mode 1920x1080 --output " + mon3 + " --auto --right-of " + mon2 + " --mode 1920x1080 --output " + mon1 + " --auto --left-of " + mon2 + " --mode 1920x1080 --output " + mon4 + " --off"
+ elif myObj["target"] == "build":
+ myCmd = "xrandr --output " + mon2 + " --off --output " + mon3 + " --off --output " + mon1 + " --off --output " + mon4 + " --auto --mode 1920x1080"
+ else:
+ pass
+
+ writeLog(myCmd)
+ if myCmd != "":
+ print(myCmd)
+ subprocess.Popen(myCmd.split())
+
+ if myObj["cmd"] == "display2":
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ #print("reconfigure")
+ subprocess.Popen(['MultiMonitorTool.exe', '/SaveConfig', 'c:\\Program Files\\jaydee\\switcher.cfg'])
+ myCmd = "powershell switcher.ps1 " + str(myObj["target"]) + " " + str(myObj["status"])
+ writeLog(myCmd)
+ subprocess.Popen(myCmd.split())
+ time.sleep(1)
+ subprocess.Popen(['MultiMonitorTool.exe', '/LoadConfig', 'c:\\Program Files\\jaydee\\switcher.cfg'])
+ client.publish("sectorq/feedback", payload='{"action":"resp", "source":"ASUS", "dev":{"display' + str(myObj["target"]) + '":'+ str(myObj["status"]) +'} }' , qos=0, retain=False)
+ if myObj["cmd"] == "displ":
+ print("Display")
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ subprocess.Popen(['/usr/bin/xrandr', '--output', 'HDMI-1-1', '--off'])
+
+ if myObj["cmd"] == "xrandr":
+ if curos == "Windows":
+ subprocess.Popen(['MultiMonitorTool.exe', '/LoadConfig', 'c:\\Program Files\\jaydee\\all_on.cfg'])
+ else:
+ print("Display")
+ # os.startfile(sys.argv[0])
+ #sys.exit()
+ os.system("export DISPLAY=:0")
+ subprocess.Popen(['/usr/bin/xrandr'])
+
+ if myObj["cmd"] == "suspend":
+ print("suspending")
+ if curos == "Windows":
+ if host == "amd" or host == "amd1":
+ os.system("shutdown /s /t 1")
+ else:
+ os.system("rundll32.exe powrprof.dll,SetSuspendState 0,1,0")
+ #cmnd = "psshutdown -d -t 1"
+ writeLog(cmnd)
+ #status, output = subprocess.getstatusoutput(cmnd)
+ #subprocess.Popen(["psshutdown", "-d", "-t", "1"])
+ #writeLog(output)
+ else:
+ if host == "nas" or host == "octopi":
+ subprocess.Popen(["/sbin/poweroff"])
+ elif host == "openmediavault" or host == "omv":
+ subprocess.Popen(["poweroff"])
+ else:
+ #subprocess.Popen(["/bin/systemctl", "suspend", "-i"])
+ #subprocess.Popen(["sudo", "pm-suspend"])
+ cmnd = "pm-suspend"
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(output)
+ print(status)
+ if myObj["cmd"] == "stats":
+ grep = subprocess.Popen(['grep', 'cpu', '/proc/stat'],
+ stdout=subprocess.PIPE,
+ )
+
+ awk = subprocess.Popen(['awk', '{print ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}'],
+ stdin=grep.stdout,
+ stdout=subprocess.PIPE,
+ )
+
+ # cat <(grep 'cpu ' /proc/stat) <(sleep 1 && grep 'cpu ' /proc/stat) | awk -v RS="" '{print ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)}'
+
+ end_of_pipe = awk.stdout
+
+ for line in end_of_pipe:
+ # print(line.strip())
+ # usage = re.sub(r"^b\'|\'$", "", (line.strip()))
+ cpu = round(float(line.strip().decode("utf-8")))
+ free = subprocess.Popen(['free'],
+ stdout=subprocess.PIPE,
+ )
+
+ grep = subprocess.Popen(['grep', 'Mem'],
+ stdout=subprocess.PIPE,
+ stdin=free.stdout,
+ )
+
+ awk = subprocess.Popen(['awk', '{print $3/$2 * 100.0}'],
+ stdin=grep.stdout,
+ stdout=subprocess.PIPE,
+ )
+
+ end_of_pipe = awk.stdout
+
+ for line in end_of_pipe:
+ # print(line.strip())
+ # mem = re.sub(r"^b\'|\'$", "", (line.strip()))
+ mem = round(float(line.strip().decode("utf-8")))
+ # mem = re.sub(r"^b\'|\'$", "", mem)
+ # cpu = re.sub(r"^b\'|\'$", "", cpu)
+ # print(mem)
+ jn = {"cpu": cpu, "mem": mem}
+ jn = json.dumps(jn)
+ client.publish("sectorq/status/" + host, payload=jn, qos=0, retain=False)
+ except:
+ print("not a json!")
+
+client = mqtt.Client()
+payload = "off"
+client.username_pw_set("jaydee", password="jaydee1")
+client.will_set("sectorq/systems/" + host.lower() + "/stat", payload=payload, qos=0, retain=False)
+client.on_connect = on_connect
+client.on_message = on_message
+writeLog(MQTT_HOST)
+client.connect(MQTT_HOST, MQTT_PORT, 5)
+
+# client.publish("sectorq/status", payload="{'action':'connect', 'system':'" + host + "', 'ip': '" + IP + "', 'mac':'" + mac + "', 'ver':'?'}", qos=0, retain=False)
+
+
+# Blocking call that processes network traffic, dispatches callbacks and
+# handles reconnecting.
+# Other loop*() functions are available that give a threaded interface and a
+# manual interface.
+
+def checkIfProcessRunning(processName):
+ '''
+ Check if there is any running process that contains the given name processName.
+ '''
+ #Iterate over the all the running process
+ for proc in psutil.process_iter():
+ try:
+ # Check if process name contains the given name string.
+ if processName.lower() in proc.name().lower():
+ return True
+ except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
+ pass
+ return False;
+
+
+
+if curos == "Windows":
+ print("WINDOWS")
+ #client.loop_forever()
+ client.loop_start()
+ NEXT_CHECK = 0
+ while True:
+ print("Version: {}".format(VERSION))
+ time.sleep(5)
+ try:
+ mtime = os.path.getmtime(sys.argv[0])
+ except OSError:
+ mtime = 0
+ print(mtime)
+ if NEXT_CHECK < int(time.time()):
+ NEXT_CHECK = int(time.time()) + 10
+ writeLog("Blalala : Next : " + str(NEXT_CHECK))
+ if curos == "Windows":
+ if checkIfProcessRunning("aida64.exe"):
+ aide_refs = {
+ 'TPCHDIO':"MB_TEMP",
+ 'TCPU':'CPU_TEMP',
+ 'SMEMUTI': 'MEM_UTIL',
+ 'SVIRTMEMUTI': 'VMEM_UTIL',
+ 'SCPUUTI': 'CPU_UTIL',
+ 'FCPU': 'FAN_CPU',
+ 'TGPU1DIO': 'GPU_TEMP',
+ 'SGPU1BIUTI': 'GPU_UTIL',
+ 'TMOBO':'MB_TEMP'
+ }
+ #ks = ["TCPU", "TPCHDIO", "SMEMUTI", "SVIRTMEMUTI", "SCPUUTI", "FCPU", "TGPU1DIO", "SGPU1BIUTI"]
+
+
+
+
+ path = winreg.HKEY_CURRENT_USER
+ try:
+ key = winreg.OpenKeyEx(path, r"SOFTWARE\\FinalWire\\AIDA64\\SensorValues")
+ results = {}
+ for k in aide_refs:
+ k2 = "Value." + str(k)
+ try:
+ value = winreg.QueryValueEx(key,k2)
+ print("{} : {}".format(k, value[0]))
+ results[aide_refs[k]] = value[0]
+ except:
+ pass
+ except:
+ print("aida initializing...")
+ results = {}
+
+
+ else:
+ print("CPU Cnt : {}".format(psutil.cpu_count()))
+ print(psutil.virtual_memory())
+ cpu_usage = psutil.cpu_percent(interval=None)
+ swap_data = psutil.swap_memory()
+ print("CPU : {}".format(cpu_usage))
+ mem_data = psutil.virtual_memory()
+ print(mem_data)
+ print(swap_data)
+ print("MEM : {}".format(mem_data.percent))
+ print(psutil.getloadavg())
+ try:
+ print(psutil.sensors_temperatures())
+ except:
+ pass
+ try:
+ print(psutil.sensors_fans())
+ except:
+ pass
+ results = {"MB_TEMP":"NA", "MEM_UTIL":str(mem_data.percent), "CPU_TEMP":"NA", "FAN_CPU":"NA", "VMEM_UTIL":swap_data.percent, "CPU_UTIL":cpu_usage, "GPU_TEMP":"NA", "GPU_UTIL":"NA"}
+ print(json.dumps(results))
+ r = json.dumps(results)
+ #client.publish("home-assistant/" + host + "/hwstats", payload='{"TPCHDIO":"' + str(results["TPCHDIO"]) + '", "SMEMUTI":"' + str(results["SMEMUTI"]) + '", "TCPU":"' + str(results["TCPU"]) + '", "TGPU1DIO":"' + str(results["TGPU1DIO"]) + '", "SGPU1BIUTI":"' + str(results["SGPU1BIUTI"]) + '", "FCPU":"' + str(results["FCPU"]) + '", "SVIRTMEMUTI":"' + str(results["SVIRTMEMUTI"]) + '", "SCPUUTI":"' + str(results["SCPUUTI"]) + '"}', qos=0, retain=False)
+ client.publish("home-assistant/" + host + "/hwstats", payload=r, qos=0, retain=False)
+ #print(json.dumps(stats))
+ #writeLog(json.dumps(stats))
+else:
+ print("Linux")
+ client.loop_start()
+
+ NEXT_CHECK = 0
+ while True:
+ print(VERSION)
+ time.sleep(5)
+ try:
+ mtime = os.path.getmtime(sys.argv[0])
+ except OSError:
+ mtime = 0
+ print(mtime)
+ if NEXT_CHECK < int(time.time()):
+ NEXT_CHECK = int(time.time()) + 20
+ writeLog("Blalala : Next : " + str(NEXT_CHECK))
+
+ if host.lower() == "asus":
+ print(psutil.sensors_temperatures())
+ #print(psutil.sensors_fans())
+ sences = psutil.sensors_temperatures()
+ cpu_data = sences["coretemp"][0]
+ mb_data = sences["acpitz"][0]
+ fan_data = psutil.sensors_fans()["asus"][0]
+ mem_data = psutil.virtual_memory()
+ swap_data = psutil.swap_memory()
+ #cpu_usage = psutil.cpu_percent(interval=1)
+ load1, load5, load15 = psutil.getloadavg()
+ cpu_usage = round((load1/os.cpu_count()) * 100, 1)
+
+ print(mem_data)
+ print(mem_data.percent)
+ print(psutil.disk_usage('/'))
+ #print(psutil.virtual_memory())
+ #print(dict(psutil.virtual_memory()._asdict()))
+ #cmnd = "sensors -j|grep -v \"Can't read\""
+ #status, output = subprocess.getstatusoutput(cmnd)
+ #print(output)
+ #print(type(output))
+ #jn1 = json.loads(output)
+
+ #print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
+ #print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
+ #client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
+ client.publish("home-assistant/" + host + "/hwstats", payload='{"MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":' + str(fan_data.current) + ', "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
+ elif host.lower() == "openmediavault" or host.lower() == "omv":
+ #print(psutil.sensors_temperatures())
+ #print(psutil.sensors_fans())
+ sences = psutil.sensors_temperatures()
+ #print(sences)
+ cpu_data = sences["coretemp"][0]
+ mb_data = sences["acpitz"][0]
+ mem_data = psutil.virtual_memory()
+ swap_data = psutil.swap_memory()
+ #cpu_usage = psutil.cpu_percent(interval=1)
+ load1, load5, load15 = psutil.getloadavg()
+ cpu_usage = round((load1/os.cpu_count()) * 100, 1)
+ print(psutil.getloadavg())
+ print("CPU Util : {}".format(cpu_usage))
+ print(mem_data)
+ print(mem_data.percent)
+ raid_data = psutil.disk_usage('/srv/dev-disk-by-uuid-02fbe97a-cd9a-4511-8bd5-21f8516353ee')
+ #print(psutil.virtual_memory())
+ #print(dict(psutil.virtual_memory()._asdict()))
+ #cmnd = "sensors -j|grep -v \"Can't read\""
+ #status, output = subprocess.getstatusoutput(cmnd)
+ #print(output)
+ #print(type(output))
+ #jn1 = json.loads(output)
+ stat_rsync = subprocess.call(["systemctl", "is-active", "--quiet", "rsync"])
+ if(stat_rsync == 0): # if 0 (active), print "Active"
+ stat_rsync = "on"
+ else:
+ stat_rsync = "off"
+ #sdiskusage = psutil.disk_partitions()
+ disk_usage = raid_data[3]
+ print(disk_usage)
+ sys_uptime = str(datetime.timedelta(seconds=round(time.time() - psutil.boot_time(), 0)))
+ reboot_pending = False
+ if os.path.exists("/var/run/reboot-required"):
+ reboot_pending = True
+ #str(datetime.timedelta(seconds=666))
+ #print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
+ #print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
+ #client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
+ client.publish("home-assistant/" + host + "/hwstats", payload='{"reboot":"' + str(reboot_pending) + '", "uptime":"' + str(sys_uptime) + '", "raid_usage": ' + str(disk_usage) + ',"rsync":"' + str(stat_rsync) +'", "MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":0, "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
+ elif host.lower() == "router":
+ check_router()
+ elif host.lower() == "nas":
+ print("Getting VM info")
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh list --all"
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ l = 1
+ lines = output.splitlines()
+ VMS = {}
+ for i in lines:
+ l = l + 1
+ if l < 4:
+ continue
+ line = re.split(r" {2,}", i)
+ print(str(line[0].strip()) + " " + str(line[1].strip()) + " " + str(line[2].strip()))
+ VMS[str(line[1].strip())] = str(line[2].strip())
+
+
+
+ for m in VMS:
+
+ cmnd = "/share/ZFS530_DATA/.qpkg/QKVM/usr/bin/virsh domstate " + m
+ #out = subprocess.Popen(cmnd.split())
+ writeLog(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ writeLog(output)
+ if output.strip() == "running":
+ client.publish("sectorq/systems/nas/" + m, payload=1, qos=0, retain=True)
+ else:
+ client.publish("sectorq/systems/nas/" + m, payload=0, qos=0, retain=True)
+
+
+ if FILE_TIMESTAMP != mtime:
+ writeLog("Script updated ! restarting...")
+ #os.execv(sys.executable, ['python'] + sys.argv)
+ #os.system("/share/ZFS530_DATA/.qpkg/QPython39/bin/python3 mqtt_srv.py")
+
+ if host.lower() == "nas":
+ sys.stdout.flush()
+ os.execv("/share/ZFS530_DATA/.qpkg/QPython39/bin/python3", sys.argv)
+ if host.lower() == "router":
+ #sys.stdout.flush()
+ sys.exit()
+ #os.execv("/usr/bin/python3", sys.argv)
diff --git a/mqtt_srv.spec b/mqtt_srv.spec
new file mode 100644
index 0000000..e938e66
--- /dev/null
+++ b/mqtt_srv.spec
@@ -0,0 +1,44 @@
+# -*- mode: python ; coding: utf-8 -*-
+
+
+block_cipher = None
+
+
+a = Analysis(
+ ['mqtt_srv.pyw'],
+ pathex=[],
+ binaries=[],
+ datas=[],
+ hiddenimports=[],
+ hookspath=[],
+ hooksconfig={},
+ runtime_hooks=[],
+ excludes=[],
+ win_no_prefer_redirects=False,
+ win_private_assemblies=False,
+ cipher=block_cipher,
+ noarchive=False,
+)
+pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
+
+exe = EXE(
+ pyz,
+ a.scripts,
+ a.binaries,
+ a.zipfiles,
+ a.datas,
+ [],
+ name='mqtt_srv',
+ debug=False,
+ bootloader_ignore_signals=False,
+ strip=False,
+ upx=True,
+ upx_exclude=[],
+ runtime_tmpdir=None,
+ console=False,
+ disable_windowed_traceback=False,
+ argv_emulation=False,
+ target_arch=None,
+ codesign_identity=None,
+ entitlements_file=None,
+)
diff --git a/mqtt_srv.version b/mqtt_srv.version
new file mode 100644
index 0000000..17216fe
--- /dev/null
+++ b/mqtt_srv.version
@@ -0,0 +1,43 @@
+# UTF-8
+#
+# For more details about fixed file info 'ffi' see:
+# http://msdn.microsoft.com/en-us/library/ms646997.aspx
+VSVersionInfo(
+ ffi=FixedFileInfo(
+# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
+# Set not needed items to zero 0.
+filevers=(1, 0, 0, 0),
+prodvers=(1, 0, 0, 0),
+# Contains a bitmask that specifies the valid bits 'flags'r
+mask=0x3f,
+# Contains a bitmask that specifies the Boolean attributes of the file.
+flags=0x0,
+# The operating system for which this file was designed.
+# 0x4 - NT and there is no need to change it.
+OS=0x4,
+# The general type of file.
+# 0x1 - the file is an application.
+fileType=0x1,
+# The function of the file.
+# 0x0 - the function is not defined for this fileType
+subtype=0x0,
+# Creation date and time stamp.
+date=(0, 0)
+),
+ kids=[
+StringFileInfo(
+ [
+ StringTable(
+ u'040904B0',
+ [StringStruct(u'CompanyName', u'Jaydee'),
+ StringStruct(u'FileDescription', u'Jaydee'),
+ StringStruct(u'FileVersion', u'1.0.0'),
+ StringStruct(u'InternalName', u'SVN'),
+ StringStruct(u'LegalCopyright', u'Copyright (c) Jaydee'),
+ StringStruct(u'OriginalFilename', u'mqtt_srv.exe'),
+ StringStruct(u'ProductName', u'Subversion'),
+ StringStruct(u'ProductVersion', u'1.0.0 (r0)')])
+ ]),
+VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
+ ]
+)
\ No newline at end of file
diff --git a/omv_backups copy.py b/omv_backups copy.py
new file mode 100644
index 0000000..258bcc0
--- /dev/null
+++ b/omv_backups copy.py
@@ -0,0 +1,73 @@
+import subprocess
+import time
+import datetime
+
+backups = {
+ "__GITHUB":"admin@192.168.77.106:/share/Data/__GITHUB",
+ "Photo":"admin@192.168.77.106:/share/Photo/Years"
+}
+
+for b in backups:
+ SOURCE_DIR=backups[b]
+ now = datetime.datetime.now()
+ BACKUP_DIR="/srv/dev-disk-by-uuid-02fbe97a-cd9a-4511-8bd5-21f8516353ee/{}".format(b)
+ DATETIME = now.strftime("%Y-%m-%d_%H:%M:%S")
+ BACKUP_PATH="{}/{}".format(BACKUP_DIR, DATETIME)
+ LATEST_LINK="{}/latest".format(BACKUP_DIR)
+
+
+ cmnd = "mkdir -p {}".format(BACKUP_DIR)
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(cmnd)
+
+ #cmnd = "rsync -av --delete {}/ --link-dest {} --exclude=\".cache\" {}".format(SOURCE_DIR, LATEST_LINK, BACKUP_PATH)
+ cmnd = ["rsync", '--info=progress2', "-avz", "--delete", SOURCE_DIR, "--link-dest", LATEST_LINK, "--exclude=\".cache\"", BACKUP_PATH]
+ print(cmnd)
+
+ #run_list = ['rsync', '--info=progress2', '-a', 'src/', 'dest/']
+ # with subprocess.Popen(
+ # cmnd, stdout=subprocess.PIPE, bufsize=1, text=True
+ # ) as process:
+ # for line in iter(p.stdout.readline, b''):
+ # print(line.strip())
+
+
+
+ process = subprocess.Popen(cmnd,
+ stdout=subprocess.PIPE)
+
+ while process.poll() is None:
+ line = process.stdout.readline()
+ l = line.splitlines()
+ i = -1
+ a = len(l)
+ #print(l[-1])
+ time.sleep(3)
+ print(len(l))
+ while True:
+ for line in reversed(l):
+ print(len(line.split()))
+ e = str(line).split()
+ if len(e) > 4:
+ print(e[2])
+ print(line)
+ break
+ break
+
+ # print(l[-1])
+ # #print(str(line))
+ # time.sleep(3)
+ #print(cmnd)
+ #status, output = subprocess.getstatusoutput(cmnd)
+ # rsync -av --delete \
+ # "${SOURCE_DIR}/" \
+ # --link-dest "${LATEST_LINK}" \
+ # --exclude=".cache" \
+ # "${BACKUP_PATH}"
+ cmnd = "rm -rf {}".format(LATEST_LINK)
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ cmnd = "ln -s {} {}".format(BACKUP_PATH, LATEST_LINK)
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
\ No newline at end of file
diff --git a/omv_backups.py b/omv_backups.py
new file mode 100644
index 0000000..3bcb8c8
--- /dev/null
+++ b/omv_backups.py
@@ -0,0 +1,138 @@
+import datetime
+import logging
+from paho.mqtt import client as mqtt_client
+import getopt
+import json
+import time
+import subprocess
+import sys
+import os
+pid = os.getpid()
+
+
+cmnd = "ps -ef|grep omv_backups.py|grep -v grep |grep -v {}|wc -l".format(pid)
+status, output = subprocess.getstatusoutput(cmnd)
+
+print(output)
+if int(output) > 0:
+ print("Running already!")
+ sys.exit()
+broker = '192.168.77.106'
+port = 1883
+topic_sum = "sectorq/omv/backups"
+mqtt_username = 'jaydee'
+mqtt_password = 'jaydee1'
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "am", ["command=", "help", "output="])
+except getopt.GetoptError as err:
+ #usage()
+ sys.exit(2)
+output = None
+# QJ : getopts
+_MODE = "manual"
+for o, a in opts:
+ if o == "-a":
+ _MODE = "auto"
+ elif o in ("-m", "--manual"):
+ _MODE = "manual"
+
+
+client = mqtt_client.Client()
+client.username_pw_set(mqtt_username, mqtt_password)
+client.connect(broker,1883,60)
+now = datetime.datetime.now()
+STARTTIME = now.strftime("%Y-%m-%d_%H:%M:%S")
+msg = {"mode":_MODE, "status":"started","bak_name":"complete","start_time":STARTTIME,"end_time":"in progress","progress":0}
+client.publish(topic_sum, json.dumps(msg));
+client.disconnect()
+
+backups = {
+ "github":
+ {"source":"admin@192.168.77.106:/share/Data/__GITHUB",
+ "exclude":"",
+ "active": True
+ },
+ "photo": {
+ "source":"admin@192.168.77.106:/share/Photo/Years",
+ "exclude":"",
+ "active":True
+ },
+ "docker_data":{
+ "source":"admin@192.168.77.106:/share/docker_data/",
+ "exclude":"",
+ "active":True
+ }
+}
+BACKUP_FS = "/srv/dev-disk-by-uuid-02fbe97a-cd9a-4511-8bd5-21f8516353ee"
+for b in backups:
+ topic = "sectorq/omv/backups/{}".format(b.lower())
+ if not backups[b]["active"]:
+ print("Backup {} is not active!".format(b))
+ client.connect(broker,1883,60)
+ msg = {"status":"inactive","bak_name":b,"start_time":"inactive","end_time":"inactive","progress":0}
+
+ client.publish(topic, json.dumps(msg))
+ client.disconnect()
+ continue
+
+ SOURCE_DIR = backups[b]["source"]
+ now = datetime.datetime.now()
+ BACKUP_DIR="/srv/dev-disk-by-uuid-02fbe97a-cd9a-4511-8bd5-21f8516353ee/{}".format(b)
+ DATETIME = now.strftime("%Y-%m-%d_%H:%M:%S")
+ BACKUP_PATH="{}/{}".format(BACKUP_DIR, DATETIME)
+ LATEST_LINK="{}/latest".format(BACKUP_DIR)
+ msg = {"status":"started","bak_name":b,"start_time":DATETIME,"end_time":"in progress", "progress":0}
+ client.connect(broker,1883,60)
+ client.publish(topic, json.dumps(msg));
+ client.disconnect()
+
+ cmnd = "mkdir -p {}".format(BACKUP_DIR)
+ status, output = subprocess.getstatusoutput(cmnd)
+ print(cmnd)
+
+
+ #cmnd = "rsync -av --delete {}/ --link-dest {} --exclude=\".cache\" {}".format(SOURCE_DIR, LATEST_LINK, BACKUP_PATH)
+ cmnd = "rsync --info=progress2 -avz --delete {} --link-dest {} --exclude=\".cache\" --exclude=\".git\" --exclude=\"var_lib_motioneye\" {}".format(SOURCE_DIR, LATEST_LINK, BACKUP_PATH)
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+ cmnd = "rm -rf {}".format(LATEST_LINK)
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ cmnd = "ln -s {} {}".format(BACKUP_PATH, LATEST_LINK)
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+
+ #Remove old
+ print("Removing old dirs")
+
+ #cmnd = "find {} -maxdepth 1 -type d -mtime +30 -exec rm -rf {{}} \;".format(BACKUP_DIR)
+ cmnd = "find {} -maxdepth 1 -type d -mmin +30 -exec rm -rf {{}} \;".format(BACKUP_DIR)
+ print(cmnd)
+ #status, output = subprocess.getstatusoutput(cmnd)
+ now = datetime.datetime.now()
+ ENDTIME = now.strftime("%Y-%m-%d_%H:%M:%S")
+ msg = {"status":"finished","bak_name":b,"start_time":DATETIME,"end_time":ENDTIME,"progress":0}
+ client.connect(broker,1883,10)
+ client.publish(topic, json.dumps(msg))
+ client.disconnect()
+
+print("Getting size of FS")
+cmnd = "du -h --max-depth=0 {}".format(BACKUP_FS)
+status, output = subprocess.getstatusoutput(cmnd)
+used_space = (output.split())[0]
+now = datetime.datetime.now()
+ENDJOB = now.strftime("%Y-%m-%d_%H:%M:%S")
+print("Size : {}".format(used_space))
+print("Sending finished status")
+msg = {"mode":_MODE,"status":"finished","bak_name":"complete","start_time":STARTTIME,"end_time":ENDJOB,"progress":0,"used_space":used_space}
+print(msg)
+client.connect(broker,1883,10)
+client.publish(topic_sum, json.dumps(msg))
+client.disconnect()
+
+if _MODE == "auto":
+ cmnd = "systemctl suspend"
+ status, output = subprocess.getstatusoutput(cmnd)
\ No newline at end of file
diff --git a/python_aida64/__init__.py b/python_aida64/__init__.py
new file mode 100644
index 0000000..5bd9a2a
--- /dev/null
+++ b/python_aida64/__init__.py
@@ -0,0 +1,60 @@
+import mmap
+from xml.etree import ElementTree as ET
+import sys
+
+
+def _readRawData(length):
+ with mmap.mmap(
+ -1, length, # anonymous file
+ tagname='AIDA64_SensorValues',
+ access=mmap.ACCESS_READ) as mm:
+ return mm.read()
+
+
+def _decode(b):
+ for encoding in (sys.getdefaultencoding(), 'utf-8', 'gbk'):
+ try:
+ return b.decode(encoding=encoding)
+ except UnicodeDecodeError:
+ continue
+ return b.decode()
+
+
+def getXmlRawData() -> str:
+ options = [100 * i for i in range(20, 100)] # ranges in [2k, 10k]
+ low = 0
+ high = len(options) - 1
+ while low < high: # [low, high], stops at [low, low]
+ mid = (low + high) // 2 # legit
+ try:
+ length = options[mid]
+ raw = _readRawData(length)
+ if raw[-1] == 0: # legit ending
+ decoded = _decode(raw.rstrip(b'\x00'))
+ return '{}'.format(decoded)
+ else: # not long enough
+ low = mid
+ continue
+ except PermissionError: # illegal length (too long)
+ high = mid
+ continue
+
+
+def getData() -> dict:
+ data = {}
+ tree = ET.fromstring(getXmlRawData())
+
+ for item in tree:
+ if item.tag not in data:
+ data[item.tag] = []
+ data[item.tag].append({
+ key: item.find(key).text
+ for key in ('id', 'label', 'value')
+ })
+ return data
+
+
+__all__ = [
+ 'getXmlRawData',
+ 'getData'
+]
diff --git a/python_aida64/__pycache__/__init__.cpython-310.pyc b/python_aida64/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000..860782a
Binary files /dev/null and b/python_aida64/__pycache__/__init__.cpython-310.pyc differ
diff --git a/python_aida64/__pycache__/__init__.cpython-38.pyc b/python_aida64/__pycache__/__init__.cpython-38.pyc
new file mode 100644
index 0000000..b73768f
Binary files /dev/null and b/python_aida64/__pycache__/__init__.cpython-38.pyc differ
diff --git a/rhasspy_led.py b/rhasspy_led.py
new file mode 100644
index 0000000..db4603e
--- /dev/null
+++ b/rhasspy_led.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+from apa102_pi.driver import apa102
+from time import sleep
+import paho.mqtt.client as mqtt
+import RPi.GPIO as GPIO
+import json
+import os
+
+rhasspyConfig = '/home/jd/.config/rhasspy/profiles/en/profile.json'
+
+counter = 0
+LED = "on"
+mute = "off"
+siteId = ""
+MQTThost = ""
+
+GPIO.setmode(GPIO.BCM)
+GPIO.setup(5, GPIO.OUT)
+GPIO.output(5, GPIO.HIGH)
+
+
+
+
+with open(rhasspyConfig,'r', encoding='UTF-8') as file:
+ obj = json.loads(file.read())
+ MQTTconfig = json.dumps(obj["mqtt"])
+ MQTTconfig = MQTTconfig.replace("\"mqtt\": ","")
+ MQTTconfig = json.loads(MQTTconfig)
+ siteId = MQTTconfig["site_id"]
+ MQTThost = MQTTconfig["host"]
+ MQTThost = MQTThost.strip('"')
+ if "port" in json.dumps(MQTTconfig):
+ MQTTport = MQTTconfig["port"]
+ MQTTport = MQTTport.strip('"')
+ MQTTport = int(MQTTport)
+ else:
+ MQTTport = 1883
+
+strip = apa102.APA102(num_led=12)
+strip.clear_strip()
+
+def on_connect(client, userdata, flags, rc):
+ print("Connected with result code " + str(rc))
+ client.subscribe("hermes/dialogueManager/sessionEnded/#")
+ client.subscribe("hermes/hotword/toggleOff/#")
+ client.subscribe("hermes/asr/stopListening")
+ for i in range(0,12):
+ strip.set_pixel(i,0,127,0,7)
+ strip.show()
+ sleep(2)
+ for i in range(0,12):
+ strip.set_pixel(i,0,255,0,0)
+ strip.show()
+def on_message(client, userdata, msg):
+ jsonData = json.loads(msg.payload)
+ if msg.topic == "hermes/hotword/toggleOff" and jsonData["siteId"] == siteId and LED == "on":
+ for i in range(0,12):
+ strip.set_pixel(i,0,127,0,7)
+ strip.show()
+ elif msg.topic == "hermes/dialogueManager/sessionEnded" and jsonData["siteId"] == siteId:
+ for i in range(0,12):
+ strip.set_pixel(i,0,255,0,0)
+ strip.show()
+
+ elif msg.topic == "hermes/asr/stopListening":
+ for i in range(0,12):
+ strip.set_pixel(i,0,255,0,0)
+ strip.show()
+
+for i in range(0,12):
+ strip.set_pixel(i,0,127,255,7)
+ sleep(0.1)
+ strip.show()
+
+sleep(3)
+
+
+client = mqtt.Client()
+client.username_pw_set("jaydee", password="jaydee1")
+client.on_connect = on_connect
+client.on_message = on_message
+client.connect(MQTThost, MQTTport, 60)
+
+client.loop_forever()
diff --git a/scan_tasmotas.py b/scan_tasmotas.py
new file mode 100644
index 0000000..50e024f
--- /dev/null
+++ b/scan_tasmotas.py
@@ -0,0 +1,172 @@
+import paho.mqtt.client as mqtt
+from getmac import get_mac_address
+import platform
+import socket
+import re
+import subprocess
+import os
+import json
+import sys
+import time
+import json
+import datetime
+import ctypes
+import getopt
+import requests
+CHECK_MARK = "\033[0;32m\xE2\x9C\x94\033[0m"
+_MQTT_SETUP = _BACKUP = _APPLY = _WIFI_SETUP = False
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "wh:bm", ["command=", "help", "output=", "backup"])
+except getopt.GetoptError as err:
+ # print help information and exit:
+ print(str(err)) # will print something like "option -a not recognized"
+ #usage()
+ sys.exit(2)
+output = None
+# QJ : getopts
+
+for o, a in opts:
+ if o == "-h":
+ _ACTION = True
+ elif o in ("-b", "--backup"):
+ _BACKUP = True
+ elif o in ("-m", "--mqtt"):
+ _MQTT_SETUP = True
+ elif o in ("-w", "--wifi"):
+ _WIFI_SETUP = True
+ elif o in ("-a", "--apply"):
+ _APPLY = True
+ else:
+ _WIZZARD = True
+
+
+
+
+def create_backup():
+ cmnd = "nmap -sP 192.168.77.*|grep \"Nmap scan report\"|egrep -o \"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\""
+ print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ print(output)
+ ips = output.splitlines()
+ tasm_data = {}
+ for sys_ip in ips:
+ # print("Thsis is ip : " + sys_ip)
+ cmnd = "nmap " + sys_ip + " -p80|grep \"80/tcp open http\""
+ status, output = subprocess.getstatusoutput(cmnd)
+ # print("status of 80 : " + str(status))
+ if status == 0:
+ try:
+ url = "http://" + sys_ip + "/cm?user=admin&password=l4c1j4yd33Du5l0&cmnd=STATUS+5"
+ resp = requests.get(url)
+ json_str = resp.content.decode('utf-8')
+ tasm_data["StatusNET"] = json.loads(json_str)["StatusNET"]
+ # print(tasm_data)
+ url = "http://" + sys_ip + "/cm?user=admin&password=l4c1j4yd33Du5l0&cmnd=STATUS+2"
+ resp = requests.get(url)
+ json_str = resp.content.decode('utf-8')
+ tasm_data["StatusFWR"] = json.loads(json_str)["StatusFWR"]
+ url = "http://" + sys_ip + "/cm?user=admin&password=l4c1j4yd33Du5l0&cmnd=STATUS+4"
+ resp = requests.get(url)
+ json_str = resp.content.decode('utf-8')
+ tasm_data["StatusMEM"] = json.loads(json_str)["StatusMEM"]
+ print(sys_ip + " : Hostname : " + tasm_data['StatusNET']['Hostname'] + " : Version : " + tasm_data['StatusFWR']["Version"] + " : Memory : " + str(tasm_data["StatusMEM"]["ProgramFlashSize"]))
+
+ # cmnd = "curl \"http://" + sys_ip + "/dl?user=admin&password=l4c1j4yd33Du5l0\" -o ~/tasm_back/" + tasm_data['StatusNET']['Hostname'] + ".bin"
+ #cmnd = "curl \"http://" + sys_ip + "/dl\" -o /media/server/nas-docker-data/_BACKUP/tasmota/" + tasm_data['StatusNET']['Hostname'] + ".bin"
+ # print(cmnd)
+ # status, output = subprocess.getstatusoutput(cmnd)
+
+ url = "http://" + sys_ip + "/dl?user=admin&password=l4c1j4yd33Du5l0"
+ resp = requests.get(url)
+ file = open("/media/nas/nas-data/_BACKUP/tasmota/" + tasm_data['StatusNET']['Hostname'] + "_" + tasm_data['StatusFWR']["Version"] + ".bin", "wb")
+ file.write(resp.content)
+ file.close()
+ print(CHECK_MARK)
+ except:
+ #print(sys_ip + " : Not a tasmota!")
+ pass
+ else:
+ #print(sys_ip + " : Not a listening")
+ pass
+
+
+def wifi_setup():
+ SSID1 = input(">> SID1 ? (default=jaydee) : ") or "jaydee"
+ PASS1 = input(">> PASS1 ? (default=) : ") or ""
+ SSID2 = input(">> SID2 ? (default=smart_home) : ") or "smart_home"
+ PASS2 = input(">> PASS2 ? (default=) : ") or ""
+ cmnd = "nmap -sP 192.168.77.*|grep \"Nmap scan report\"|egrep -o \"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\""
+ #print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ # print(output)
+
+ ips = output.splitlines()
+ for sys_ip in ips:
+
+ print("Thsis is ip : " + sys_ip)
+ cmnd = "nmap " + sys_ip + " -p80|grep \"80/tcp open http\""
+ status, output = subprocess.getstatusoutput(cmnd)
+ # print("status of 80 : " + str(status))
+ if status == 0:
+ try:
+ # url = "http://" + sys_ip + "/cm?user=admin&password=l4c1j4yd33Du5l0&cmnd=STATUS+5"
+ url = "http://" + sys_ip + "/wi?s1=" + SSID1 + "&p1=" + PASS1 + "&s2=" + SSID2 + "&p2=" + PASS2 + "&h=work_lights&save="
+ print(url)
+ if _APPLY:
+ requests.get(url)
+ else:
+ print("Test mode")
+
+ except:
+ #print(sys_ip + " : Not a tasmota!")
+ pass
+ else:
+ #print(sys_ip + " : Not a listening")
+ pass
+
+def mqtt_setup():
+ MQTT_BROKER = input(">> MQTT Broker ? (default=192.168.77.106) : ") or "192.168.77.106"
+ MQTT_USER = input(">> MQTT User ? (default=jaydee) : ") or "jaydee"
+ MQTT_PASS = input(">> MQTT Password ? (default=jaydee1) : ") or "jaydee1"
+
+ cmnd = "nmap -sP 192.168.77.*|grep \"Nmap scan report\"|egrep -o \"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\""
+ #print(cmnd)
+ status, output = subprocess.getstatusoutput(cmnd)
+
+ # print(output)
+
+ ips = output.splitlines()
+ tasm_data = {}
+ for sys_ip in ips:
+ print("Thsis is ip : " + sys_ip)
+ cmnd = "nmap " + sys_ip + " -p80|grep \"80/tcp open http\""
+ status, output = subprocess.getstatusoutput(cmnd)
+ # print("status of 80 : " + str(status))
+ if status == 0:
+ try:
+ # url = "http://" + sys_ip + "/cm?user=admin&password=l4c1j4yd33Du5l0&cmnd=STATUS+5"
+
+ url = "http://" + sys_ip + "/cm?cmnd=Backlog%20MqttHost%20" + MQTT_BROKER + "%3BMqttUser%20" + MQTT_USER + "%3BMqttPassword%20" + MQTT_PASS
+ print(url)
+ if _APPLY:
+ requests.get(url)
+
+ except:
+ #print(sys_ip + " : Not a tasmota!")
+ pass
+ else:
+ #print(sys_ip + " : Not a listening")
+ pass
+
+
+if _BACKUP:
+ create_backup()
+
+
+if _MQTT_SETUP:
+ mqtt_setup()
+
+if _WIFI_SETUP:
+ wifi_setup()
\ No newline at end of file
diff --git a/spotify copy.py b/spotify copy.py
new file mode 100644
index 0000000..8e003d5
--- /dev/null
+++ b/spotify copy.py
@@ -0,0 +1,38 @@
+import spotipy
+from spotipy.oauth2 import SpotifyOAuth
+import time
+
+USERNAME = '...'
+CLIENT_ID = '...'
+CLIENT_SECRET = '...'
+SCOPE = 'user-read-currently-playing'
+
+def create_spotify():
+ auth_manager = SpotifyOAuth(
+ scope='user-read-playback-state',
+ username='jaydee',
+ redirect_uri='https://ha.sectorq.eu/auth/external/callback',
+ client_id='6a37229fc9a04878a608d519ea4b1d22',
+ client_secret='6569f6f876234093983920de2966ff84')
+
+ spotify = spotipy.Spotify(auth_manager=auth_manager)
+
+ return auth_manager, spotify
+
+def refresh_spotify(auth_manager, spotify):
+ token_info = auth_manager.cache_handler.get_cached_token()
+ if auth_manager.is_token_expired(token_info):
+ auth_manager, spotify = create_spotify()
+ return auth_manager, spotify
+
+if __name__ == '__main__':
+ auth_manager, spotify = create_spotify()
+
+ while True:
+ auth_manager, spotify = refresh_spotify(auth_manager, spotify)
+ playing = spotify.currently_playing()
+ if playing:
+ print(playing['item']['name'])
+ else:
+ print('Nothing is playing.')
+ time.sleep(30)
\ No newline at end of file
diff --git a/spotify.py b/spotify.py
new file mode 100644
index 0000000..b5e2029
--- /dev/null
+++ b/spotify.py
@@ -0,0 +1,153 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+import base64
+import datetime
+from urllib.parse import urlencode
+
+import requests
+
+
+
+class SpotifyAPI(object):
+ access_token = None
+ access_token_expires = datetime.datetime.now()
+ access_token_did_expire = True
+ client_id = None
+ client_secret = None
+ token_url = "https://accounts.spotify.com/api/token"
+
+ def __init__(self, client_id, client_secret, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.client_id = client_id
+ self.client_secret = client_secret
+
+ def get_client_credentials(self):
+ """
+ Returns a base64 encoded string
+ """
+ client_id = self.client_id
+ client_secret = self.client_secret
+ if client_secret == None or client_id == None:
+ raise Exception("You must set client_id and client_secret")
+ client_creds = f"{client_id}:{client_secret}"
+ client_creds_b64 = base64.b64encode(client_creds.encode())
+ return client_creds_b64.decode()
+
+ def get_token_headers(self):
+ client_creds_b64 = self.get_client_credentials()
+ return {
+ "Authorization": f"Basic {client_creds_b64}"
+ }
+
+ def get_token_data(self):
+ return {
+ "grant_type": "client_credentials"
+ }
+
+ def perform_auth(self):
+ token_url = self.token_url
+ token_data = self.get_token_data()
+ token_headers = self.get_token_headers()
+ print(token_url)
+ print(token_data)
+ print(token_headers)
+ r = requests.post(token_url, data=token_data, headers=token_headers)
+ if r.status_code not in range(200, 299):
+ raise Exception("Could not authenticate client.")
+ # return False
+ data = r.json()
+ now = datetime.datetime.now()
+ access_token = data['access_token']
+ expires_in = data['expires_in'] # seconds
+ expires = now + datetime.timedelta(seconds=expires_in)
+ self.access_token = access_token
+ self.access_token_expires = expires
+ self.access_token_did_expire = expires < now
+ return True
+
+ def get_access_token(self):
+ token = self.access_token
+ expires = self.access_token_expires
+ now = datetime.datetime.now()
+ if expires < now:
+ self.perform_auth()
+ return self.get_access_token()
+ elif token == None:
+ self.perform_auth()
+ return self.get_access_token()
+ return token
+
+ def get_resource_header(self):
+ access_token = self.get_access_token()
+ headers = {
+ "Authorization": f"Bearer {access_token}",
+ "Accept": "application/json",
+ "Content-Type": "application/json"
+ }
+ return headers
+
+
+ def get_resource(self, lookup_id, resource_type='albums', version='v1'):
+ endpoint = f"https://api.spotify.com/{version}/{resource_type}/{lookup_id}"
+ headers = self.get_resource_header()
+ r = requests.get(endpoint, headers=headers)
+ if r.status_code not in range(200, 299):
+ return {}
+ return r.json()
+
+ def get_album(self, _id):
+ return self.get_resource(_id, resource_type='albums')
+
+ def get_artist(self, _id):
+ return self.get_resource(_id, resource_type='artists')
+
+ def base_search(self, query_params): # type
+ headers = self.get_resource_header()
+ endpoint = "https://api.spotify.com/v1/search"
+ lookup_url = f"{endpoint}?{query_params}"
+ r = requests.get(lookup_url, headers=headers)
+ if r.status_code not in range(200, 299):
+ return {}
+ return r.json()
+
+ def get_devices(self): # type
+ headers = self.get_resource_header()
+ endpoint = "https://api.spotify.com/v1/me/player/devices"
+ lookup_url = f"{endpoint}"
+ print(lookup_url)
+ print(headers)
+ r = requests.get(lookup_url, headers=headers)
+ print(r.status_code)
+ if r.status_code not in range(200, 299):
+ return {}
+ return r.json()
+
+ def search(self, query=None, operator=None, operator_query=None, search_type='artist' ):
+ if query == None:
+ raise Exception("A query is required")
+ if isinstance(query, dict):
+ query = " ".join([f"{k}:{v}" for k,v in query.items()])
+ if operator != None and operator_query != None:
+ if operator.lower() == "or" or operator.lower() == "not":
+ operator = operator.upper()
+ if isinstance(operator_query, str):
+ query = f"{query} {operator} {operator_query}"
+ query_params = urlencode({"q": query, "type": search_type.lower()})
+ print(query_params)
+ return self.base_search(query_params)
+
+
+spotify = SpotifyAPI("6a37229fc9a04878a608d519ea4b1d22","6569f6f876234093983920de2966ff84" )
+
+
+spotify.perform_auth()
+
+print(spotify.access_token)
+print(spotify.access_token_expires)
+
+print(spotify.get_resource_header())
+
+
+
+print(spotify.get_devices())
\ No newline at end of file
diff --git a/sync_nas_rasp.py b/sync_nas_rasp.py
new file mode 100644
index 0000000..81c3f7e
--- /dev/null
+++ b/sync_nas_rasp.py
@@ -0,0 +1,4 @@
+rsync -rP ha/* root@192.168.77.246:/share/docker_data/ha
+
+
+192.168.77.106
\ No newline at end of file
diff --git a/test.py b/test.py
new file mode 100644
index 0000000..8eab3f9
--- /dev/null
+++ b/test.py
@@ -0,0 +1,47 @@
+# Import LCD library
+from RPLCD import i2c
+import psutil
+
+# Import sleep library
+from time import sleep
+
+# constants to initialise the LCD
+lcdmode = 'i2c'
+cols = 20
+rows = 4
+charmap = 'A00'
+i2c_expander = 'PCF8574'
+
+# Generally 27 is the address;Find yours using: i2cdetect -y 1
+address = 0x27
+port = 0 # 0 on an older Raspberry Pi
+
+# Initialise the LCD
+lcd = i2c.CharLCD(i2c_expander, address, port=port, charmap=charmap,
+ cols=cols, rows=rows)
+
+
+while True:
+ myCmd = ""
+ # Write a string on first line and move to next line
+ mem_data = psutil.virtual_memory()
+ net_sum = psutil.net_if_addrs()["eth0"]
+ eth0_ip = (net_sum[0][1])
+ cpu_load = round(psutil.getloadavg(),2)
+ print(cpu_load[0])
+ lcd.backlight_enabled = True
+ lcd.cursor_pos = (0, 0)
+ lcd.write_string('Memory : ' + str(mem_data.percent))
+ lcd.crlf()
+ lcd.write_string('IP : ' + str(eth0_ip))
+ lcd.crlf()
+ lcd.write_string('Phppot')
+ lcd.crlf()
+ lcd.write_string("CPU: " + str(cpu_load))
+ sleep(5)
+ #lcd.clear()
+ # Switch off backlight
+ #lcd.backlight_enabled = False
+ #sleep(3)
+ # Clear the LCD screen
+ #lcd.close(clear=True)
\ No newline at end of file