From f946a9102b2f70aede7cc63812a40e69e9acbb40 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 23 Feb 2017 13:39:07 +0100 Subject: [PATCH 01/50] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d12a8106..6c9a3c3d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -**Codacy - static code analysis:** +## Bitte den beta-Branch auf Fehler testen - Neues Release steht bevor +**Der beta-Branch kann über den normalen Installer mittles dem Flag `-b beta` installiert werden** |branch|quality|CI-Build| |---|---|---| From 29ffd30391735d13d97f52768fa74d55f18af6be Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 30 Mar 2017 21:36:56 +0200 Subject: [PATCH 02/50] edit vers nr --- includes/globalVars.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/globalVars.py b/includes/globalVars.py index bd0cd556..9be0fac0 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,8 +9,8 @@ """ # version info -versionNr = "2.2-beta" -buildDate = "2016/02/23" +versionNr = "2.2" +buildDate = "2017/03/30" # Global variables config = 0 From d6ce41f42be56013fca62e03480a4a2f3fb3c37a Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 30 Mar 2017 21:37:50 +0200 Subject: [PATCH 03/50] edit vers nr --- includes/globalVars.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/globalVars.py b/includes/globalVars.py index bd0cd556..2cdcfa7c 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,8 +9,8 @@ """ # version info -versionNr = "2.2-beta" -buildDate = "2016/02/23" +versionNr = "2.2-dev" +buildDate = "2017/03/30" # Global variables config = 0 From 97f2956bc3f4bcd4bfe3bbd4e1c6cd510336194b Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 4 Apr 2017 22:14:26 +0200 Subject: [PATCH 04/50] Switching mm_raw to off by default As it's mainly for debug-reasons, there is no need to enable the mm_raw-out by default. --- config/config.template.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.template.ini b/config/config.template.ini index be5484b1..6f7f0182 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -49,7 +49,7 @@ doubleFilter_ignore_time = 5 doubleFilter_check_msg = 0 # writes the multimon-ng raw data stream into a text file named mm_raw.txt -writeMultimonRaw = 1 +writeMultimonRaw = 0 [NMAHandler] # you can use a logging handler for sending logging records to NotifyMyAndroid From 7abda0bc509a86fee974aff50275325dcb099187 Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 4 Apr 2017 22:16:28 +0200 Subject: [PATCH 05/50] Delete events Delete events from default-installation and extract them to a separate file --- plugins/MySQL/boswatch.sql | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/plugins/MySQL/boswatch.sql b/plugins/MySQL/boswatch.sql index 8a88c684..6f938610 100644 --- a/plugins/MySQL/boswatch.sql +++ b/plugins/MySQL/boswatch.sql @@ -104,44 +104,6 @@ CREATE TABLE IF NOT EXISTS `bos_signal` ( PRIMARY KEY (`ID`) ) ENGINE=MYISAM DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1; --- -------------------------------------------------------- - --- --- Schedule für Tabelle `bos_pocsag` --- -CREATE EVENT IF NOT EXISTS `Delete POCSAG Entries > 3 Months` - ON SCHEDULE EVERY 1 DAY - STARTS '2016-01-01 00:00:00' - ON COMPLETION PRESERVE ENABLE - DO - DELETE FROM bos_pocsag WHERE time < DATE_SUB(NOW(),INTERVAL 3 MONTH); - --- -------------------------------------------------------- - --- --- Schedule für Tabelle `bos_fms` --- - -CREATE EVENT IF NOT EXISTS `Delete FMS Entries > 3 Months` - ON SCHEDULE EVERY 1 DAY - STARTS '2016-01-01 00:00:00' - ON COMPLETION PRESERVE ENABLE - DO - DELETE FROM bos_fms WHERE time < DATE_SUB(NOW(),INTERVAL 3 MONTH); - --- -------------------------------------------------------- - --- --- Schedule für Tabelle `bos_zvei` --- - -CREATE EVENT IF NOT EXISTS `Delete ZVEI Entries > 3 Months` - ON SCHEDULE EVERY 1 DAY - STARTS '2016-01-01 00:00:00' - ON COMPLETION PRESERVE ENABLE - DO - DELETE FROM bos_zvei WHERE time < DATE_SUB(NOW(),INTERVAL 3 MONTH); - /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; From 7d7c33e2083a8d635606172125e12cbff546ad5b Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 4 Apr 2017 22:17:54 +0200 Subject: [PATCH 06/50] Create boswatch_cleanup.sql Extracted routines to cleanup old database-entries. --- plugins/MySQL/boswatch_cleanup.sql | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 plugins/MySQL/boswatch_cleanup.sql diff --git a/plugins/MySQL/boswatch_cleanup.sql b/plugins/MySQL/boswatch_cleanup.sql new file mode 100644 index 00000000..eb3fcb06 --- /dev/null +++ b/plugins/MySQL/boswatch_cleanup.sql @@ -0,0 +1,40 @@ +-- Cleanup-routines for boswatch-tables + +use boswatch; +-- -------------------------------------------------------- + +-- +-- Schedule für Tabelle `bos_pocsag` +-- +CREATE EVENT IF NOT EXISTS `Delete POCSAG Entries > 3 Months` + ON SCHEDULE EVERY 1 DAY + STARTS '2016-01-01 00:00:00' + ON COMPLETION PRESERVE ENABLE + DO + DELETE FROM bos_pocsag WHERE time < DATE_SUB(NOW(),INTERVAL 3 MONTH); + +-- -------------------------------------------------------- + +-- +-- Schedule für Tabelle `bos_fms` +-- + +CREATE EVENT IF NOT EXISTS `Delete FMS Entries > 3 Months` + ON SCHEDULE EVERY 1 DAY + STARTS '2016-01-01 00:00:00' + ON COMPLETION PRESERVE ENABLE + DO + DELETE FROM bos_fms WHERE time < DATE_SUB(NOW(),INTERVAL 3 MONTH); + +-- -------------------------------------------------------- + +-- +-- Schedule für Tabelle `bos_zvei` +-- + +CREATE EVENT IF NOT EXISTS `Delete ZVEI Entries > 3 Months` + ON SCHEDULE EVERY 1 DAY + STARTS '2016-01-01 00:00:00' + ON COMPLETION PRESERVE ENABLE + DO + DELETE FROM bos_zvei WHERE time < DATE_SUB(NOW(),INTERVAL 3 MONTH); From c77f2a9fdd11b72dc62d5e5da8cbb3c6c25e1341 Mon Sep 17 00:00:00 2001 From: Mikrocontroller Date: Wed, 12 Apr 2017 23:20:40 +0200 Subject: [PATCH 07/50] Encode data URL-safe, support of multiple URLs --- plugins/httpRequest/httpRequest.py | 44 +++++++++++++++++------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/plugins/httpRequest/httpRequest.py b/plugins/httpRequest/httpRequest.py index 3d8d90e0..744f6216 100644 --- a/plugins/httpRequest/httpRequest.py +++ b/plugins/httpRequest/httpRequest.py @@ -14,6 +14,7 @@ # # Imports # +import urllib import urllib2 import logging # Global logger from includes import globalVars # Global variables @@ -67,36 +68,41 @@ def run(typ,freq,data): try: # - # Create URL + # Replace special characters in data Strings for URL + # + for key in data: + if isinstance(data[key], basestring): + data[key] = urllib.quote(data[key]) + # + # Get URLs # if typ == "FMS": - url = globalVars.config.get("httpRequest", "fms_url") #Get URL - url = wildcardHandler.replaceWildcards(url, data) # replace wildcards with helper function - url = url.replace(" ","%20") # replace space with %20 to be a vaild http request + urls = globalVars.config.get("httpRequest", "fms_url").split(",") elif typ == "ZVEI": - url = globalVars.config.get("httpRequest", "zvei_url") #Get URL - url = wildcardHandler.replaceWildcards(url, data) # replace wildcards with helper function - url = url.replace(" ","%20") # replace space with %20 to be a vaild http request + urls = globalVars.config.get("httpRequest", "zvei_url").split(",") elif typ == "POC": - url = globalVars.config.get("httpRequest", "poc_url") #Get URL - url = wildcardHandler.replaceWildcards(url, data) # replace wildcards with helper function - url = url.replace(" ","%20") # replace space with %20 to be a vaild http request + urls = globalVars.config.get("httpRequest", "poc_url").split(",") else: logging.warning("Invalid Typ: %s", typ) return # + # replace wildcards + # + for (i, url) in enumerate(urls): + urls[i] = wildcardHandler.replaceWildcards(urls[i].strip(), data) + # # HTTP-Request # - logging.debug("send %s HTTP request", typ) - - try: - #resp = urllib2.urlopen(url) - urllib2.urlopen(url) - except urllib2.HTTPError as e: - logging.warning("HTTP response: %s", e.code) - except urllib2.URLError as e: - logging.warning("HTTP-specific error: %s", e.args) + logging.debug("send %s HTTP requests", typ) + + for url in urls: + try: + urllib2.urlopen(url) + except urllib2.HTTPError as e: + logging.warning("HTTP response: %s", e.code) + except urllib2.URLError as e: + logging.warning("HTTP-specific error: %s", e.args) except: logging.error("cannot send HTTP request") From 4aeb413f4fbd25b5087f78133d58291ef280da09 Mon Sep 17 00:00:00 2001 From: Mikrocontroller Date: Wed, 12 Apr 2017 23:23:42 +0200 Subject: [PATCH 08/50] Added comment for multiple URLs --- config/config.template.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.template.ini b/config/config.template.ini index 6f7f0182..2c745314 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -169,6 +169,8 @@ tableSIG = bos_signal [httpRequest] # example URL http://example.com/remote.php?DESCR=%DESCR% +# multiple URLs can be separated by comma + # you can use the following wildcards in your URL as GET params: # http://en.wikipedia.org/wiki/Query_string From 1a9e2a34d1370df93a5451f11fd37924a3632d66 Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 16 Apr 2017 13:04:13 +0200 Subject: [PATCH 09/50] Update Sms77.py Adapted API-URL due to changes caused by provider (see https://www.sms77.io/de/docs/gateway/http-api/sms-versand) --- plugins/Sms77/Sms77.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Sms77/Sms77.py b/plugins/Sms77/Sms77.py index 61d90781..9fb49437 100644 --- a/plugins/Sms77/Sms77.py +++ b/plugins/Sms77/Sms77.py @@ -66,8 +66,8 @@ def run(typ,freq,data): # logging.debug("send Sms77 %s", typ) - conn = httplib.HTTPSConnection("gateway.sms77.de:443") - conn.request("POST", "", + conn = httplib.HTTPSConnection("gateway.sms77.io",443) + conn.request("POST", "/api/sms", urllib.urlencode({ "u": globalVars.config.get("Sms77", "user"), "p": globalVars.config.get("Sms77", "password"), From 642d95b11a0f396c8b5f3dbd6b9e94f35f35be8b Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 16 Apr 2017 23:47:08 +0200 Subject: [PATCH 10/50] Enabling typ-handling Enable FMS and ZVEI-handling for plugin; message is set depending on the available information and processed to the http-handling. If typ is invalid an empty message will be sent. The text of the message can be adapted with regard to the information resulting from decoding --- plugins/Sms77/Sms77.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/Sms77/Sms77.py b/plugins/Sms77/Sms77.py index 61d90781..82ae5148 100644 --- a/plugins/Sms77/Sms77.py +++ b/plugins/Sms77/Sms77.py @@ -58,6 +58,20 @@ def run(typ,freq,data): """ try: if configHandler.checkConfig("Sms77"): #read and debug the config + + # create an empty message an fill it with the required information + message = "" + if typ == "FMS": + logging.debug("FMS detected, building message") + message = data["description"]+"
"+data["status"] + elif typ == "ZVEI": + logging.debug("ZVEI detected, building message") + mesage = data["description"] + elif typ == "POC": + logging.debug("POC detected, building message") + message = data["description"]+"
"+data["msg"].replace(";", "
") + else: + logging.warning("Invalid typ - use empty message") try: @@ -74,7 +88,7 @@ def run(typ,freq,data): "to": globalVars.config.get("Sms77", "to"), "from": globalVars.config.get("Sms77", "from"), "type": globalVars.config.get("Sms77", "type"), - "text": data["description"]+"
"+data["msg"].replace(";", "
") + "text": message }),{"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}) except: From 08c671cd0992b900d7872d9b19dfe2cdfefbf956 Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 16 Apr 2017 23:48:46 +0200 Subject: [PATCH 11/50] Update Sms77.py Adapting to new API --- plugins/Sms77/Sms77.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Sms77/Sms77.py b/plugins/Sms77/Sms77.py index 82ae5148..51ce7b51 100644 --- a/plugins/Sms77/Sms77.py +++ b/plugins/Sms77/Sms77.py @@ -80,8 +80,8 @@ def run(typ,freq,data): # logging.debug("send Sms77 %s", typ) - conn = httplib.HTTPSConnection("gateway.sms77.de:443") - conn.request("POST", "", + cconn = httplib.HTTPSConnection("gateway.sms77.io",443) + conn.request("POST", "/api/sms", urllib.urlencode({ "u": globalVars.config.get("Sms77", "user"), "p": globalVars.config.get("Sms77", "password"), From 142e2ba5b01a306176c8bd7290254a48dcd2759c Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 17 Apr 2017 10:00:20 +0200 Subject: [PATCH 12/50] Fixing typo Removed double-c from conn-string --- plugins/Sms77/Sms77.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Sms77/Sms77.py b/plugins/Sms77/Sms77.py index 51ce7b51..9985873f 100644 --- a/plugins/Sms77/Sms77.py +++ b/plugins/Sms77/Sms77.py @@ -80,7 +80,7 @@ def run(typ,freq,data): # logging.debug("send Sms77 %s", typ) - cconn = httplib.HTTPSConnection("gateway.sms77.io",443) + conn = httplib.HTTPSConnection("gateway.sms77.io",443) conn.request("POST", "/api/sms", urllib.urlencode({ "u": globalVars.config.get("Sms77", "user"), From 2e03519333c12fa79b00f231475e6b6a63274b53 Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 17 Apr 2017 10:46:39 +0200 Subject: [PATCH 13/50] Fixing message Set default-message to alarm Fixing ZVEI-message; it now contains zvei, and, if available, description --- plugins/Sms77/Sms77.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Sms77/Sms77.py b/plugins/Sms77/Sms77.py index 9985873f..e4353d13 100644 --- a/plugins/Sms77/Sms77.py +++ b/plugins/Sms77/Sms77.py @@ -60,13 +60,13 @@ def run(typ,freq,data): if configHandler.checkConfig("Sms77"): #read and debug the config # create an empty message an fill it with the required information - message = "" + message = "Alarm" if typ == "FMS": logging.debug("FMS detected, building message") message = data["description"]+"
"+data["status"] elif typ == "ZVEI": logging.debug("ZVEI detected, building message") - mesage = data["description"] + message = data["zvei"]+" - "+data["description"] elif typ == "POC": logging.debug("POC detected, building message") message = data["description"]+"
"+data["msg"].replace(";", "
") From 84b9d4ba6179f7eacced7540ee5fef5a28c14998 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 19 Apr 2017 22:54:57 +0200 Subject: [PATCH 14/50] Renaming file to .template. To prevent overwritten files after an update the csv-file is renamed to .template.csv --- csv/{fms.csv => fms.template.csv} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename csv/{fms.csv => fms.template.csv} (100%) diff --git a/csv/fms.csv b/csv/fms.template.csv similarity index 100% rename from csv/fms.csv rename to csv/fms.template.csv From fb4c922fef358ffe163bc92f6fc7b8dc38b1e233 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 19 Apr 2017 22:55:32 +0200 Subject: [PATCH 15/50] Rename nma.csv to nma.template.csv To prevent overwritten files after an update the csv-file is renamed to .template.csv --- csv/{nma.csv => nma.template.csv} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename csv/{nma.csv => nma.template.csv} (100%) diff --git a/csv/nma.csv b/csv/nma.template.csv similarity index 100% rename from csv/nma.csv rename to csv/nma.template.csv From 20746d66db408c3f647957173b7edd8938af8ba6 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 19 Apr 2017 22:55:55 +0200 Subject: [PATCH 16/50] Rename poc.csv to poc.template.csv To prevent overwritten files after an update the csv-file is renamed to .template.csv --- csv/{poc.csv => poc.template.csv} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename csv/{poc.csv => poc.template.csv} (100%) diff --git a/csv/poc.csv b/csv/poc.template.csv similarity index 100% rename from csv/poc.csv rename to csv/poc.template.csv From 5f4f6caa106abe253fb9f08bd888ba36b8fab56f Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 19 Apr 2017 22:56:09 +0200 Subject: [PATCH 17/50] Rename zvei.csv to zvei.template.csv To prevent overwritten files after an update the csv-file is renamed to .template.csv --- csv/{zvei.csv => zvei.template.csv} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename csv/{zvei.csv => zvei.template.csv} (100%) diff --git a/csv/zvei.csv b/csv/zvei.template.csv similarity index 100% rename from csv/zvei.csv rename to csv/zvei.template.csv From 77f51e35092b9330766f72b4975e4f2cfadc45c6 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 19 Apr 2017 23:17:09 +0200 Subject: [PATCH 18/50] New service Implement BOSWatch as systemctl-service --- service/boswatch.service | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 service/boswatch.service diff --git a/service/boswatch.service b/service/boswatch.service new file mode 100644 index 00000000..80c440b5 --- /dev/null +++ b/service/boswatch.service @@ -0,0 +1,11 @@ +[Unit] +Description=BOSWatch +After=multi-user.target + +[Service] +Type=simple +ExecStart=/usr/bin/python /opt/boswatch/boswatch.py -f 123.45M -a POC512 +Restart=on-abort + +[Install] +WantedBy=multi-user.target From a2b7cb3b56590ee68adb97a974a70addffb9a244 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 19 Apr 2017 23:22:22 +0200 Subject: [PATCH 19/50] Update README.md Adapt it to the new service --- service/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/service/README.md b/service/README.md index 3057ee47..41337a91 100644 --- a/service/README.md +++ b/service/README.md @@ -1,3 +1,20 @@ +### Use BOSWatch as service ### + +Old description below + +We assume that BOSWatch is installed to /opt/boswatch! Otherwise you need to adapt all the pathes in this description and in the service-file itself. + +#### Adapt the script +Enter the frequency and the decoder(s) you want to use in line 7; you can add more specific switches if you need to + +### Install the service +1. Copy the file to /lib/systemd/system: sudo cp /opt/boswatch/service/boswatch.service /lib/systemd/system/ +2. Change the rights: sudo chmod 644 /lib/systemd/system/boswatch.service +3. Enable the service: sudo systemcl enable boswatch.service +4. Start the service: sudo systemcl start boswatch.service + +--- + ### Start BOSWatch as a daemon ##### Changing the init script From 4e1cf00cb38a2ef1ed3078953cac59e568110612 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Plogmann Date: Mon, 24 Apr 2017 20:08:37 +0200 Subject: [PATCH 20/50] read message-text from config --- config/config.template.ini | 39 +++++++++++++++++++++++++++++++++--- plugins/Telegram/Telegram.py | 16 +++++++++------ 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/config/config.template.ini b/config/config.template.ini index 2c745314..a8f141c5 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -414,14 +414,47 @@ RICforLocationAPIKey = # This is your Google API key. # Required if you want to create a map based on location information received with the above RIC. GoogleAPIKey = + +# %FMS% = FMS Code +# %STATUS% = FMS Status +# %DIR% = Direction of the telegram (0/1) +# %DIRT% = Direction of the telegram (Text-String) +# %TSI% = Tactical Short Information (I-IV) +# %DESCR% = Description, if description-module is used +# %DATE% = Date (by script) +# %TIME% = Time (by script) +# %LPAR% = ( +# %RPAR% = ) +fms_message = %DATE% %TIME%: %FMS% + +# %ZVEI% = ZVEI 5-tone Code +# %DESCR% = Description, if description-module is used +# %DATE% = Date (by script) +# %TIME% = Time (by script) +# %LPAR% = ( +# %RPAR% = ) +zvei_message = %DATE% %TIME%: %ZVEI% + +# %RIC% = POCSAG RIC +# %FUNC% = POCSAG function/Subric (1-4) +# %FUNCCHAR% = POCSAG function/Subric als character (a-d) +# %MSG% = Message of the POCSAG telegram +# %BITRATE% = Bitrate of the POCSAG telegram +# %DESCR% = Description, if description-module is used +# %DATE% = Date (by script) +# %TIME% = Time (by script) +# %LPAR% = ( +# %RPAR% = ) +poc_message = %MSG% + [yowsup] # number or chat-number who whants to become the news -empfaenger = +empfaenger = # WhatsApp-number of that the news comes -sender = +sender = # password from this number -password= +password= # %FMS% = FMS Code # %STATUS% = FMS Status diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index 0d890c86..0b4c0537 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -16,6 +16,7 @@ from includes import globalVars # Global variables # Helper function, uncomment to use +from includes.helper import wildcardHandler from includes.helper import configHandler from includes.helper import timeHandler @@ -81,14 +82,15 @@ def run(typ,freq,data): if typ == "POC": logging.debug("Compose output from POCSAG-message") # compose message content - output = timeHandler.curtime()+"\n"+data["ric"]+"("+data["functionChar"]+")\n"+data["description"]+"\n"+data["msg"] + text = globalVars.config.get("Telegram","poc_message") + text = wildcardHandler.replaceWildcards(text, data) # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") bot = telegram.Bot(token='%s' % BOTTokenAPIKey) # Send message to chat via Telegram BOT API logging.debug("Send message to chat via Telegram BOT API") - bot.sendMessage('%s' % BOTChatIDAPIKey, output) + bot.sendMessage('%s' % BOTChatIDAPIKey, "text") # Generate location information only for specific RIC if data["ric"] == RICforLocationAPIKey: @@ -116,25 +118,27 @@ def run(typ,freq,data): elif typ == "FMS": logging.debug("Compose output from FMS-message") # compose message content - output = timeHandler.curtime()+"\n"+data["fms"]+"\n"+data["description"]+"\n"+data["status"] + text = globalVars.config.get("Telegram","fms_message") + text = wildcardHandler.replaceWildcards(text, data) # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") bot = telegram.Bot(token='%s' % BOTTokenAPIKey) # Send message to chat via Telegram BOT API logging.debug("Send message to chat via Telegram BOT API") - bot.sendMessage('%s' % BOTChatIDAPIKey, output) + bot.sendMessage('%s' % BOTChatIDAPIKey, "text") elif typ == "ZVEI": logging.debug("Compose output from ZVEI-message") # compose message content - output = timeHandler.curtime()+"\n"+data["zvei"]+"\n"+data["description"] + text = globalVars.config.get("Telegram","zvei_message") + text = wildcardHandler.replaceWildcards(text, data) # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") bot = telegram.Bot(token='%s' % BOTTokenAPIKey) # Send message to chat via Telegram BOT API logging.debug("Send message to chat via Telegram BOT API") - bot.sendMessage('%s' % BOTChatIDAPIKey, output) + bot.sendMessage('%s' % BOTChatIDAPIKey, "text") else: logging.warning("Invalid Typ: %s", typ) except Unauthorized: From d99574239bccbb7936f1f2ccbefc7ee99b63c505 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Plogmann Date: Mon, 24 Apr 2017 20:17:07 +0200 Subject: [PATCH 21/50] fixed syntax issues --- plugins/Telegram/Telegram.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index 0b4c0537..484880cc 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -90,7 +90,7 @@ def run(typ,freq,data): bot = telegram.Bot(token='%s' % BOTTokenAPIKey) # Send message to chat via Telegram BOT API logging.debug("Send message to chat via Telegram BOT API") - bot.sendMessage('%s' % BOTChatIDAPIKey, "text") + bot.sendMessage('%s' % BOTChatIDAPIKey, text) # Generate location information only for specific RIC if data["ric"] == RICforLocationAPIKey: @@ -126,7 +126,7 @@ def run(typ,freq,data): bot = telegram.Bot(token='%s' % BOTTokenAPIKey) # Send message to chat via Telegram BOT API logging.debug("Send message to chat via Telegram BOT API") - bot.sendMessage('%s' % BOTChatIDAPIKey, "text") + bot.sendMessage('%s' % BOTChatIDAPIKey, text) elif typ == "ZVEI": logging.debug("Compose output from ZVEI-message") # compose message content @@ -138,7 +138,7 @@ def run(typ,freq,data): bot = telegram.Bot(token='%s' % BOTTokenAPIKey) # Send message to chat via Telegram BOT API logging.debug("Send message to chat via Telegram BOT API") - bot.sendMessage('%s' % BOTChatIDAPIKey, "text") + bot.sendMessage('%s' % BOTChatIDAPIKey, text) else: logging.warning("Invalid Typ: %s", typ) except Unauthorized: From d3cbbb60d8c9c389445db5725e8375f49e04714e Mon Sep 17 00:00:00 2001 From: Jockel Date: Tue, 25 Apr 2017 06:53:15 +0200 Subject: [PATCH 22/50] added missing lineBrakeAllowed=True --- plugins/Telegram/Telegram.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index 484880cc..a9de8d67 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -83,8 +83,7 @@ def run(typ,freq,data): logging.debug("Compose output from POCSAG-message") # compose message content text = globalVars.config.get("Telegram","poc_message") - text = wildcardHandler.replaceWildcards(text, data) - + text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") bot = telegram.Bot(token='%s' % BOTTokenAPIKey) @@ -119,7 +118,7 @@ def run(typ,freq,data): logging.debug("Compose output from FMS-message") # compose message content text = globalVars.config.get("Telegram","fms_message") - text = wildcardHandler.replaceWildcards(text, data) + text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") @@ -131,7 +130,7 @@ def run(typ,freq,data): logging.debug("Compose output from ZVEI-message") # compose message content text = globalVars.config.get("Telegram","zvei_message") - text = wildcardHandler.replaceWildcards(text, data) + text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") From 80a9cdb6f4ea69c6b425fd62cb1e3da089ff3e03 Mon Sep 17 00:00:00 2001 From: Jockel Date: Tue, 25 Apr 2017 10:52:03 +0200 Subject: [PATCH 23/50] removed lineBrakeAllowed --- includes/helper/wildcardHandler.py | 7 ++----- plugins/Telegram/Telegram.py | 6 +++--- plugins/eMail/eMail.py | 6 +++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/includes/helper/wildcardHandler.py b/includes/helper/wildcardHandler.py index d67dde23..e85e6f81 100644 --- a/includes/helper/wildcardHandler.py +++ b/includes/helper/wildcardHandler.py @@ -17,7 +17,7 @@ from includes.helper import timeHandler -def replaceWildcards(text, data, lineBrakeAllowed=False): +def replaceWildcards(text, data): """ Replace all official Wildcards with the Information from the data[] var @@ -25,8 +25,6 @@ def replaceWildcards(text, data, lineBrakeAllowed=False): @param text: Input text with wildcards @type data: map @param data: map of data (structure see readme.md in plugin folder) - @type lineBrakeAllowed: Boolean - @param lineBrakeAllowed: switch to allow lineBreak (%BR%) as wildcard @return: text with replaced wildcards @exception: Exception if Error at replace @@ -36,8 +34,7 @@ def replaceWildcards(text, data, lineBrakeAllowed=False): text = text.replace("%TIME%", timeHandler.getTime(data["timestamp"])).replace("%DATE%", timeHandler.getDate(data["timestamp"])) # replace some special chars - if lineBrakeAllowed == True: - text = text.replace("%BR%", "\r\n") + text = text.replace("%BR%", "\r\n") text = text.replace("%LPAR%", "(") text = text.replace("%RPAR%", ")") diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index a9de8d67..9cc3246a 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -83,7 +83,7 @@ def run(typ,freq,data): logging.debug("Compose output from POCSAG-message") # compose message content text = globalVars.config.get("Telegram","poc_message") - text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) + text = wildcardHandler.replaceWildcards(text, data) # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") bot = telegram.Bot(token='%s' % BOTTokenAPIKey) @@ -118,7 +118,7 @@ def run(typ,freq,data): logging.debug("Compose output from FMS-message") # compose message content text = globalVars.config.get("Telegram","fms_message") - text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) + text = wildcardHandler.replaceWildcards(text, data) # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") @@ -130,7 +130,7 @@ def run(typ,freq,data): logging.debug("Compose output from ZVEI-message") # compose message content text = globalVars.config.get("Telegram","zvei_message") - text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) + text = wildcardHandler.replaceWildcards(text, data) # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") diff --git a/plugins/eMail/eMail.py b/plugins/eMail/eMail.py index d054c85a..ec271b20 100644 --- a/plugins/eMail/eMail.py +++ b/plugins/eMail/eMail.py @@ -137,7 +137,7 @@ def run(typ,freq,data): # read mailtext-structure from config.ini mailtext = globalVars.config.get("eMail", "fms_message") # replace wildcards with helper function - mailtext = wildcardHandler.replaceWildcards(mailtext, data, lineBrakeAllowed=True) + mailtext = wildcardHandler.replaceWildcards(mailtext, data) # send eMail doSendmail(server, subject, mailtext) @@ -157,7 +157,7 @@ def run(typ,freq,data): # read mailtext-structure from config.ini mailtext = globalVars.config.get("eMail", "zvei_message") # replace wildcards with helper function - mailtext = wildcardHandler.replaceWildcards(mailtext, data, lineBrakeAllowed=True) + mailtext = wildcardHandler.replaceWildcards(mailtext, data) # send eMail doSendmail(server, subject, mailtext) @@ -177,7 +177,7 @@ def run(typ,freq,data): # read mailtext-structure from config.ini mailtext = globalVars.config.get("eMail", "poc_message") # replace wildcards with helper function - mailtext = wildcardHandler.replaceWildcards(mailtext, data, lineBrakeAllowed=True) + mailtext = wildcardHandler.replaceWildcards(mailtext, data) # send eMail doSendmail(server, subject, mailtext) From de451ffc6f29ab34555fb5f5191af6a4e5b0f3f3 Mon Sep 17 00:00:00 2001 From: Jan Bollacke Date: Thu, 27 Apr 2017 14:39:23 +0200 Subject: [PATCH 24/50] DescriptionList: check if a description exists for ric w/o the subric --- includes/descriptionList.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/descriptionList.py b/includes/descriptionList.py index cca894fb..8755d089 100644 --- a/includes/descriptionList.py +++ b/includes/descriptionList.py @@ -113,6 +113,8 @@ def getDescription(typ, data): elif typ == "POC": global ricDescribtionList resultStr = ricDescribtionList[data] + if not resultStr: + resultStr = ricDescribtionList[data[:-1]] else: logging.warning("Invalid Typ: %s", typ) From 58b3158e9a3e2bc3b1b1804616b80b7a99972002 Mon Sep 17 00:00:00 2001 From: Jan Bollacke Date: Thu, 27 Apr 2017 14:40:42 +0200 Subject: [PATCH 25/50] PocDecoder: use subric in description lookup --- includes/decoders/poc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index 46be0427..457178d1 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -126,7 +126,7 @@ def decode(freq, decoded): # If enabled, look up description if globalVars.config.getint("POC", "idDescribed"): from includes import descriptionList - data["description"] = descriptionList.getDescription("POC", poc_id) + data["description"] = descriptionList.getDescription("POC", poc_id+poc_sub) # processing the alarm try: from includes import alarmHandler From 5ccd6d8cc0ae863e370bf9c35fe2756a8228a56e Mon Sep 17 00:00:00 2001 From: Jan Bollacke Date: Fri, 28 Apr 2017 07:44:12 +0200 Subject: [PATCH 26/50] DescriptionList: support functionchar while loading ids/rics --- includes/descriptionList.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/descriptionList.py b/includes/descriptionList.py index 8755d089..22ba7287 100644 --- a/includes/descriptionList.py +++ b/includes/descriptionList.py @@ -11,6 +11,7 @@ import logging # Global logger import csv # for loading the description files +import re # for matching IDs with a regular expression from includes import globalVars # Global variables from includes.helper import stringConverter @@ -41,8 +42,8 @@ def loadCSV(typ, idField): reader = csv.DictReader(csvfile) for row in reader: logging.debug(row) - # only import rows with an integer as id - if row[idField].isdigit() == True: + # only import rows with an integer as id, allow subrics though + if re.match("^[0-9]+[A-D]?$", idField, re.IGNORECASE): try: resultList[row[idField]] = stringConverter.convertToUTF8(row['description']) except: From a4c218887b6392c3bbcb1498de9ae0923356e4d2 Mon Sep 17 00:00:00 2001 From: Jan Bollacke Date: Fri, 28 Apr 2017 07:45:23 +0200 Subject: [PATCH 27/50] DescriptionList: fix lookup for ric and subric --- includes/descriptionList.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/includes/descriptionList.py b/includes/descriptionList.py index 22ba7287..7e959b78 100644 --- a/includes/descriptionList.py +++ b/includes/descriptionList.py @@ -113,9 +113,8 @@ def getDescription(typ, data): resultStr = zveiDescribtionList[data] elif typ == "POC": global ricDescribtionList - resultStr = ricDescribtionList[data] - if not resultStr: - resultStr = ricDescribtionList[data[:-1]] + resultStr = ricDescribtionList[data[:-1]] # MainRIC + resultStr += " " + ricDescribtionList[data] # SubRIC else: logging.warning("Invalid Typ: %s", typ) From bf9a604931a14f7d4a8dbaf29b8a8cb08451296e Mon Sep 17 00:00:00 2001 From: Jan Bollacke Date: Fri, 28 Apr 2017 07:46:28 +0200 Subject: [PATCH 28/50] PocDecoder: use functionchar instead of subric in description lookup --- includes/decoders/poc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index 457178d1..b0198f09 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -126,7 +126,7 @@ def decode(freq, decoded): # If enabled, look up description if globalVars.config.getint("POC", "idDescribed"): from includes import descriptionList - data["description"] = descriptionList.getDescription("POC", poc_id+poc_sub) + data["description"] = descriptionList.getDescription("POC", poc_id+data["functionChar"]) # processing the alarm try: from includes import alarmHandler From 4e23d9856edc3f574494cc919fdfe11a4ebc3f37 Mon Sep 17 00:00:00 2001 From: Florian Date: Fri, 28 Apr 2017 23:02:50 +0200 Subject: [PATCH 29/50] Fixing regex Searching in wrong field leads to error - fixing it --- includes/descriptionList.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/descriptionList.py b/includes/descriptionList.py index 7e959b78..e9252b36 100644 --- a/includes/descriptionList.py +++ b/includes/descriptionList.py @@ -43,7 +43,7 @@ def loadCSV(typ, idField): for row in reader: logging.debug(row) # only import rows with an integer as id, allow subrics though - if re.match("^[0-9]+[A-D]?$", idField, re.IGNORECASE): + if re.match("^[0-9]+[A-D]?$", row[idField], re.IGNORECASE): try: resultList[row[idField]] = stringConverter.convertToUTF8(row['description']) except: From 418411e09cfd4dd97e3ec2e1aa7d0c175ec6fdd7 Mon Sep 17 00:00:00 2001 From: Florian Date: Fri, 28 Apr 2017 23:49:44 +0200 Subject: [PATCH 30/50] Converting everything to lowercase Ignore upper- or lowercase from csv-file - as the code translates to lowercase in poc.csv all entries will be switched to lowercase. --- includes/descriptionList.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/descriptionList.py b/includes/descriptionList.py index e9252b36..fba47f1f 100644 --- a/includes/descriptionList.py +++ b/includes/descriptionList.py @@ -45,6 +45,10 @@ def loadCSV(typ, idField): # only import rows with an integer as id, allow subrics though if re.match("^[0-9]+[A-D]?$", row[idField], re.IGNORECASE): try: + if len(row[idField]) > 7: + if row[idField][7].isupper(): + tmp = row[idField].lower() + row[idField] = tmp; resultList[row[idField]] = stringConverter.convertToUTF8(row['description']) except: # skip entry in case of an exception From aeedcd4c8c9f61e3d06ae9ac0b1600b267b4d66c Mon Sep 17 00:00:00 2001 From: Jan Bollacke Date: Mon, 1 May 2017 09:14:45 +0200 Subject: [PATCH 31/50] DescriptionList: Simplify conversion of keys to lowercase This reverts commit 418411e09cfd4dd97e3ec2e1aa7d0c175ec6fdd7. --- includes/descriptionList.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/includes/descriptionList.py b/includes/descriptionList.py index fba47f1f..848d39a2 100644 --- a/includes/descriptionList.py +++ b/includes/descriptionList.py @@ -45,11 +45,7 @@ def loadCSV(typ, idField): # only import rows with an integer as id, allow subrics though if re.match("^[0-9]+[A-D]?$", row[idField], re.IGNORECASE): try: - if len(row[idField]) > 7: - if row[idField][7].isupper(): - tmp = row[idField].lower() - row[idField] = tmp; - resultList[row[idField]] = stringConverter.convertToUTF8(row['description']) + resultList[row[idField].lower()] = stringConverter.convertToUTF8(row['description']) except: # skip entry in case of an exception pass From 3e1db59d462bdc05c59d5d34cdd9edf972ee7b8a Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Sun, 7 May 2017 13:37:35 +0200 Subject: [PATCH 32/50] Update config.template.ini --- config/config.template.ini | 66 +++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/config/config.template.ini b/config/config.template.ini index a8f141c5..d943faff 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -414,39 +414,39 @@ RICforLocationAPIKey = # This is your Google API key. # Required if you want to create a map based on location information received with the above RIC. GoogleAPIKey = - -# %FMS% = FMS Code -# %STATUS% = FMS Status -# %DIR% = Direction of the telegram (0/1) -# %DIRT% = Direction of the telegram (Text-String) -# %TSI% = Tactical Short Information (I-IV) -# %DESCR% = Description, if description-module is used -# %DATE% = Date (by script) -# %TIME% = Time (by script) -# %LPAR% = ( -# %RPAR% = ) -fms_message = %DATE% %TIME%: %FMS% - -# %ZVEI% = ZVEI 5-tone Code -# %DESCR% = Description, if description-module is used -# %DATE% = Date (by script) -# %TIME% = Time (by script) -# %LPAR% = ( -# %RPAR% = ) -zvei_message = %DATE% %TIME%: %ZVEI% - -# %RIC% = POCSAG RIC -# %FUNC% = POCSAG function/Subric (1-4) -# %FUNCCHAR% = POCSAG function/Subric als character (a-d) -# %MSG% = Message of the POCSAG telegram -# %BITRATE% = Bitrate of the POCSAG telegram -# %DESCR% = Description, if description-module is used -# %DATE% = Date (by script) -# %TIME% = Time (by script) -# %LPAR% = ( -# %RPAR% = ) -poc_message = %MSG% - + +# %FMS% = FMS Code +# %STATUS% = FMS Status +# %DIR% = Direction of the telegram (0/1) +# %DIRT% = Direction of the telegram (Text-String) +# %TSI% = Tactical Short Information (I-IV) +# %DESCR% = Description, if description-module is used +# %DATE% = Date (by script) +# %TIME% = Time (by script) +# %LPAR% = ( +# %RPAR% = ) +FMS_message = %DATE% %TIME%: %FMS% + +# %ZVEI% = ZVEI 5-tone Code +# %DESCR% = Description, if description-module is used +# %DATE% = Date (by script) +# %TIME% = Time (by script) +# %LPAR% = ( +# %RPAR% = ) +ZVEI_message = %DATE% %TIME%: %ZVEI% + +# %RIC% = POCSAG RIC +# %FUNC% = POCSAG function/Subric (1-4) +# %FUNCCHAR% = POCSAG function/Subric als character (a-d) +# %MSG% = Message of the POCSAG telegram +# %BITRATE% = Bitrate of the POCSAG telegram +# %DESCR% = Description, if description-module is used +# %DATE% = Date (by script) +# %TIME% = Time (by script) +# %LPAR% = ( +# %RPAR% = ) +POC_message = %MSG% + [yowsup] # number or chat-number who whants to become the news From 78092389e90a5de593adb1c83361283f69d159db Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Sun, 7 May 2017 13:38:30 +0200 Subject: [PATCH 33/50] Update Telegram.py Removal of duplicate code. --- plugins/Telegram/Telegram.py | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index 9cc3246a..606fd9d5 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -18,7 +18,6 @@ # Helper function, uncomment to use from includes.helper import wildcardHandler from includes.helper import configHandler -from includes.helper import timeHandler # local variables BOTTokenAPIKey = None @@ -79,11 +78,12 @@ def run(typ,freq,data): try: ########## User Plugin CODE ########## try: - if typ == "POC": - logging.debug("Compose output from POCSAG-message") + if typ == "POC" or typ == "FMS" or typ == "ZVEI": + logging.debug("Read format and compose output for %s-message" % typ) # compose message content - text = globalVars.config.get("Telegram","poc_message") + text = globalVars.config.get("Telegram", "%s_message" % typ) text = wildcardHandler.replaceWildcards(text, data) + # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") bot = telegram.Bot(token='%s' % BOTTokenAPIKey) @@ -92,7 +92,7 @@ def run(typ,freq,data): bot.sendMessage('%s' % BOTChatIDAPIKey, text) # Generate location information only for specific RIC - if data["ric"] == RICforLocationAPIKey: + if typ == "POC" and data["ric"] == RICforLocationAPIKey: # Generate map logging.debug("Extract address from POCSAG message") address = "+".join(data["msg"].split(')')[0].split('/',1)[1].replace('(',' ').split()) @@ -114,30 +114,6 @@ def run(typ,freq,data): gcode_result = gcode.geocode(address) logging.debug("Send location via Telegram BOT API") bot.sendLocation('%s' % BOTChatIDAPIKey, gcode_result[0]['geometry']['location']['lat'], gcode_result[0]['geometry']['location']['lng'], disable_notification='true') - elif typ == "FMS": - logging.debug("Compose output from FMS-message") - # compose message content - text = globalVars.config.get("Telegram","fms_message") - text = wildcardHandler.replaceWildcards(text, data) - - # Initiate Telegram Bot - logging.debug("Initiate Telegram BOT") - bot = telegram.Bot(token='%s' % BOTTokenAPIKey) - # Send message to chat via Telegram BOT API - logging.debug("Send message to chat via Telegram BOT API") - bot.sendMessage('%s' % BOTChatIDAPIKey, text) - elif typ == "ZVEI": - logging.debug("Compose output from ZVEI-message") - # compose message content - text = globalVars.config.get("Telegram","zvei_message") - text = wildcardHandler.replaceWildcards(text, data) - - # Initiate Telegram Bot - logging.debug("Initiate Telegram BOT") - bot = telegram.Bot(token='%s' % BOTTokenAPIKey) - # Send message to chat via Telegram BOT API - logging.debug("Send message to chat via Telegram BOT API") - bot.sendMessage('%s' % BOTChatIDAPIKey, text) else: logging.warning("Invalid Typ: %s", typ) except Unauthorized: From d7896459caa18014e11de8266f45a757d20022eb Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Sun, 7 May 2017 19:23:45 +0200 Subject: [PATCH 34/50] Update Telegram.py --- plugins/Telegram/Telegram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index 606fd9d5..fc4acc78 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -78,7 +78,7 @@ def run(typ,freq,data): try: ########## User Plugin CODE ########## try: - if typ == "POC" or typ == "FMS" or typ == "ZVEI": + if typ in ("POC", "FMS", "ZVEI"): logging.debug("Read format and compose output for %s-message" % typ) # compose message content text = globalVars.config.get("Telegram", "%s_message" % typ) From f2e7c00feeacfb7e6464efe59c778839bef3890c Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 14 May 2017 22:53:42 +0200 Subject: [PATCH 35/50] Fix for leading zeros in RIC Prevent from cutting leading zeros in signal-RIC --- plugins/MySQL/MySQL.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index 02be083f..59415719 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -111,9 +111,9 @@ def run(typ,freq,data): elif typ == "POC": if isSignal(data["ric"]): - cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = "+data["ric"]) + cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';") if cursor.rowcount == 0: - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(),"+data["ric"]+")") + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") else: cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"])) From 3b9da8eb0eed2f9486c568d97f75cbfb35a986c9 Mon Sep 17 00:00:00 2001 From: Rumbel84 Date: Tue, 23 May 2017 20:46:01 +0200 Subject: [PATCH 36/50] Update regexFilter.py Wenn ein Filter nicht Matched (Regex) kommt False Wenn es gar keinen Filter gibt, kommt ein falsches True. Muss auch False sein. --- includes/regexFilter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/regexFilter.py b/includes/regexFilter.py index 20838c8e..8f3ef2c6 100644 --- a/includes/regexFilter.py +++ b/includes/regexFilter.py @@ -89,7 +89,7 @@ def checkFilters(typ, data, plugin, freq): return False else: logging.debug("no Filter found") - return True + return False except: logging.error("Error in filter checking") From 67a102808136462bf7fba4515f551b84b5bc35e4 Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Wed, 24 May 2017 19:20:53 +0200 Subject: [PATCH 37/50] Update doubleFilter.py Correcting the following issues (https://github.com/Schrolli91/BOSWatch/issues/217) -Consider using enumerate instead of iterating with range and len --- includes/doubleFilter.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/includes/doubleFilter.py b/includes/doubleFilter.py index 85506403..887b074f 100644 --- a/includes/doubleFilter.py +++ b/includes/doubleFilter.py @@ -31,12 +31,10 @@ def checkID(typ, data, msg=""): @return: True if check was OK @return: False if double was found """ - global doubleList timestamp = int(time.time()) # Get Timestamp logging.debug("checkID: %s (%s)", data, msg) - for i in range(len(doubleList)): - (xID, xTimestamp, xMsg) = doubleList[i] + for (xID, xTimestamp, xMsg) in doubleList: # given ID found? # return False if the first entry in double_ignore_time is found, we will not check for younger ones... if data == xID and timestamp < xTimestamp + globalVars.config.getint("BOSWatch", "doubleFilter_ignore_time"): From f6d62828b8a1162973c2162d783ee1d01e88296e Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Wed, 24 May 2017 19:25:27 +0200 Subject: [PATCH 38/50] Update pynma.py Correcting the following issue (https://github.com/Schrolli91/BOSWatch/issues/217) -Using type() instead of isinstance() for a typecheck. --- includes/pynma/pynma.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/pynma/pynma.py b/includes/pynma/pynma.py index ff91a316..08a71cbe 100644 --- a/includes/pynma/pynma.py +++ b/includes/pynma/pynma.py @@ -39,16 +39,16 @@ def __init__(self, apikey=[], developerkey=None): self._developerkey = None self.developerkey(developerkey) if apikey: - if type(apikey) == str: + if isinstance(apikey, str): apikey = [apikey] self._apikey = uniq(apikey) def addkey(self, key): "Add a key (register ?)" - if type(key) == str: + if isinstance(key, str): if not key in self._apikey: self._apikey.append(key) - elif type(key) == list: + elif isinstance(key, list): for k in key: if not k in self._apikey: self._apikey.append(k) @@ -65,7 +65,7 @@ def delkey(self, key): def developerkey(self, developerkey): "Sets the developer key (and check it has the good length)" - if type(developerkey) == str and len(developerkey) == 48: + if isinstance(developerkey, str) and len(developerkey) == 48: self._developerkey = developerkey def pushWithAPIKey(self, apikey=[], application="", event="", description="", url="", contenttype=None, priority=0, batch_mode=False, html=False): From a4c9d8197f48ca6336795711563d02f4d7a2eb21 Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Wed, 24 May 2017 19:30:41 +0200 Subject: [PATCH 39/50] Update notifyMyAndroid.py Correcting the following issue (https://github.com/Schrolli91/BOSWatch/issues/217) -Using global for 'fmsAPIKeyList' but no assignment is done -Using global for 'zveiAPIKeyList' but no assignment is done -Using global for 'pocAPIKeyList' but no assignment is done --- plugins/notifyMyAndroid/notifyMyAndroid.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/notifyMyAndroid/notifyMyAndroid.py b/plugins/notifyMyAndroid/notifyMyAndroid.py index ece18591..7fa535f5 100644 --- a/plugins/notifyMyAndroid/notifyMyAndroid.py +++ b/plugins/notifyMyAndroid/notifyMyAndroid.py @@ -173,9 +173,6 @@ def run(typ,freq,data): @return: nothing """ # local variables - global fmsAPIKeyList - global zveiAPIKeyList - global pocAPIKeyList try: try: From c3398ccd3f0ad10b10f01d25799d3236f9f55090 Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Wed, 24 May 2017 19:35:02 +0200 Subject: [PATCH 40/50] Update descriptionList.py Correcting the following issues (https://github.com/Schrolli91/BOSWatch/issues/217): -Using global for 'fmsDescribtionList' but no assignment is done -Using global for 'zveiDescribtionList' but no assignment is done -Using global for 'ricDescribtionList' but no assignment is done --- includes/descriptionList.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/includes/descriptionList.py b/includes/descriptionList.py index 848d39a2..9e548fd9 100644 --- a/includes/descriptionList.py +++ b/includes/descriptionList.py @@ -106,13 +106,10 @@ def getDescription(typ, data): logging.debug("look up description lists") try: if typ == "FMS": - global fmsDescribtionList resultStr = fmsDescribtionList[data] elif typ == "ZVEI": - global zveiDescribtionList resultStr = zveiDescribtionList[data] elif typ == "POC": - global ricDescribtionList resultStr = ricDescribtionList[data[:-1]] # MainRIC resultStr += " " + ricDescribtionList[data] # SubRIC else: From c9ffd6ae0dbe502c58e3b1325517ac4aaefddc35 Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Wed, 24 May 2017 19:39:22 +0200 Subject: [PATCH 41/50] Update regexFilter.py Correcting the following issue (https://github.com/Schrolli91/BOSWatch/issues/217): -Using global for 'filterList' but no assignment is done --- includes/regexFilter.py | 1 - 1 file changed, 1 deletion(-) diff --git a/includes/regexFilter.py b/includes/regexFilter.py index 20838c8e..b89c5f18 100644 --- a/includes/regexFilter.py +++ b/includes/regexFilter.py @@ -28,7 +28,6 @@ def loadFilters(): @return: nothing """ - global filterList try: logging.debug("loading filters") # For each entry in config.ini [Filters] section From 2ab78cd7b980b87ae29291c7b351be1821121a86 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sun, 28 May 2017 10:39:58 +0200 Subject: [PATCH 42/50] edit readme for new regex functionality --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c08f8058..ac3d336b 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ unless you are developer you can use the develop-Branch - may be unstable! - other Ideas per Issues please -###Plugins +### Plugins If you want to code your own Plugin, see `plugins/README.md`. ##### Implemented plugins: @@ -81,7 +81,7 @@ For the other functions see "Usage" below. For the RegEX filter functions see Section `[Filters]` http://www.regexr.com/ - RegEX test tool an documentation -No filter for a combination typ/plugin = all data will pass +If RegEX is enabled - only alloewd data will pass ! Syntax: `INDIVIDUAL_NAME = TYP;DATAFIELD;PLUGIN;FREQUENZ;REGEX` (separator `;`) - `TYP` = the data typ (FMS|ZVEI|POC) From 311b1832654cf2b39ecece15ac1c2cd05a96ffb7 Mon Sep 17 00:00:00 2001 From: Jockel Date: Mon, 31 Jul 2017 07:34:14 +0200 Subject: [PATCH 43/50] added support for custom texts with telegram --- plugins/Telegram/Telegram.py | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index fc4acc78..a9de8d67 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -18,6 +18,7 @@ # Helper function, uncomment to use from includes.helper import wildcardHandler from includes.helper import configHandler +from includes.helper import timeHandler # local variables BOTTokenAPIKey = None @@ -78,12 +79,11 @@ def run(typ,freq,data): try: ########## User Plugin CODE ########## try: - if typ in ("POC", "FMS", "ZVEI"): - logging.debug("Read format and compose output for %s-message" % typ) + if typ == "POC": + logging.debug("Compose output from POCSAG-message") # compose message content - text = globalVars.config.get("Telegram", "%s_message" % typ) - text = wildcardHandler.replaceWildcards(text, data) - + text = globalVars.config.get("Telegram","poc_message") + text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") bot = telegram.Bot(token='%s' % BOTTokenAPIKey) @@ -92,7 +92,7 @@ def run(typ,freq,data): bot.sendMessage('%s' % BOTChatIDAPIKey, text) # Generate location information only for specific RIC - if typ == "POC" and data["ric"] == RICforLocationAPIKey: + if data["ric"] == RICforLocationAPIKey: # Generate map logging.debug("Extract address from POCSAG message") address = "+".join(data["msg"].split(')')[0].split('/',1)[1].replace('(',' ').split()) @@ -114,6 +114,30 @@ def run(typ,freq,data): gcode_result = gcode.geocode(address) logging.debug("Send location via Telegram BOT API") bot.sendLocation('%s' % BOTChatIDAPIKey, gcode_result[0]['geometry']['location']['lat'], gcode_result[0]['geometry']['location']['lng'], disable_notification='true') + elif typ == "FMS": + logging.debug("Compose output from FMS-message") + # compose message content + text = globalVars.config.get("Telegram","fms_message") + text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) + + # Initiate Telegram Bot + logging.debug("Initiate Telegram BOT") + bot = telegram.Bot(token='%s' % BOTTokenAPIKey) + # Send message to chat via Telegram BOT API + logging.debug("Send message to chat via Telegram BOT API") + bot.sendMessage('%s' % BOTChatIDAPIKey, text) + elif typ == "ZVEI": + logging.debug("Compose output from ZVEI-message") + # compose message content + text = globalVars.config.get("Telegram","zvei_message") + text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) + + # Initiate Telegram Bot + logging.debug("Initiate Telegram BOT") + bot = telegram.Bot(token='%s' % BOTTokenAPIKey) + # Send message to chat via Telegram BOT API + logging.debug("Send message to chat via Telegram BOT API") + bot.sendMessage('%s' % BOTChatIDAPIKey, text) else: logging.warning("Invalid Typ: %s", typ) except Unauthorized: From c02cd74586af75688977611a2c22eb99486ed5be Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 23 Aug 2017 23:35:22 +0200 Subject: [PATCH 44/50] Enabling basic functionality - removed deprecated functions (mysql) - adding function: select view at login - adapting queries to database structure - some minor stuff --- exampleAddOns/alarmMonitorWeb/config.php | 4 +- .../alarmMonitorWeb/do_eintragen.php | 57 +++++++ exampleAddOns/alarmMonitorWeb/eintragen.php | 141 ++++++++++++------ exampleAddOns/alarmMonitorWeb/index.php | 12 +- exampleAddOns/alarmMonitorWeb/login.php | 33 +++- exampleAddOns/alarmMonitorWeb/logout.php | 6 + exampleAddOns/alarmMonitorWeb/prefs.php | 8 +- 7 files changed, 202 insertions(+), 59 deletions(-) create mode 100644 exampleAddOns/alarmMonitorWeb/do_eintragen.php create mode 100644 exampleAddOns/alarmMonitorWeb/logout.php diff --git a/exampleAddOns/alarmMonitorWeb/config.php b/exampleAddOns/alarmMonitorWeb/config.php index 3d9fb883..f3a439c8 100644 --- a/exampleAddOns/alarmMonitorWeb/config.php +++ b/exampleAddOns/alarmMonitorWeb/config.php @@ -1,8 +1,8 @@ + + + + + + +Zurück"; + exit; + } +$passwort = md5($passwort); + +$result = mysqli_query($verbindung, "SELECT id FROM login WHERE username LIKE '$username'"); +$menge = mysqli_num_rows($result); + +if($menge == 0) + { + $eintrag = "INSERT INTO login (username, passwort) VALUES ('$username', '$passwort')"; + $eintragen = mysqli_query($verbindung, $eintrag); + + if($eintragen == true) + { + echo "Benutzername $username wurde erstellt. Login"; + } + else + { + echo "Fehler beim Speichern des Benutzernames. Zurück"; + } + + + } + +else + { + echo "Benutzername schon vorhanden. Zurück"; + } +?> diff --git a/exampleAddOns/alarmMonitorWeb/eintragen.php b/exampleAddOns/alarmMonitorWeb/eintragen.php index 22488dc2..91bba00c 100644 --- a/exampleAddOns/alarmMonitorWeb/eintragen.php +++ b/exampleAddOns/alarmMonitorWeb/eintragen.php @@ -1,58 +1,111 @@ + + einloggen"; exit; } ?> + + + + BOSwatch + + + + + + + + + + + + + -Zurück"; - exit; - } -$passwort = md5($passwort); - -$result = mysql_query("SELECT id FROM login WHERE username LIKE '$username'"); -$menge = mysql_num_rows($result); - -if($menge == 0) - { - $eintrag = "INSERT INTO login (username, passwort) VALUES ('$username', '$passwort')"; - $eintragen = mysql_query($eintrag); - - if($eintragen == true) - { - echo "Benutzername $username wurde erstellt. Login"; - } - else - { - echo "Fehler beim Speichern des Benutzernames. Zurück"; - } - - - } - -else - { - echo "Benutzername schon vorhanden. Zurück"; - } -?> + +
+ +
+ + + + +
+
Usermanagment
+
+ +
+ +
+Username:
+
+ +Passwort:
+
+ +Passwort wiederholen:
+
+ + +
+ +
+ +
+
+ + + + + + + + + + diff --git a/exampleAddOns/alarmMonitorWeb/index.php b/exampleAddOns/alarmMonitorWeb/index.php index c6165ce5..a04cdaa3 100644 --- a/exampleAddOns/alarmMonitorWeb/index.php +++ b/exampleAddOns/alarmMonitorWeb/index.php @@ -40,7 +40,7 @@ @@ -75,6 +75,14 @@
+Startanzeige:
+
+ + @@ -100,4 +108,4 @@ - \ No newline at end of file + diff --git a/exampleAddOns/alarmMonitorWeb/login.php b/exampleAddOns/alarmMonitorWeb/login.php index f12c4ddc..264c6b5b 100644 --- a/exampleAddOns/alarmMonitorWeb/login.php +++ b/exampleAddOns/alarmMonitorWeb/login.php @@ -4,25 +4,44 @@ Login"; + exit; +} $username = $_POST["username"]; $passwort = md5($_POST["password"]); -$abfrage = "SELECT username, passwort FROM" $tableLOG "WHERE username LIKE '$username' LIMIT 1"; -$ergebnis = mysql_query($abfrage); -$row = mysql_fetch_object($ergebnis); + +$abfrage = "SELECT username, passwort FROM ".$tableLOG." WHERE username LIKE '$username' LIMIT 1"; +$ergebnis = mysqli_query($verbindung, $abfrage); +$row = mysqli_fetch_object($ergebnis); if($row->passwort == $passwort) { $_SESSION["username"] = $username; - header("Location: /show_pocsag.php"); + switch ($_POST["view"]) { + case 'pocsag': + header("Location: show_pocsag.php"); + break; + case 'zvei': + header("Location: show_zvei.php"); + break; + case 'fms': + header("Location: show_fms.php"); + break; + default: + header("Location: show_pocsag.php"); + } } else { - echo "Benutzername und/oder Passwort waren falsch. Login"; + echo "Benutzername und/oder Passwort waren falsch. Login"; } ?> diff --git a/exampleAddOns/alarmMonitorWeb/logout.php b/exampleAddOns/alarmMonitorWeb/logout.php new file mode 100644 index 00000000..314640c4 --- /dev/null +++ b/exampleAddOns/alarmMonitorWeb/logout.php @@ -0,0 +1,6 @@ + diff --git a/exampleAddOns/alarmMonitorWeb/prefs.php b/exampleAddOns/alarmMonitorWeb/prefs.php index 29a2a359..ddf63789 100644 --- a/exampleAddOns/alarmMonitorWeb/prefs.php +++ b/exampleAddOns/alarmMonitorWeb/prefs.php @@ -11,7 +11,7 @@ ?>
Einstellungen
- +
@@ -60,4 +60,4 @@ - \ No newline at end of file + From 61398d95cb3d4845419a63f334cf8835d1dafbb1 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 23 Aug 2017 23:37:25 +0200 Subject: [PATCH 45/50] Increase usability make the login-data readable for users --- exampleAddOns/alarmMonitorWeb/MySQL-Import/login.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleAddOns/alarmMonitorWeb/MySQL-Import/login.sql b/exampleAddOns/alarmMonitorWeb/MySQL-Import/login.sql index b7b4bc59..925dd53d 100644 --- a/exampleAddOns/alarmMonitorWeb/MySQL-Import/login.sql +++ b/exampleAddOns/alarmMonitorWeb/MySQL-Import/login.sql @@ -36,7 +36,7 @@ CREATE TABLE `login` ( LOCK TABLES `login` WRITE; /*!40000 ALTER TABLE `login` DISABLE KEYS */; -INSERT INTO `login` VALUES ,(1,'Test','098f6bcd4621d373cade4e832627b4f6'); +INSERT INTO `login` VALUES (1,'admin',md5('admin')); /*!40000 ALTER TABLE `login` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; From 4c60d501b58694b27e62b8a6e06e599b4d9a5784 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 23 Aug 2017 23:38:16 +0200 Subject: [PATCH 46/50] fixing deprecated stuff removed deprecated functions adpating to db-structure --- exampleAddOns/alarmMonitorWeb/tpl/a_header.php | 3 ++- .../alarmMonitorWeb/tpl/mysql.class.php | 16 ++++++++-------- exampleAddOns/alarmMonitorWeb/tpl/pocsag.php | 8 ++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/exampleAddOns/alarmMonitorWeb/tpl/a_header.php b/exampleAddOns/alarmMonitorWeb/tpl/a_header.php index 3614643e..866b34f7 100644 --- a/exampleAddOns/alarmMonitorWeb/tpl/a_header.php +++ b/exampleAddOns/alarmMonitorWeb/tpl/a_header.php @@ -41,7 +41,8 @@
  • FMS
  • ZVEI
  • Einstellungen
  • -
  • Nutzer anlegen
  • +
  • Nutzer anlegen
  • +
  • Ausloggen
  • diff --git a/exampleAddOns/alarmMonitorWeb/tpl/mysql.class.php b/exampleAddOns/alarmMonitorWeb/tpl/mysql.class.php index 69d5fbdb..3910fd90 100644 --- a/exampleAddOns/alarmMonitorWeb/tpl/mysql.class.php +++ b/exampleAddOns/alarmMonitorWeb/tpl/mysql.class.php @@ -23,16 +23,16 @@ function __construct($host, $user, $password, $database, $show_error = 1) { $this->show_error = $show_error; - @$this->conn = mysql_connect($host, $user, $password); + @$this->conn = mysqli_connect($host, $user, $password); if ($this->conn == false) { - $this->error("Keine Verbindung zum Datenbank Server!", mysql_error()); + $this->error("Keine Verbindung zum Datenbank Server!", mysqli_error($this->conn)); return false; } - if (!@mysql_select_db($database, $this->conn)) + if (!@mysqli_select_db($this->conn, $database)) { - $this->error("Datenbank nicht gefunden!", mysql_error()); + $this->error("Datenbank nicht gefunden!", mysqli_error($this->conn)); return false; } return true; @@ -48,10 +48,10 @@ function __construct($host, $user, $password, $database, $show_error = 1) */ function query($query) { - $this->result = @mysql_query($query, $this->conn); + $this->result = @mysqli_query($this->conn, $query); if ($this->result == false) { - $this->error("Fehlerhafte Datenbank Anfrage!", mysql_error()); + $this->error("Fehlerhafte Datenbank Anfrage!", mysqli_error($this->conn)); return false; } return $this->result; @@ -69,10 +69,10 @@ function fetchAssoc($result = null) { if ($result != null) { - return @mysql_fetch_assoc($result); + return @mysqli_fetch_assoc($result); } else { - return @mysql_fetch_assoc($this->result); + return @mysqli_fetch_assoc($this->result); } } diff --git a/exampleAddOns/alarmMonitorWeb/tpl/pocsag.php b/exampleAddOns/alarmMonitorWeb/tpl/pocsag.php index 4e4c6f29..5e86ebbc 100644 --- a/exampleAddOns/alarmMonitorWeb/tpl/pocsag.php +++ b/exampleAddOns/alarmMonitorWeb/tpl/pocsag.php @@ -10,7 +10,7 @@ query("SELECT id, time, ric, funktion, text, description FROM ".$tablePOC." ORDER BY id DESC LIMIT 100"); + $db->query("SELECT id, time, ric, function, msg, description FROM ".$tablePOC." ORDER BY id DESC LIMIT 100"); $Rows = array(); while ($daten = $db->fetchAssoc()) { @@ -29,11 +29,11 @@ // echo "". $poc['id'] . ""; // echo "". $poc['description'] . ""; - echo "". $poc['text'] . ""; + echo "". $poc['msg'] . ""; echo "". $time . ""; echo "". $poc['ric'] . ""; - echo "". $poc['funktion'] . ""; + echo "". $poc['function'] . ""; echo ""; } ?> - \ No newline at end of file + From 35e3ba80694f081e61d088b1b88d01fe3bdf243d Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 23 Aug 2017 23:38:51 +0200 Subject: [PATCH 47/50] remove file moved and renamed --- exampleAddOns/alarmMonitorWeb/eintragen.html | 111 ------------------- 1 file changed, 111 deletions(-) delete mode 100644 exampleAddOns/alarmMonitorWeb/eintragen.html diff --git a/exampleAddOns/alarmMonitorWeb/eintragen.html b/exampleAddOns/alarmMonitorWeb/eintragen.html deleted file mode 100644 index b850f57a..00000000 --- a/exampleAddOns/alarmMonitorWeb/eintragen.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - -einloggen"; - exit; - } -?> - - - - - - BOSwatch - - - - - - - - - - - - - - - -
    - -
    - - - - -
    -
    Usermanagment
    -
    - -
    - -
    -Username:
    -
    - -Passwort:
    -
    - -Passwort wiederholen:
    -
    - - -
    - -
    - -
    -
    - - - - - - - - - - \ No newline at end of file From 84d39d0686cc8d24f988f085ceddc5a6245c7803 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 15 Sep 2017 06:33:52 +0200 Subject: [PATCH 48/50] revert last merge see #296 --- plugins/Telegram/Telegram.py | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index a9de8d67..fc4acc78 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -18,7 +18,6 @@ # Helper function, uncomment to use from includes.helper import wildcardHandler from includes.helper import configHandler -from includes.helper import timeHandler # local variables BOTTokenAPIKey = None @@ -79,11 +78,12 @@ def run(typ,freq,data): try: ########## User Plugin CODE ########## try: - if typ == "POC": - logging.debug("Compose output from POCSAG-message") + if typ in ("POC", "FMS", "ZVEI"): + logging.debug("Read format and compose output for %s-message" % typ) # compose message content - text = globalVars.config.get("Telegram","poc_message") - text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) + text = globalVars.config.get("Telegram", "%s_message" % typ) + text = wildcardHandler.replaceWildcards(text, data) + # Initiate Telegram Bot logging.debug("Initiate Telegram BOT") bot = telegram.Bot(token='%s' % BOTTokenAPIKey) @@ -92,7 +92,7 @@ def run(typ,freq,data): bot.sendMessage('%s' % BOTChatIDAPIKey, text) # Generate location information only for specific RIC - if data["ric"] == RICforLocationAPIKey: + if typ == "POC" and data["ric"] == RICforLocationAPIKey: # Generate map logging.debug("Extract address from POCSAG message") address = "+".join(data["msg"].split(')')[0].split('/',1)[1].replace('(',' ').split()) @@ -114,30 +114,6 @@ def run(typ,freq,data): gcode_result = gcode.geocode(address) logging.debug("Send location via Telegram BOT API") bot.sendLocation('%s' % BOTChatIDAPIKey, gcode_result[0]['geometry']['location']['lat'], gcode_result[0]['geometry']['location']['lng'], disable_notification='true') - elif typ == "FMS": - logging.debug("Compose output from FMS-message") - # compose message content - text = globalVars.config.get("Telegram","fms_message") - text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) - - # Initiate Telegram Bot - logging.debug("Initiate Telegram BOT") - bot = telegram.Bot(token='%s' % BOTTokenAPIKey) - # Send message to chat via Telegram BOT API - logging.debug("Send message to chat via Telegram BOT API") - bot.sendMessage('%s' % BOTChatIDAPIKey, text) - elif typ == "ZVEI": - logging.debug("Compose output from ZVEI-message") - # compose message content - text = globalVars.config.get("Telegram","zvei_message") - text = wildcardHandler.replaceWildcards(text, data, lineBrakeAllowed=True) - - # Initiate Telegram Bot - logging.debug("Initiate Telegram BOT") - bot = telegram.Bot(token='%s' % BOTTokenAPIKey) - # Send message to chat via Telegram BOT API - logging.debug("Send message to chat via Telegram BOT API") - bot.sendMessage('%s' % BOTChatIDAPIKey, text) else: logging.warning("Invalid Typ: %s", typ) except Unauthorized: From ac5db0dc9840f458f287f388bacf986b4f95977e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Mon, 18 Sep 2017 20:46:43 +0200 Subject: [PATCH 49/50] prepare for changelog --- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..b3c89998 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,31 @@ +# Changelog + +### __[Unreleased]__ +#### Added +#### Changed +#### Deprecated +#### Removed +#### Fixed +#### Security + +### __[v2.2]__ +### __[v2.1]__ +### __[v2.0]__ + + +Zum schreiben des Changelog's siehe: +http://keepachangelog.com/de/1.0.0/ + +### Arten von Änderungen + +__Added__ für neue Features. + +__Changed__ für Änderungen an der bestehenden Funktionalität. + +__Deprecated__ für Features, die in zukünftigen Versionen entfernt werden. + +__Removed__ für Deprecated-Features, die in dieser Version entfernt wurden. + +__Fixed__ für alle Bug-Fixes. + +__Security__ um Benutzer im Fall von geschlossenen Sicherheitslücken zu einer Aktualisierung aufzufordern. From 53aa810df8607264d425fd1f62f43441cebdbc6e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Sep 2017 17:56:44 +0200 Subject: [PATCH 50/50] new release 2.2.1 --- CHANGELOG.md | 37 ++++++++++++++++--------------------- includes/globalVars.py | 4 ++-- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3c89998..6d14a03b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,31 +1,26 @@ # Changelog -### __[Unreleased]__ -#### Added -#### Changed -#### Deprecated -#### Removed -#### Fixed -#### Security -### __[v2.2]__ -### __[v2.1]__ -### __[v2.0]__ +#### __[v2.2.1]__ - 19.09.2017 +##### Added +- Neues Service Script +- Eigene Message fpr jeden Typ im Telegram Plugin +##### Changed +- Name der csv Dateien um überschreiben bei Update zu vermeiden +- Description Liste kann nun zusätzlich Einträge für jede Subric enthalten +- RegEX verbietet nun grundsätzlich alles - Es muss explizit zugelassen werden -Zum schreiben des Changelog's siehe: -http://keepachangelog.com/de/1.0.0/ - -### Arten von Änderungen +##### Deprecated +##### Removed +##### Fixed +- Bug im SMS77 Plugin -__Added__ für neue Features. +##### Security -__Changed__ für Änderungen an der bestehenden Funktionalität. -__Deprecated__ für Features, die in zukünftigen Versionen entfernt werden. +---------------------------- -__Removed__ für Deprecated-Features, die in dieser Version entfernt wurden. -__Fixed__ für alle Bug-Fixes. - -__Security__ um Benutzer im Fall von geschlossenen Sicherheitslücken zu einer Aktualisierung aufzufordern. +Zum schreiben des Changelog's siehe: +http://keepachangelog.com/de/1.0.0/ diff --git a/includes/globalVars.py b/includes/globalVars.py index 2cdcfa7c..9871af22 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,8 +9,8 @@ """ # version info -versionNr = "2.2-dev" -buildDate = "2017/03/30" +versionNr = "2.2.1" +buildDate = "2017/09/19" # Global variables config = 0