From 8a0c05f626db0603eb1c0dc3bca00f9fc70d583c Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Sep 2017 18:04:33 +0200 Subject: [PATCH 001/114] edit vers nr --- includes/globalVars.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/globalVars.py b/includes/globalVars.py index 0d6f2b3..3b34dcd 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,7 +9,7 @@ Global variables """ # version info -versionNr = "2.2.1-beta" +versionNr = "2.2.1" buildDate = "2017/09/19" From f31532d79a5f1e146751b2df25700382aa3373b3 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:49:36 +0200 Subject: [PATCH 002/114] Add files via upload Express-Alarm function added --- config.template.ini | 511 ++++++++++++++++++++++++++++++++++++++++++++ expressAlarm.py | 65 ++++++ poc.py | 156 ++++++++++++++ testdata.txt | 136 ++++++++++++ 4 files changed, 868 insertions(+) create mode 100644 config.template.ini create mode 100644 expressAlarm.py create mode 100644 poc.py create mode 100644 testdata.txt diff --git a/config.template.ini b/config.template.ini new file mode 100644 index 0000000..f3373f3 --- /dev/null +++ b/config.template.ini @@ -0,0 +1,511 @@ +######################## +# BOSWatch Config File # +######################## + +[BOSWatch] +# set loglevel for logfile +# 10 = debug +# 20 = info +# 30 = warning +# 40 = error +# 50 = critical +loglevel = 10 + +# BOSWatch uses a rotating logfile +# Rotating is at midnight +# You can set the backupCount here +# backupCount = 7 (keeps logfiles for 7 days) +backupCount = 7 + +# if you want to start BOSWatch as a daemon with rc2.d, +# you have to set the path to rtl_fm and multimon-ng ! +# both pathes have to end with an / +#rtl_path = /usr/local/bin/ +#multimon_path = /usr/local/bin/ + +# if you are using many plugins or plugins with a long execution time +# you can execute them in an asynchronous manner +# It must be pointed out that enabling (0|1) this consumes time, +# so don't use it for one rapid plugin +processAlarmAsync = 0 + +# Using RegEx-filter (0 - off | 1 - on) +# filter-configuration in section [Filters] +useRegExFilter = 0 + +# for double check save the last n IDs +# it is used in combination with double_ignore_time +# 1 is required if you want to use the double alarm filter +doubleFilter_ignore_entries = 10 + +# time to ignore same alarm (only ID is checked) (sec) +doubleFilter_ignore_time = 5 + +# ignore msg is only usefull for POCSAG (0 - off | 1 - on) +# 0: double check ignores the msg-text (only check ID + function) +# 1: if you want to differentiate between with/ without msg +# f.e. if they use quick-alarm (without text, then same RIC with msg) +# you will get more then one alarm anyway if the msg is different (receiving-problems) +doubleFilter_check_msg = 0 + +# writes the multimon-ng raw data stream into a text file named mm_raw.txt +writeMultimonRaw = 0 + +[NMAHandler] +# you can use a logging handler for sending logging records to NotifyMyAndroid +# enableHandler (0|1) will enable the NMA handler +enableHandler = 0 + +# loglevel for NMAHandler (see BOSWatch loglevel description) +loglevel = 50 + +# logging record will send to APIKey +APIKey = + +# you can change the name of the application (default: BOSWatch) +# (f.e. if you use more than one instance of BOSWatch) +appName = BOSWatch + + +[FMS] +# look-up-table for adding a description +# using description (0 - off | 1 - on) +# descriptions are loaded from csv/fms.csv +idDescribed = 0 + +# Check for correct CRC-information is provided by multimon-ng +# As this seems to be incorrect in many cases it might be useful to disable this +# (0 - off | 1 - on) +# Better use RegEX to verify the correct data +checkCRC = 0 + +[ZVEI] +# look-up-table for adding a description +# using description (0 - off | 1 - on) +# descriptions are loaded from csv/zvei.csv +idDescribed = 0 + +[POC] +# some very simple filters: +# Allow only this RICs (empty: allow all, separator ",") +# f.e.: allow_ric = 1234566,1234567,1234568 +allow_ric = + +# Deny this RICs (empty: allow all, separator ",") +# f.e.: deny_ric = 1234566,1234567,1234568 +deny_ric = + +# start and end of an allowed filter range +filter_range_start = 0000000 +filter_range_end = 9999999 + +# look-up-table for adding a description +# using description (0 - off | 1 - on) +# descriptions are loaded from csv/poc.csv +idDescribed = 0 + +# Static Massages for Subrics. +rica = Feuer +ricb = TH +ricc = AGT +ricd = Unwetter + +# RIC for net identification +# Usually sent periodically, separated by comma +netIdent_ric = 0174760, 1398098 + +[ExpressAlarm] +# Using Express-Alarm (0 - off | 1 - on) +expressAlarm = 0 + +# time limit for alarms that do not belong to the Express-Alarm sequence +expressAlarm_ignore_time = 15 + +# Express-Alarm delimiter RIC +expressAlarm_delimiter_ric = + +# Express-Alarm RIC that is used to send the message +expressAlarm_ric = + +[Filters] +# RegEX Filter Configuration +# http://www.regexr.com/ - RegEX Test Tool an Documentation +# No Filter for a Typ/Plugin Combination = all Data pass +# INDIVIDUAL_NAME = TYP;DATAFIELD;PLUGIN;FREQUENZ;REGEX +# TYP = the Data Typ (FMS|ZVEI|POC) +# DATAFIELD = the field of the Data Array (see readme.md in plugin folder) +# PLUGIN = the name of the Plugin to call with this Filter (* for all) +# FREQUENZ = the Frequenz to use the Filter (for more SDR Sticks (* for all)) +# REGEX = the RegEX + +# only ZVEI to all plugins with 25### at 85.5MHz +#testfilter = ZVEI;zvei;*;85500000;25[0-9]{3} + +# only POCSAG to MySQL with the text "ALARM:" in the message +#pocTest = POC;msg;MySQL;*;ALARM: + + +[Plugins] +# turn the plugins on or off (0 - off | 1 - on) +MySQL = 0 +httpRequest = 0 +eMail = 0 +BosMon = 0 +firEmergency = 0 +jsonSocket = 0 +notifyMyAndroid = 0 +SMS = 0 +Sms77 = 0 +FFAgent = 0 +Pushover = 0 +Telegram = 0 +yowsup = 0 + +# for developing template-module +template = 0 + + +[MySQL] +# MySQL configuration +dbserver = localhost +dbuser = boswatch +dbpassword = root +database = boswatch + +# tables in the database +tableFMS = bos_fms +tableZVEI = bos_zvei +tablePOC = bos_pocsag +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 + +# %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 from csv-file +# %TIME% = Time (by script) +# %DATE% = Date (by script) +#fms_url = http://www.google.de?code=%FMS%&stat=%STATUS% +fms_url = + +# %ZVEI% = ZVEI 5-tone Code +# %DESCR% = Description from csv-file +# %TIME% = Time (by script) +# %DATE% = Date (by script) +#zvei_url = http://www.google.de?zvei=%ZVEI% +zvei_url = + +# %RIC% = POCSAG RIC +# %FUNC% = POCSAG function/Subric (1-4) +# %FUNCCHAR% = POCSAG function/Subric as character (a-d) +# %FUNCTEXT% = POCSAG function/Subric static massage definded in POCSAG section +# %MSG% = Message of the POCSAG telegram +# %BITRATE% = Bitrate of the POCSAG telegram +# %DESCR% = Description from csv-file +# %TIME% = Time (by script) +# %DATE% = Date (by script) +#poc_url = http://www.google.de?ric=%RIC%&subric=%FUNC%&msg=%MSG% +poc_url = + + +[eMail] +# SMTP-Server +smtp_server = localhost +# Port of SMTP-server (default: ) +smtp_port = +# use tls for connection (0|1) +tls = 0 +# Use this, when SMTP-server has restricted access +user = +password = + +# Parameters for Alarm-Msg: +# "to" can be more than one address, comma separated +from = local@localhost +to = user@irgendwo, user2@woanders + +# Priority of the eMail: +# normal|urgent|non-urgent +priority = urgent + +# %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) +# %BR% = Insert line wrap (only in message) +# %LPAR% = ( +# %RPAR% = ) +fms_subject = FMS: %FMS% +fms_message = %DATE% %TIME%: %FMS%%BR%Status: %STATUS% - Direction: %DIRT% - TSI: %TSI% + +# %ZVEI% = ZVEI 5-tone Code +# %DESCR% = Description, if description-module is used +# %DATE% = Date (by script) +# %TIME% = Time (by script) +# %BR% = Insert line wrap (only in message) +# %LPAR% = ( +# %RPAR% = ) +zvei_subject = Alarm: %ZVEI% +zvei_message = %DATE% %TIME%: %ZVEI% + +# %RIC% = POCSAG RIC +# %FUNC% = POCSAG function/Subric (1-4) +# %FUNCCHAR% = POCSAG function/Subric als character (a-d) +# %FUNCTEXT% = POCSAG function/Subric static massage definded in POCSAG section +# %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) +# %BR% = Insert line wrap (only in message) +# %LPAR% = ( +# %RPAR% = ) +poc_subject = Alarm: %RIC%%LPAR%%FUNCCHAR%%RPAR% +poc_message = %DATE% %TIME% - %DESCR%: %MSG% + + +[BosMon] +# IP-address of the server (without http://) +# actually no SSL-support +bosmon_server = 192.168.0.1 +bosmon_port = 80 + +# channel-name of type "Web-Telegramm" +bosmon_channel = channel + +# Use this, when BosMon has restricted access +bosmon_user = +bosmon_password = + + +[firEmergency] +# firEmergency configuration +firserver = localhost +firport = 9001 + + +[jsonSocket] +# Protocol for socket (TCP|UDP) +protocol = UDP +# IP-address of the server (without http://) +server = 192.168.0.1 +port = 8888 + + +[notifyMyAndroid] +# APIKey given from notifyMyAndroid +APIKey = + +# Priority goes from -2 (lowest) to 2 (highest). The default priority is 0 (normal) +priority = 0 + +# You can change the name of the application (default: BOSWatch) +# (f.e. if you use more than one instance of BOSWatch) +appName = BOSWatch + +# instead of a given APIKey/priority you could import them by a csv-file (0|1) +# APIKey and priority above will be ignored, if you use a csv +# configuration loaded from csv/nma.csv +usecsv = 0 + + +[SMS] +# be aware that you need 'gammu' installed and running +# at least you need an UMTS-stick which is supported by 'gammu' + +quantity = 1 +# be sensitive to single RIC +ric1 = 1234567 + +# but you can watch several subrics, comma-separated +subric1 = a, b + +# a single cellphone-number +phonenumber1 = 0160321654987 + +# and the text for the sms +# ! DO NOT USE ANY UMLAUT ! +text1 = Rueckruf Leitstelle! + + +[Sms77] +# SMS77 configuration +# Login Username +user = + +# Password or API Key +password = + +# Receiver singlenumber or groupname from adressbook +to = + +# Sender number or name +from = + +# Type of Message (see https://www.sms77.de/funktionen/smstypen and https://www.sms77.de/funktionen/http-api) +type = quality + + +[FFAgent] +# set live mode (0/1) +live = 0 + +# send messages as type test (0/1) +test = 1 + +# path to server certificate file +serverCertFile = + +# path to client certificate file (LIVE) +clientCertFile = + +# path to client certificate password file (LIVE) +clientCertPass = + +# webapi token +webApiToken = + +# webapi key +webApiKey = + +# access token +accessToken = + +# selective Call Code +selectiveCallCode = + + +[Pushover] +# Pushover API Key +api_key = + +# Pushover Userkey or Groupkey to receive message +user_key = + +# Title of the message +title = BOSWatch Message + +# Adapt Pocsag Subric (a,b,c,d) to Pushover Priorities (see https://pushover.net/api#priority) +SubA = 0 +SubB = 2 +SubC = 1 +SubD = 0 + +# how often should Pushover re-alert in seconds (emergency-messages) +retry = 30 + +# when should Pushover stop to re-alert in seconds (emergency-messages) +expire = 90 + +# use HTML in messages (0/1) +html = 1 + + +[Telegram] +# This is your unique BOT token. You will get it from the BotFather once you have created your BOT. +BOTTokenAPIKey = +# Create a group chat with your BOT and enter the chat ID here. +# The plugin will send messages as your BOT and post everything in this group chat. +BOTChatIDAPIKey = +# The plugin can extract a location from the POCSAG message. +# However, this will be done for the following RIC only (7 digits e.g. 0012345). +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 = +# WhatsApp-number of that the news comes +sender = +# password from this number +password= + +# %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% + + +##################### +##### Not ready yet # +##################### + +[template] +test1 = testString +test2 = 123456 diff --git a/expressAlarm.py b/expressAlarm.py new file mode 100644 index 0000000..03ca5d1 --- /dev/null +++ b/expressAlarm.py @@ -0,0 +1,65 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +""" +expressAlarm is the function to enable BOSwatch to deal with Swissfone Express-Alarm + +@author: Fabian Kessler + +@requires: Configuration has to be set in the config.ini +""" + +import logging # Global logger +import time # timestamp for expressAlarm + +from includes import globalVars # Global variables + +expressList = [] + +def newEntryExpressList(eatyp, eapoc_id, eapoc_sub, eapoc_text): + """ + add entry to express alarm list and remove old entries + + @return: nothing + """ + global expressList + tmpexpressList = [] + timestamp = int(time.time()) + # Express-Alarm processing if enabled and delimiter RIC has been received + if eapoc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_delimiter_ric"): + expressList = [] + logging.debug("Express-Alarm delimiter RIC received --> buffer cleared %s %s %s ", eapoc_id, eapoc_sub, eapoc_text) + else: + expressList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp]) + logging.debug("Added %s %s %s to expressList", eapoc_id, eapoc_sub, eapoc_text) + # check for old entries in expressList + for i in range(len(expressList)): + # we have to remove entries older than timestamp - ignore time + if int(expressList[i][4]) > timestamp-globalVars.config.getint("ExpressAlarm", "expressAlarm_ignore_time"): + tmpexpressList.append(expressList[i]) + expressList = tmpexpressList + + +def expressAlarmExec(typ, freq, data): + """ + call alarmHandler for every entry in expressList + + @return: nothing + """ + logging.debug("data before update from expressList: %s", data) + for i in range(len(expressList)): + #update with eapoc_id (RIC) + data['ric'] = expressList[i][1] + #update with eapoc_sub (Sub RIC) + data['function'] = expressList[i][2] + # Add function as character a-d to dataset (reused from includes/poc.py) + data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d") + #update with eapoc_id (RIC) + data['description'] = expressList[i][1] + logging.debug("data after update from expressList: %s", data) + try: + from includes import alarmHandler + alarmHandler.processAlarmHandler(typ, freq, data) + except: + logging.error("processing alarm failed") + logging.debug("processing alarm failed", exc_info=True) \ No newline at end of file diff --git a/poc.py b/poc.py new file mode 100644 index 0000000..1c9816b --- /dev/null +++ b/poc.py @@ -0,0 +1,156 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +""" +POCSAG Decoder + +@author: Bastian Schroll +@author: Jens Herrmann + +@requires: Configuration has to be set in the config.ini +""" + +import logging # Global logger +import re # Regex for validation + +from includes import globalVars # Global variables +from includes import doubleFilter # double alarm filter + +## +# +# Simple local filter +# +def isAllowed(poc_id): + """ + Simple Filter Functions (Allowed, Denied and Range) + + @type poc_id: string + @param poc_id: POCSAG Ric + + @requires: Configuration has to be set in the config.ini + + @return: Checks both allow/deny-rule and filter-range (suitable for signal-RIC) + @exception: none + """ + + allowed = 0 + + # 1.) If allowed RICs is set, only they will path, + # If RIC is the right one return True, else False + if globalVars.config.get("POC", "allow_ric"): + if poc_id in globalVars.config.get("POC", "allow_ric"): + logging.info("RIC %s is allowed", poc_id) + return True + else: + logging.info("RIC %s is not in the allowed list", poc_id) + allowed = 0 + # 2.) If denied RIC, return False + if poc_id in globalVars.config.get("POC", "deny_ric"): + logging.info("RIC %s is denied by config.ini", poc_id) + return False # RIC is denied - strongest way to block + # 3.) Check Range, return False if outside def. range + if globalVars.config.getint("POC", "filter_range_start") < int(poc_id) < globalVars.config.getint("POC", "filter_range_end"): + logging.info("RIC %s in between filter range", poc_id) + return True + else: + logging.info("RIC %s out of filter range", poc_id) + allowed = 0 + # 4.) Implementation for net identifiers + if globalVars.config.get("POC", "netIdent_ric"): + if poc_id in globalVars.config.get("POC", "netIdent_ric"): + logging.info("RIC %s as net identifier", poc_id) + return True + else: + allowed = 0 + + if allowed == 0: + return False + return True + +## +# +# POCSAG decoder function +# validate -> check double alarm -> log +# +def decode(freq, decoded): + """ + Export POCSAG information from Multimon-NG string and call alarmHandler.processAlarmHandler() + + @type freq: string + @param freq: frequency of the SDR Stick + @type decoded: string + @param decoded: RAW Information from Multimon-NG + + @requires: Configuration has to be set in the config.ini + + @return: nothing + @exception: Exception if POCSAG decode failed + """ + try: + bitrate = 0 + + if "POCSAG512:" in decoded: + bitrate = 512 + poc_id = decoded[20:27].replace(" ", "").zfill(7) + poc_sub = str(int(decoded[39])+1) + + elif "POCSAG1200:" in decoded: + bitrate = 1200 + poc_id = decoded[21:28].replace(" ", "").zfill(7) + poc_sub = str(int(decoded[40])+1) + + elif "POCSAG2400:" in decoded: + bitrate = 2400 + poc_id = decoded[21:28].replace(" ", "").zfill(7) + poc_sub = str(int(decoded[40])+1) + + if bitrate is 0: + logging.warning("POCSAG Bitrate not found") + logging.debug(" - (%s)", decoded) + else: + logging.debug("POCSAG Bitrate: %s", bitrate) + + if "Alpha:" in decoded: #check if there is a text message + poc_text = decoded.split('Alpha: ')[1].strip().replace('','').replace('','').replace('','').replace('','').strip() + else: + poc_text = "" + + if re.search("[0-9]{7}", poc_id) and re.search("[1-4]{1}", poc_sub): #if POC is valid + if isAllowed(poc_id): + # check for double alarm + if doubleFilter.checkID("POC", poc_id+poc_sub, poc_text): + logging.info("POCSAG%s: %s %s %s ", bitrate, poc_id, poc_sub, poc_text) + data = {"ric":poc_id, "function":poc_sub, "msg":poc_text, "bitrate":bitrate, "description":poc_id} + # Add function as character a-d to dataset + data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d") + # If enabled, look up description + if globalVars.config.getint("POC", "idDescribed"): + from includes import descriptionList + data["description"] = descriptionList.getDescription("POC", poc_id+data["functionChar"]) + # Express-Alarm processing if enabled and message without text ord delimiter RIC received + if globalVars.config.getint("ExpressAlarm", "expressAlarm") and (poc_text == "" or poc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_delimiter_ric")): + logging.debug("POCSAG%s: %s %s %s - Express-Alarm or delimiter RIC received - buffer until text received", bitrate, poc_id, poc_sub, poc_text) + from includes import expressAlarm + expressAlarm.newEntryExpressList("POC", poc_id, poc_sub, poc_text) + # Express-Alarm processing if enabled and alarm message has been received + elif globalVars.config.getint("ExpressAlarm", "expressAlarm") and poc_text != "" and poc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_ric"): + logging.debug("EA RIC with text message - POCSAG%s: %s %s %s", bitrate, poc_id, poc_sub, poc_text) + from includes import expressAlarm + expressAlarm.expressAlarmExec("POC", freq, data) + else: + # processing the alarm + try: + from includes import alarmHandler + alarmHandler.processAlarmHandler("POC", freq, data) + except: + logging.error("processing alarm failed") + logging.debug("processing alarm failed", exc_info=True) + # in every time save old data for double alarm + doubleFilter.newEntry(poc_id+poc_sub, poc_text) + else: + logging.debug("POCSAG%s: %s is not allowed", bitrate, poc_id) + else: + logging.warning("No valid POCSAG%s RIC: %s SUB: %s", bitrate, poc_id, poc_sub) + except: + logging.error("error while decoding") + logging.debug("error while decoding", exc_info=True) diff --git a/testdata.txt b/testdata.txt new file mode 100644 index 0000000..83dd6c8 --- /dev/null +++ b/testdata.txt @@ -0,0 +1,136 @@ +# Testdata for the BOSWatch Test Mode function +# Data in Multimon-NG Raw Format +# Data is alternately passed to the decoder to simulate an used Radio-Frequency + +# +# POCSAG +# ------ +# +# The following settings in config.ini are expected for POCSAG +# +# [BOSWatch] +# useDescription = 1 +# doubleFilter_ignore_entries = 10 +# doubleFilter_check_msg = 1 +# +# [POC] +# deny_ric = 7777777 +# filter_range_start = 0000005 +# filter_range_end = 8999999 +# idDescribed = 1 +# + +# bitrate +POCSAG512: Address: 1000512 Function: 1 Alpha: BOSWatch-Test ÖÄÜß: okay +POCSAG1200: Address: 1001200 Function: 1 Alpha: BOSWatch-Test: okay +POCSAG2400: Address: 1002400 Function: 1 Alpha: BOSWatch-Test: okay + +# function-code +POCSAG512: Address: 1000000 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 1000001 Function: 1 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 1000002 Function: 2 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 1000003 Function: 3 Alpha: BOSWatch-Test: okay + +# german special sign +POCSAG512: Address: 1200001 Function: 1 Alpha: BOSWatch-Test ÖÄÜß: okay +POCSAG512: Address: 1200001 Function: 1 Alpha: BOSWatch-Test öäü: okay + +# with csv +POCSAG512: Address: 1234567 Function: 1 Alpha: BOSWatch-Test: with csv + +# without csv +POCSAG1200: Address: 2345678 Function: 2 Alpha: BOSWatch-Test: without csv +POCSAG2400: Address: 3456789 Function: 3 Alpha: BOSWatch-Test: without csv + +# OHNE TEXT???? +POCSAG1200: Address: 1100000 Function: 0 +POCSAG1200: Address: 1100000 Function: 1 +POCSAG1200: Address: 1100000 Function: 2 +POCSAG1200: Address: 1100000 Function: 3 + +# duplicate with same and other msg +POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Testing: okay + +# duplicate in different order +POCSAG1200: Address: 2100000 Function: 2 +POCSAG1200: Address: 2100001 Function: 2 +POCSAG1200: Address: 2100002 Function: 2 +POCSAG1200: Address: 2100000 Function: 2 +POCSAG1200: Address: 2100001 Function: 2 +POCSAG1200: Address: 2100002 Function: 2 +POCSAG1200: Address: 2100000 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100002 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100000 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100002 Function: 2 Alpha: BOSWatch-Test: second is a duplicate + +# invalid +POCSAG512: Address: 3 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 33 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 333 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 3333 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 33333 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 333333 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 3333333 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 333333F Function: 0 Alpha: BOSWatch-Test: invalid +POCSAG512: Address: 333333F Function: 1 Alpha: BOSWatch-Test: invalid +POCSAG512: Address: 3333333 Function: 4 Alpha: BOSWatch-Test: invalid + +# denied +POCSAG1200: Address: 7777777 Function: 1 Alpha: BOSWatch-Test: denied + +# out of filter Range +#POCSAG1200: Address: 0000004 Function: 1 Alpha: BOSWatch-Test: out of filter start +#POCSAG1200: Address: 9000000 Function: 1 Alpha: BOSWatch-Test: out of filter end +# +##Probealram +POCSAG1200: Address: 0871004 Function: 1 Alpha: Dies ist ein Probealarm! +## Express Alarm +POCSAG1200: Address: 0871002 Function: 0 Alpha: +POCSAG1200: Address: 0860001 Function: 0 +POCSAG1200: Address: 0860002 Function: 0 +POCSAG1200: Address: 0860003 Function: 0 +POCSAG1200: Address: 0860004 Function: 0 +POCSAG1200: Address: 0860005 Function: 0 +POCSAG1200: Address: 0860006 Function: 0 +POCSAG1200: Address: 0860007 Function: 0 +POCSAG1200: Address: 0860008 Function: 0 +POCSAG1200: Address: 0860009 Function: 0 +POCSAG1200: Address: 0860010 Function: 0 +POCSAG1200: Address: 0871003 Function: 0 Alpha: B2 Feuer Gebäude Pers in Gefahr. bla bla bla + +# regEx-Filter? + + +# +# FMS +# --- +# +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=I (ohneNA,ohneSIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=I (ohneNA,ohneSIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=II (ohneNA,mit SIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=IV (mit NA,mit SIGNAL)) CRC correct + + +# +# ZVEI +# ---- +# + +#with csv description +ZVEI1: 12345 +#without csv description +ZVEI1: 56789 +#duplicate +ZVEI1: 56789 +#with repeat Tone +ZVEI1: 1F2F3 +#in case of invalid id +ZVEI1: 135 +#in case of a double-tone for siren n-'D's are sended +ZVEI1: DDD +ZVEI1: DDDDD From c52c76aa5043335f471d4d89e0fd17c92e43b1e5 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:51:53 +0200 Subject: [PATCH 003/114] Delete expressAlarm.py --- expressAlarm.py | 65 ------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 expressAlarm.py diff --git a/expressAlarm.py b/expressAlarm.py deleted file mode 100644 index 03ca5d1..0000000 --- a/expressAlarm.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -""" -expressAlarm is the function to enable BOSwatch to deal with Swissfone Express-Alarm - -@author: Fabian Kessler - -@requires: Configuration has to be set in the config.ini -""" - -import logging # Global logger -import time # timestamp for expressAlarm - -from includes import globalVars # Global variables - -expressList = [] - -def newEntryExpressList(eatyp, eapoc_id, eapoc_sub, eapoc_text): - """ - add entry to express alarm list and remove old entries - - @return: nothing - """ - global expressList - tmpexpressList = [] - timestamp = int(time.time()) - # Express-Alarm processing if enabled and delimiter RIC has been received - if eapoc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_delimiter_ric"): - expressList = [] - logging.debug("Express-Alarm delimiter RIC received --> buffer cleared %s %s %s ", eapoc_id, eapoc_sub, eapoc_text) - else: - expressList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp]) - logging.debug("Added %s %s %s to expressList", eapoc_id, eapoc_sub, eapoc_text) - # check for old entries in expressList - for i in range(len(expressList)): - # we have to remove entries older than timestamp - ignore time - if int(expressList[i][4]) > timestamp-globalVars.config.getint("ExpressAlarm", "expressAlarm_ignore_time"): - tmpexpressList.append(expressList[i]) - expressList = tmpexpressList - - -def expressAlarmExec(typ, freq, data): - """ - call alarmHandler for every entry in expressList - - @return: nothing - """ - logging.debug("data before update from expressList: %s", data) - for i in range(len(expressList)): - #update with eapoc_id (RIC) - data['ric'] = expressList[i][1] - #update with eapoc_sub (Sub RIC) - data['function'] = expressList[i][2] - # Add function as character a-d to dataset (reused from includes/poc.py) - data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d") - #update with eapoc_id (RIC) - data['description'] = expressList[i][1] - logging.debug("data after update from expressList: %s", data) - try: - from includes import alarmHandler - alarmHandler.processAlarmHandler(typ, freq, data) - except: - logging.error("processing alarm failed") - logging.debug("processing alarm failed", exc_info=True) \ No newline at end of file From 5503ac0be894327cab61e438f95e754dc4550a65 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:52:39 +0200 Subject: [PATCH 004/114] Delete config.template.ini --- config.template.ini | 511 -------------------------------------------- 1 file changed, 511 deletions(-) delete mode 100644 config.template.ini diff --git a/config.template.ini b/config.template.ini deleted file mode 100644 index f3373f3..0000000 --- a/config.template.ini +++ /dev/null @@ -1,511 +0,0 @@ -######################## -# BOSWatch Config File # -######################## - -[BOSWatch] -# set loglevel for logfile -# 10 = debug -# 20 = info -# 30 = warning -# 40 = error -# 50 = critical -loglevel = 10 - -# BOSWatch uses a rotating logfile -# Rotating is at midnight -# You can set the backupCount here -# backupCount = 7 (keeps logfiles for 7 days) -backupCount = 7 - -# if you want to start BOSWatch as a daemon with rc2.d, -# you have to set the path to rtl_fm and multimon-ng ! -# both pathes have to end with an / -#rtl_path = /usr/local/bin/ -#multimon_path = /usr/local/bin/ - -# if you are using many plugins or plugins with a long execution time -# you can execute them in an asynchronous manner -# It must be pointed out that enabling (0|1) this consumes time, -# so don't use it for one rapid plugin -processAlarmAsync = 0 - -# Using RegEx-filter (0 - off | 1 - on) -# filter-configuration in section [Filters] -useRegExFilter = 0 - -# for double check save the last n IDs -# it is used in combination with double_ignore_time -# 1 is required if you want to use the double alarm filter -doubleFilter_ignore_entries = 10 - -# time to ignore same alarm (only ID is checked) (sec) -doubleFilter_ignore_time = 5 - -# ignore msg is only usefull for POCSAG (0 - off | 1 - on) -# 0: double check ignores the msg-text (only check ID + function) -# 1: if you want to differentiate between with/ without msg -# f.e. if they use quick-alarm (without text, then same RIC with msg) -# you will get more then one alarm anyway if the msg is different (receiving-problems) -doubleFilter_check_msg = 0 - -# writes the multimon-ng raw data stream into a text file named mm_raw.txt -writeMultimonRaw = 0 - -[NMAHandler] -# you can use a logging handler for sending logging records to NotifyMyAndroid -# enableHandler (0|1) will enable the NMA handler -enableHandler = 0 - -# loglevel for NMAHandler (see BOSWatch loglevel description) -loglevel = 50 - -# logging record will send to APIKey -APIKey = - -# you can change the name of the application (default: BOSWatch) -# (f.e. if you use more than one instance of BOSWatch) -appName = BOSWatch - - -[FMS] -# look-up-table for adding a description -# using description (0 - off | 1 - on) -# descriptions are loaded from csv/fms.csv -idDescribed = 0 - -# Check for correct CRC-information is provided by multimon-ng -# As this seems to be incorrect in many cases it might be useful to disable this -# (0 - off | 1 - on) -# Better use RegEX to verify the correct data -checkCRC = 0 - -[ZVEI] -# look-up-table for adding a description -# using description (0 - off | 1 - on) -# descriptions are loaded from csv/zvei.csv -idDescribed = 0 - -[POC] -# some very simple filters: -# Allow only this RICs (empty: allow all, separator ",") -# f.e.: allow_ric = 1234566,1234567,1234568 -allow_ric = - -# Deny this RICs (empty: allow all, separator ",") -# f.e.: deny_ric = 1234566,1234567,1234568 -deny_ric = - -# start and end of an allowed filter range -filter_range_start = 0000000 -filter_range_end = 9999999 - -# look-up-table for adding a description -# using description (0 - off | 1 - on) -# descriptions are loaded from csv/poc.csv -idDescribed = 0 - -# Static Massages for Subrics. -rica = Feuer -ricb = TH -ricc = AGT -ricd = Unwetter - -# RIC for net identification -# Usually sent periodically, separated by comma -netIdent_ric = 0174760, 1398098 - -[ExpressAlarm] -# Using Express-Alarm (0 - off | 1 - on) -expressAlarm = 0 - -# time limit for alarms that do not belong to the Express-Alarm sequence -expressAlarm_ignore_time = 15 - -# Express-Alarm delimiter RIC -expressAlarm_delimiter_ric = - -# Express-Alarm RIC that is used to send the message -expressAlarm_ric = - -[Filters] -# RegEX Filter Configuration -# http://www.regexr.com/ - RegEX Test Tool an Documentation -# No Filter for a Typ/Plugin Combination = all Data pass -# INDIVIDUAL_NAME = TYP;DATAFIELD;PLUGIN;FREQUENZ;REGEX -# TYP = the Data Typ (FMS|ZVEI|POC) -# DATAFIELD = the field of the Data Array (see readme.md in plugin folder) -# PLUGIN = the name of the Plugin to call with this Filter (* for all) -# FREQUENZ = the Frequenz to use the Filter (for more SDR Sticks (* for all)) -# REGEX = the RegEX - -# only ZVEI to all plugins with 25### at 85.5MHz -#testfilter = ZVEI;zvei;*;85500000;25[0-9]{3} - -# only POCSAG to MySQL with the text "ALARM:" in the message -#pocTest = POC;msg;MySQL;*;ALARM: - - -[Plugins] -# turn the plugins on or off (0 - off | 1 - on) -MySQL = 0 -httpRequest = 0 -eMail = 0 -BosMon = 0 -firEmergency = 0 -jsonSocket = 0 -notifyMyAndroid = 0 -SMS = 0 -Sms77 = 0 -FFAgent = 0 -Pushover = 0 -Telegram = 0 -yowsup = 0 - -# for developing template-module -template = 0 - - -[MySQL] -# MySQL configuration -dbserver = localhost -dbuser = boswatch -dbpassword = root -database = boswatch - -# tables in the database -tableFMS = bos_fms -tableZVEI = bos_zvei -tablePOC = bos_pocsag -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 - -# %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 from csv-file -# %TIME% = Time (by script) -# %DATE% = Date (by script) -#fms_url = http://www.google.de?code=%FMS%&stat=%STATUS% -fms_url = - -# %ZVEI% = ZVEI 5-tone Code -# %DESCR% = Description from csv-file -# %TIME% = Time (by script) -# %DATE% = Date (by script) -#zvei_url = http://www.google.de?zvei=%ZVEI% -zvei_url = - -# %RIC% = POCSAG RIC -# %FUNC% = POCSAG function/Subric (1-4) -# %FUNCCHAR% = POCSAG function/Subric as character (a-d) -# %FUNCTEXT% = POCSAG function/Subric static massage definded in POCSAG section -# %MSG% = Message of the POCSAG telegram -# %BITRATE% = Bitrate of the POCSAG telegram -# %DESCR% = Description from csv-file -# %TIME% = Time (by script) -# %DATE% = Date (by script) -#poc_url = http://www.google.de?ric=%RIC%&subric=%FUNC%&msg=%MSG% -poc_url = - - -[eMail] -# SMTP-Server -smtp_server = localhost -# Port of SMTP-server (default: ) -smtp_port = -# use tls for connection (0|1) -tls = 0 -# Use this, when SMTP-server has restricted access -user = -password = - -# Parameters for Alarm-Msg: -# "to" can be more than one address, comma separated -from = local@localhost -to = user@irgendwo, user2@woanders - -# Priority of the eMail: -# normal|urgent|non-urgent -priority = urgent - -# %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) -# %BR% = Insert line wrap (only in message) -# %LPAR% = ( -# %RPAR% = ) -fms_subject = FMS: %FMS% -fms_message = %DATE% %TIME%: %FMS%%BR%Status: %STATUS% - Direction: %DIRT% - TSI: %TSI% - -# %ZVEI% = ZVEI 5-tone Code -# %DESCR% = Description, if description-module is used -# %DATE% = Date (by script) -# %TIME% = Time (by script) -# %BR% = Insert line wrap (only in message) -# %LPAR% = ( -# %RPAR% = ) -zvei_subject = Alarm: %ZVEI% -zvei_message = %DATE% %TIME%: %ZVEI% - -# %RIC% = POCSAG RIC -# %FUNC% = POCSAG function/Subric (1-4) -# %FUNCCHAR% = POCSAG function/Subric als character (a-d) -# %FUNCTEXT% = POCSAG function/Subric static massage definded in POCSAG section -# %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) -# %BR% = Insert line wrap (only in message) -# %LPAR% = ( -# %RPAR% = ) -poc_subject = Alarm: %RIC%%LPAR%%FUNCCHAR%%RPAR% -poc_message = %DATE% %TIME% - %DESCR%: %MSG% - - -[BosMon] -# IP-address of the server (without http://) -# actually no SSL-support -bosmon_server = 192.168.0.1 -bosmon_port = 80 - -# channel-name of type "Web-Telegramm" -bosmon_channel = channel - -# Use this, when BosMon has restricted access -bosmon_user = -bosmon_password = - - -[firEmergency] -# firEmergency configuration -firserver = localhost -firport = 9001 - - -[jsonSocket] -# Protocol for socket (TCP|UDP) -protocol = UDP -# IP-address of the server (without http://) -server = 192.168.0.1 -port = 8888 - - -[notifyMyAndroid] -# APIKey given from notifyMyAndroid -APIKey = - -# Priority goes from -2 (lowest) to 2 (highest). The default priority is 0 (normal) -priority = 0 - -# You can change the name of the application (default: BOSWatch) -# (f.e. if you use more than one instance of BOSWatch) -appName = BOSWatch - -# instead of a given APIKey/priority you could import them by a csv-file (0|1) -# APIKey and priority above will be ignored, if you use a csv -# configuration loaded from csv/nma.csv -usecsv = 0 - - -[SMS] -# be aware that you need 'gammu' installed and running -# at least you need an UMTS-stick which is supported by 'gammu' - -quantity = 1 -# be sensitive to single RIC -ric1 = 1234567 - -# but you can watch several subrics, comma-separated -subric1 = a, b - -# a single cellphone-number -phonenumber1 = 0160321654987 - -# and the text for the sms -# ! DO NOT USE ANY UMLAUT ! -text1 = Rueckruf Leitstelle! - - -[Sms77] -# SMS77 configuration -# Login Username -user = - -# Password or API Key -password = - -# Receiver singlenumber or groupname from adressbook -to = - -# Sender number or name -from = - -# Type of Message (see https://www.sms77.de/funktionen/smstypen and https://www.sms77.de/funktionen/http-api) -type = quality - - -[FFAgent] -# set live mode (0/1) -live = 0 - -# send messages as type test (0/1) -test = 1 - -# path to server certificate file -serverCertFile = - -# path to client certificate file (LIVE) -clientCertFile = - -# path to client certificate password file (LIVE) -clientCertPass = - -# webapi token -webApiToken = - -# webapi key -webApiKey = - -# access token -accessToken = - -# selective Call Code -selectiveCallCode = - - -[Pushover] -# Pushover API Key -api_key = - -# Pushover Userkey or Groupkey to receive message -user_key = - -# Title of the message -title = BOSWatch Message - -# Adapt Pocsag Subric (a,b,c,d) to Pushover Priorities (see https://pushover.net/api#priority) -SubA = 0 -SubB = 2 -SubC = 1 -SubD = 0 - -# how often should Pushover re-alert in seconds (emergency-messages) -retry = 30 - -# when should Pushover stop to re-alert in seconds (emergency-messages) -expire = 90 - -# use HTML in messages (0/1) -html = 1 - - -[Telegram] -# This is your unique BOT token. You will get it from the BotFather once you have created your BOT. -BOTTokenAPIKey = -# Create a group chat with your BOT and enter the chat ID here. -# The plugin will send messages as your BOT and post everything in this group chat. -BOTChatIDAPIKey = -# The plugin can extract a location from the POCSAG message. -# However, this will be done for the following RIC only (7 digits e.g. 0012345). -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 = -# WhatsApp-number of that the news comes -sender = -# password from this number -password= - -# %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% - - -##################### -##### Not ready yet # -##################### - -[template] -test1 = testString -test2 = 123456 From 990ef0ff1ce39f469eebde1a1be96ae2df58e8bc Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:53:02 +0200 Subject: [PATCH 005/114] Delete poc.py --- poc.py | 156 --------------------------------------------------------- 1 file changed, 156 deletions(-) delete mode 100644 poc.py diff --git a/poc.py b/poc.py deleted file mode 100644 index 1c9816b..0000000 --- a/poc.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/python -# -*- coding: UTF-8 -*- - -""" -POCSAG Decoder - -@author: Bastian Schroll -@author: Jens Herrmann - -@requires: Configuration has to be set in the config.ini -""" - -import logging # Global logger -import re # Regex for validation - -from includes import globalVars # Global variables -from includes import doubleFilter # double alarm filter - -## -# -# Simple local filter -# -def isAllowed(poc_id): - """ - Simple Filter Functions (Allowed, Denied and Range) - - @type poc_id: string - @param poc_id: POCSAG Ric - - @requires: Configuration has to be set in the config.ini - - @return: Checks both allow/deny-rule and filter-range (suitable for signal-RIC) - @exception: none - """ - - allowed = 0 - - # 1.) If allowed RICs is set, only they will path, - # If RIC is the right one return True, else False - if globalVars.config.get("POC", "allow_ric"): - if poc_id in globalVars.config.get("POC", "allow_ric"): - logging.info("RIC %s is allowed", poc_id) - return True - else: - logging.info("RIC %s is not in the allowed list", poc_id) - allowed = 0 - # 2.) If denied RIC, return False - if poc_id in globalVars.config.get("POC", "deny_ric"): - logging.info("RIC %s is denied by config.ini", poc_id) - return False # RIC is denied - strongest way to block - # 3.) Check Range, return False if outside def. range - if globalVars.config.getint("POC", "filter_range_start") < int(poc_id) < globalVars.config.getint("POC", "filter_range_end"): - logging.info("RIC %s in between filter range", poc_id) - return True - else: - logging.info("RIC %s out of filter range", poc_id) - allowed = 0 - # 4.) Implementation for net identifiers - if globalVars.config.get("POC", "netIdent_ric"): - if poc_id in globalVars.config.get("POC", "netIdent_ric"): - logging.info("RIC %s as net identifier", poc_id) - return True - else: - allowed = 0 - - if allowed == 0: - return False - return True - -## -# -# POCSAG decoder function -# validate -> check double alarm -> log -# -def decode(freq, decoded): - """ - Export POCSAG information from Multimon-NG string and call alarmHandler.processAlarmHandler() - - @type freq: string - @param freq: frequency of the SDR Stick - @type decoded: string - @param decoded: RAW Information from Multimon-NG - - @requires: Configuration has to be set in the config.ini - - @return: nothing - @exception: Exception if POCSAG decode failed - """ - try: - bitrate = 0 - - if "POCSAG512:" in decoded: - bitrate = 512 - poc_id = decoded[20:27].replace(" ", "").zfill(7) - poc_sub = str(int(decoded[39])+1) - - elif "POCSAG1200:" in decoded: - bitrate = 1200 - poc_id = decoded[21:28].replace(" ", "").zfill(7) - poc_sub = str(int(decoded[40])+1) - - elif "POCSAG2400:" in decoded: - bitrate = 2400 - poc_id = decoded[21:28].replace(" ", "").zfill(7) - poc_sub = str(int(decoded[40])+1) - - if bitrate is 0: - logging.warning("POCSAG Bitrate not found") - logging.debug(" - (%s)", decoded) - else: - logging.debug("POCSAG Bitrate: %s", bitrate) - - if "Alpha:" in decoded: #check if there is a text message - poc_text = decoded.split('Alpha: ')[1].strip().replace('','').replace('','').replace('','').replace('','').strip() - else: - poc_text = "" - - if re.search("[0-9]{7}", poc_id) and re.search("[1-4]{1}", poc_sub): #if POC is valid - if isAllowed(poc_id): - # check for double alarm - if doubleFilter.checkID("POC", poc_id+poc_sub, poc_text): - logging.info("POCSAG%s: %s %s %s ", bitrate, poc_id, poc_sub, poc_text) - data = {"ric":poc_id, "function":poc_sub, "msg":poc_text, "bitrate":bitrate, "description":poc_id} - # Add function as character a-d to dataset - data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d") - # If enabled, look up description - if globalVars.config.getint("POC", "idDescribed"): - from includes import descriptionList - data["description"] = descriptionList.getDescription("POC", poc_id+data["functionChar"]) - # Express-Alarm processing if enabled and message without text ord delimiter RIC received - if globalVars.config.getint("ExpressAlarm", "expressAlarm") and (poc_text == "" or poc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_delimiter_ric")): - logging.debug("POCSAG%s: %s %s %s - Express-Alarm or delimiter RIC received - buffer until text received", bitrate, poc_id, poc_sub, poc_text) - from includes import expressAlarm - expressAlarm.newEntryExpressList("POC", poc_id, poc_sub, poc_text) - # Express-Alarm processing if enabled and alarm message has been received - elif globalVars.config.getint("ExpressAlarm", "expressAlarm") and poc_text != "" and poc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_ric"): - logging.debug("EA RIC with text message - POCSAG%s: %s %s %s", bitrate, poc_id, poc_sub, poc_text) - from includes import expressAlarm - expressAlarm.expressAlarmExec("POC", freq, data) - else: - # processing the alarm - try: - from includes import alarmHandler - alarmHandler.processAlarmHandler("POC", freq, data) - except: - logging.error("processing alarm failed") - logging.debug("processing alarm failed", exc_info=True) - # in every time save old data for double alarm - doubleFilter.newEntry(poc_id+poc_sub, poc_text) - else: - logging.debug("POCSAG%s: %s is not allowed", bitrate, poc_id) - else: - logging.warning("No valid POCSAG%s RIC: %s SUB: %s", bitrate, poc_id, poc_sub) - except: - logging.error("error while decoding") - logging.debug("error while decoding", exc_info=True) From 3532a64cf175b96f39423eb8c19efdc32b8cb1d4 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:53:12 +0200 Subject: [PATCH 006/114] Delete testdata.txt --- testdata.txt | 136 --------------------------------------------------- 1 file changed, 136 deletions(-) delete mode 100644 testdata.txt diff --git a/testdata.txt b/testdata.txt deleted file mode 100644 index 83dd6c8..0000000 --- a/testdata.txt +++ /dev/null @@ -1,136 +0,0 @@ -# Testdata for the BOSWatch Test Mode function -# Data in Multimon-NG Raw Format -# Data is alternately passed to the decoder to simulate an used Radio-Frequency - -# -# POCSAG -# ------ -# -# The following settings in config.ini are expected for POCSAG -# -# [BOSWatch] -# useDescription = 1 -# doubleFilter_ignore_entries = 10 -# doubleFilter_check_msg = 1 -# -# [POC] -# deny_ric = 7777777 -# filter_range_start = 0000005 -# filter_range_end = 8999999 -# idDescribed = 1 -# - -# bitrate -POCSAG512: Address: 1000512 Function: 1 Alpha: BOSWatch-Test ÖÄÜß: okay -POCSAG1200: Address: 1001200 Function: 1 Alpha: BOSWatch-Test: okay -POCSAG2400: Address: 1002400 Function: 1 Alpha: BOSWatch-Test: okay - -# function-code -POCSAG512: Address: 1000000 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 1000001 Function: 1 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 1000002 Function: 2 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 1000003 Function: 3 Alpha: BOSWatch-Test: okay - -# german special sign -POCSAG512: Address: 1200001 Function: 1 Alpha: BOSWatch-Test ÖÄÜß: okay -POCSAG512: Address: 1200001 Function: 1 Alpha: BOSWatch-Test öäü: okay - -# with csv -POCSAG512: Address: 1234567 Function: 1 Alpha: BOSWatch-Test: with csv - -# without csv -POCSAG1200: Address: 2345678 Function: 2 Alpha: BOSWatch-Test: without csv -POCSAG2400: Address: 3456789 Function: 3 Alpha: BOSWatch-Test: without csv - -# OHNE TEXT???? -POCSAG1200: Address: 1100000 Function: 0 -POCSAG1200: Address: 1100000 Function: 1 -POCSAG1200: Address: 1100000 Function: 2 -POCSAG1200: Address: 1100000 Function: 3 - -# duplicate with same and other msg -POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Testing: okay - -# duplicate in different order -POCSAG1200: Address: 2100000 Function: 2 -POCSAG1200: Address: 2100001 Function: 2 -POCSAG1200: Address: 2100002 Function: 2 -POCSAG1200: Address: 2100000 Function: 2 -POCSAG1200: Address: 2100001 Function: 2 -POCSAG1200: Address: 2100002 Function: 2 -POCSAG1200: Address: 2100000 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2100001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2100002 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2100000 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2100001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2100002 Function: 2 Alpha: BOSWatch-Test: second is a duplicate - -# invalid -POCSAG512: Address: 3 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 33 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 333 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 3333 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 33333 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 333333 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 3333333 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 333333F Function: 0 Alpha: BOSWatch-Test: invalid -POCSAG512: Address: 333333F Function: 1 Alpha: BOSWatch-Test: invalid -POCSAG512: Address: 3333333 Function: 4 Alpha: BOSWatch-Test: invalid - -# denied -POCSAG1200: Address: 7777777 Function: 1 Alpha: BOSWatch-Test: denied - -# out of filter Range -#POCSAG1200: Address: 0000004 Function: 1 Alpha: BOSWatch-Test: out of filter start -#POCSAG1200: Address: 9000000 Function: 1 Alpha: BOSWatch-Test: out of filter end -# -##Probealram -POCSAG1200: Address: 0871004 Function: 1 Alpha: Dies ist ein Probealarm! -## Express Alarm -POCSAG1200: Address: 0871002 Function: 0 Alpha: -POCSAG1200: Address: 0860001 Function: 0 -POCSAG1200: Address: 0860002 Function: 0 -POCSAG1200: Address: 0860003 Function: 0 -POCSAG1200: Address: 0860004 Function: 0 -POCSAG1200: Address: 0860005 Function: 0 -POCSAG1200: Address: 0860006 Function: 0 -POCSAG1200: Address: 0860007 Function: 0 -POCSAG1200: Address: 0860008 Function: 0 -POCSAG1200: Address: 0860009 Function: 0 -POCSAG1200: Address: 0860010 Function: 0 -POCSAG1200: Address: 0871003 Function: 0 Alpha: B2 Feuer Gebäude Pers in Gefahr. bla bla bla - -# regEx-Filter? - - -# -# FMS -# --- -# -FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=I (ohneNA,ohneSIGNAL)) CRC correct -FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=I (ohneNA,ohneSIGNAL)) CRC correct -FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=II (ohneNA,mit SIGNAL)) CRC correct -FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC correct -FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=IV (mit NA,mit SIGNAL)) CRC correct - - -# -# ZVEI -# ---- -# - -#with csv description -ZVEI1: 12345 -#without csv description -ZVEI1: 56789 -#duplicate -ZVEI1: 56789 -#with repeat Tone -ZVEI1: 1F2F3 -#in case of invalid id -ZVEI1: 135 -#in case of a double-tone for siren n-'D's are sended -ZVEI1: DDD -ZVEI1: DDDDD From e770937c6d296f0d17d88087c59202e0a17dd361 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:54:01 +0200 Subject: [PATCH 007/114] Add files via upload added options for Express-Alarm --- config/testdata.txt | 136 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 config/testdata.txt diff --git a/config/testdata.txt b/config/testdata.txt new file mode 100644 index 0000000..83dd6c8 --- /dev/null +++ b/config/testdata.txt @@ -0,0 +1,136 @@ +# Testdata for the BOSWatch Test Mode function +# Data in Multimon-NG Raw Format +# Data is alternately passed to the decoder to simulate an used Radio-Frequency + +# +# POCSAG +# ------ +# +# The following settings in config.ini are expected for POCSAG +# +# [BOSWatch] +# useDescription = 1 +# doubleFilter_ignore_entries = 10 +# doubleFilter_check_msg = 1 +# +# [POC] +# deny_ric = 7777777 +# filter_range_start = 0000005 +# filter_range_end = 8999999 +# idDescribed = 1 +# + +# bitrate +POCSAG512: Address: 1000512 Function: 1 Alpha: BOSWatch-Test ÖÄÜß: okay +POCSAG1200: Address: 1001200 Function: 1 Alpha: BOSWatch-Test: okay +POCSAG2400: Address: 1002400 Function: 1 Alpha: BOSWatch-Test: okay + +# function-code +POCSAG512: Address: 1000000 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 1000001 Function: 1 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 1000002 Function: 2 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 1000003 Function: 3 Alpha: BOSWatch-Test: okay + +# german special sign +POCSAG512: Address: 1200001 Function: 1 Alpha: BOSWatch-Test ÖÄÜß: okay +POCSAG512: Address: 1200001 Function: 1 Alpha: BOSWatch-Test öäü: okay + +# with csv +POCSAG512: Address: 1234567 Function: 1 Alpha: BOSWatch-Test: with csv + +# without csv +POCSAG1200: Address: 2345678 Function: 2 Alpha: BOSWatch-Test: without csv +POCSAG2400: Address: 3456789 Function: 3 Alpha: BOSWatch-Test: without csv + +# OHNE TEXT???? +POCSAG1200: Address: 1100000 Function: 0 +POCSAG1200: Address: 1100000 Function: 1 +POCSAG1200: Address: 1100000 Function: 2 +POCSAG1200: Address: 1100000 Function: 3 + +# duplicate with same and other msg +POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Testing: okay + +# duplicate in different order +POCSAG1200: Address: 2100000 Function: 2 +POCSAG1200: Address: 2100001 Function: 2 +POCSAG1200: Address: 2100002 Function: 2 +POCSAG1200: Address: 2100000 Function: 2 +POCSAG1200: Address: 2100001 Function: 2 +POCSAG1200: Address: 2100002 Function: 2 +POCSAG1200: Address: 2100000 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100002 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100000 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate +POCSAG1200: Address: 2100002 Function: 2 Alpha: BOSWatch-Test: second is a duplicate + +# invalid +POCSAG512: Address: 3 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 33 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 333 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 3333 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 33333 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 333333 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 3333333 Function: 0 Alpha: BOSWatch-Test: okay +POCSAG512: Address: 333333F Function: 0 Alpha: BOSWatch-Test: invalid +POCSAG512: Address: 333333F Function: 1 Alpha: BOSWatch-Test: invalid +POCSAG512: Address: 3333333 Function: 4 Alpha: BOSWatch-Test: invalid + +# denied +POCSAG1200: Address: 7777777 Function: 1 Alpha: BOSWatch-Test: denied + +# out of filter Range +#POCSAG1200: Address: 0000004 Function: 1 Alpha: BOSWatch-Test: out of filter start +#POCSAG1200: Address: 9000000 Function: 1 Alpha: BOSWatch-Test: out of filter end +# +##Probealram +POCSAG1200: Address: 0871004 Function: 1 Alpha: Dies ist ein Probealarm! +## Express Alarm +POCSAG1200: Address: 0871002 Function: 0 Alpha: +POCSAG1200: Address: 0860001 Function: 0 +POCSAG1200: Address: 0860002 Function: 0 +POCSAG1200: Address: 0860003 Function: 0 +POCSAG1200: Address: 0860004 Function: 0 +POCSAG1200: Address: 0860005 Function: 0 +POCSAG1200: Address: 0860006 Function: 0 +POCSAG1200: Address: 0860007 Function: 0 +POCSAG1200: Address: 0860008 Function: 0 +POCSAG1200: Address: 0860009 Function: 0 +POCSAG1200: Address: 0860010 Function: 0 +POCSAG1200: Address: 0871003 Function: 0 Alpha: B2 Feuer Gebäude Pers in Gefahr. bla bla bla + +# regEx-Filter? + + +# +# FMS +# --- +# +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=I (ohneNA,ohneSIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=I (ohneNA,ohneSIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=II (ohneNA,mit SIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC correct +FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=IV (mit NA,mit SIGNAL)) CRC correct + + +# +# ZVEI +# ---- +# + +#with csv description +ZVEI1: 12345 +#without csv description +ZVEI1: 56789 +#duplicate +ZVEI1: 56789 +#with repeat Tone +ZVEI1: 1F2F3 +#in case of invalid id +ZVEI1: 135 +#in case of a double-tone for siren n-'D's are sended +ZVEI1: DDD +ZVEI1: DDDDD From fbc3e53a1df6303a73e984ebf5bc31c05169c395 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:54:26 +0200 Subject: [PATCH 008/114] Delete testdata.txt --- config/testdata.txt | 136 -------------------------------------------- 1 file changed, 136 deletions(-) delete mode 100644 config/testdata.txt diff --git a/config/testdata.txt b/config/testdata.txt deleted file mode 100644 index 83dd6c8..0000000 --- a/config/testdata.txt +++ /dev/null @@ -1,136 +0,0 @@ -# Testdata for the BOSWatch Test Mode function -# Data in Multimon-NG Raw Format -# Data is alternately passed to the decoder to simulate an used Radio-Frequency - -# -# POCSAG -# ------ -# -# The following settings in config.ini are expected for POCSAG -# -# [BOSWatch] -# useDescription = 1 -# doubleFilter_ignore_entries = 10 -# doubleFilter_check_msg = 1 -# -# [POC] -# deny_ric = 7777777 -# filter_range_start = 0000005 -# filter_range_end = 8999999 -# idDescribed = 1 -# - -# bitrate -POCSAG512: Address: 1000512 Function: 1 Alpha: BOSWatch-Test ÖÄÜß: okay -POCSAG1200: Address: 1001200 Function: 1 Alpha: BOSWatch-Test: okay -POCSAG2400: Address: 1002400 Function: 1 Alpha: BOSWatch-Test: okay - -# function-code -POCSAG512: Address: 1000000 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 1000001 Function: 1 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 1000002 Function: 2 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 1000003 Function: 3 Alpha: BOSWatch-Test: okay - -# german special sign -POCSAG512: Address: 1200001 Function: 1 Alpha: BOSWatch-Test ÖÄÜß: okay -POCSAG512: Address: 1200001 Function: 1 Alpha: BOSWatch-Test öäü: okay - -# with csv -POCSAG512: Address: 1234567 Function: 1 Alpha: BOSWatch-Test: with csv - -# without csv -POCSAG1200: Address: 2345678 Function: 2 Alpha: BOSWatch-Test: without csv -POCSAG2400: Address: 3456789 Function: 3 Alpha: BOSWatch-Test: without csv - -# OHNE TEXT???? -POCSAG1200: Address: 1100000 Function: 0 -POCSAG1200: Address: 1100000 Function: 1 -POCSAG1200: Address: 1100000 Function: 2 -POCSAG1200: Address: 1100000 Function: 3 - -# duplicate with same and other msg -POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2000001 Function: 2 Alpha: BOSWatch-Testing: okay - -# duplicate in different order -POCSAG1200: Address: 2100000 Function: 2 -POCSAG1200: Address: 2100001 Function: 2 -POCSAG1200: Address: 2100002 Function: 2 -POCSAG1200: Address: 2100000 Function: 2 -POCSAG1200: Address: 2100001 Function: 2 -POCSAG1200: Address: 2100002 Function: 2 -POCSAG1200: Address: 2100000 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2100001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2100002 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2100000 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2100001 Function: 2 Alpha: BOSWatch-Test: second is a duplicate -POCSAG1200: Address: 2100002 Function: 2 Alpha: BOSWatch-Test: second is a duplicate - -# invalid -POCSAG512: Address: 3 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 33 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 333 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 3333 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 33333 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 333333 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 3333333 Function: 0 Alpha: BOSWatch-Test: okay -POCSAG512: Address: 333333F Function: 0 Alpha: BOSWatch-Test: invalid -POCSAG512: Address: 333333F Function: 1 Alpha: BOSWatch-Test: invalid -POCSAG512: Address: 3333333 Function: 4 Alpha: BOSWatch-Test: invalid - -# denied -POCSAG1200: Address: 7777777 Function: 1 Alpha: BOSWatch-Test: denied - -# out of filter Range -#POCSAG1200: Address: 0000004 Function: 1 Alpha: BOSWatch-Test: out of filter start -#POCSAG1200: Address: 9000000 Function: 1 Alpha: BOSWatch-Test: out of filter end -# -##Probealram -POCSAG1200: Address: 0871004 Function: 1 Alpha: Dies ist ein Probealarm! -## Express Alarm -POCSAG1200: Address: 0871002 Function: 0 Alpha: -POCSAG1200: Address: 0860001 Function: 0 -POCSAG1200: Address: 0860002 Function: 0 -POCSAG1200: Address: 0860003 Function: 0 -POCSAG1200: Address: 0860004 Function: 0 -POCSAG1200: Address: 0860005 Function: 0 -POCSAG1200: Address: 0860006 Function: 0 -POCSAG1200: Address: 0860007 Function: 0 -POCSAG1200: Address: 0860008 Function: 0 -POCSAG1200: Address: 0860009 Function: 0 -POCSAG1200: Address: 0860010 Function: 0 -POCSAG1200: Address: 0871003 Function: 0 Alpha: B2 Feuer Gebäude Pers in Gefahr. bla bla bla - -# regEx-Filter? - - -# -# FMS -# --- -# -FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=I (ohneNA,ohneSIGNAL)) CRC correct -FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=I (ohneNA,ohneSIGNAL)) CRC correct -FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=II (ohneNA,mit SIGNAL)) CRC correct -FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC correct -FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=IV (mit NA,mit SIGNAL)) CRC correct - - -# -# ZVEI -# ---- -# - -#with csv description -ZVEI1: 12345 -#without csv description -ZVEI1: 56789 -#duplicate -ZVEI1: 56789 -#with repeat Tone -ZVEI1: 1F2F3 -#in case of invalid id -ZVEI1: 135 -#in case of a double-tone for siren n-'D's are sended -ZVEI1: DDD -ZVEI1: DDDDD From 9ffa872b74d840e2f87e9622cd1ea560e3fef6ff Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:55:03 +0200 Subject: [PATCH 009/114] Add files via upload added options for Express-Alarm --- config/config.template.ini | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config/config.template.ini b/config/config.template.ini index d943faf..f3373f3 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -114,6 +114,19 @@ ricd = Unwetter # Usually sent periodically, separated by comma netIdent_ric = 0174760, 1398098 +[ExpressAlarm] +# Using Express-Alarm (0 - off | 1 - on) +expressAlarm = 0 + +# time limit for alarms that do not belong to the Express-Alarm sequence +expressAlarm_ignore_time = 15 + +# Express-Alarm delimiter RIC +expressAlarm_delimiter_ric = + +# Express-Alarm RIC that is used to send the message +expressAlarm_ric = + [Filters] # RegEX Filter Configuration # http://www.regexr.com/ - RegEX Test Tool an Documentation From 81a146b78f699164fb10ccf776c31c751dd2a0b3 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:55:59 +0200 Subject: [PATCH 010/114] Add files via upload new function to support Express-Alarm --- includes/expressAlarm.py | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 includes/expressAlarm.py diff --git a/includes/expressAlarm.py b/includes/expressAlarm.py new file mode 100644 index 0000000..03ca5d1 --- /dev/null +++ b/includes/expressAlarm.py @@ -0,0 +1,65 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +""" +expressAlarm is the function to enable BOSwatch to deal with Swissfone Express-Alarm + +@author: Fabian Kessler + +@requires: Configuration has to be set in the config.ini +""" + +import logging # Global logger +import time # timestamp for expressAlarm + +from includes import globalVars # Global variables + +expressList = [] + +def newEntryExpressList(eatyp, eapoc_id, eapoc_sub, eapoc_text): + """ + add entry to express alarm list and remove old entries + + @return: nothing + """ + global expressList + tmpexpressList = [] + timestamp = int(time.time()) + # Express-Alarm processing if enabled and delimiter RIC has been received + if eapoc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_delimiter_ric"): + expressList = [] + logging.debug("Express-Alarm delimiter RIC received --> buffer cleared %s %s %s ", eapoc_id, eapoc_sub, eapoc_text) + else: + expressList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp]) + logging.debug("Added %s %s %s to expressList", eapoc_id, eapoc_sub, eapoc_text) + # check for old entries in expressList + for i in range(len(expressList)): + # we have to remove entries older than timestamp - ignore time + if int(expressList[i][4]) > timestamp-globalVars.config.getint("ExpressAlarm", "expressAlarm_ignore_time"): + tmpexpressList.append(expressList[i]) + expressList = tmpexpressList + + +def expressAlarmExec(typ, freq, data): + """ + call alarmHandler for every entry in expressList + + @return: nothing + """ + logging.debug("data before update from expressList: %s", data) + for i in range(len(expressList)): + #update with eapoc_id (RIC) + data['ric'] = expressList[i][1] + #update with eapoc_sub (Sub RIC) + data['function'] = expressList[i][2] + # Add function as character a-d to dataset (reused from includes/poc.py) + data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d") + #update with eapoc_id (RIC) + data['description'] = expressList[i][1] + logging.debug("data after update from expressList: %s", data) + try: + from includes import alarmHandler + alarmHandler.processAlarmHandler(typ, freq, data) + except: + logging.error("processing alarm failed") + logging.debug("processing alarm failed", exc_info=True) \ No newline at end of file From 46a53dd8dc288d23b0e1c9a73d6ca50f33839a1e Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:56:59 +0200 Subject: [PATCH 011/114] Add files via upload added processing of Express-Alarms --- includes/decoders/poc.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index b0198f0..1c9816b 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -127,13 +127,24 @@ def decode(freq, decoded): if globalVars.config.getint("POC", "idDescribed"): from includes import descriptionList data["description"] = descriptionList.getDescription("POC", poc_id+data["functionChar"]) - # processing the alarm - try: - from includes import alarmHandler - alarmHandler.processAlarmHandler("POC", freq, data) - except: - logging.error("processing alarm failed") - logging.debug("processing alarm failed", exc_info=True) + # Express-Alarm processing if enabled and message without text ord delimiter RIC received + if globalVars.config.getint("ExpressAlarm", "expressAlarm") and (poc_text == "" or poc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_delimiter_ric")): + logging.debug("POCSAG%s: %s %s %s - Express-Alarm or delimiter RIC received - buffer until text received", bitrate, poc_id, poc_sub, poc_text) + from includes import expressAlarm + expressAlarm.newEntryExpressList("POC", poc_id, poc_sub, poc_text) + # Express-Alarm processing if enabled and alarm message has been received + elif globalVars.config.getint("ExpressAlarm", "expressAlarm") and poc_text != "" and poc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_ric"): + logging.debug("EA RIC with text message - POCSAG%s: %s %s %s", bitrate, poc_id, poc_sub, poc_text) + from includes import expressAlarm + expressAlarm.expressAlarmExec("POC", freq, data) + else: + # processing the alarm + try: + from includes import alarmHandler + alarmHandler.processAlarmHandler("POC", freq, data) + except: + logging.error("processing alarm failed") + logging.debug("processing alarm failed", exc_info=True) # in every time save old data for double alarm doubleFilter.newEntry(poc_id+poc_sub, poc_text) else: From f171bda8355effab7a0027ec4183e4a6dd4561e2 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:57:48 +0200 Subject: [PATCH 012/114] Add files via upload added test data for Express-Alarm --- citest/testdata.txt | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/citest/testdata.txt b/citest/testdata.txt index e4ac22e..83dd6c8 100644 --- a/citest/testdata.txt +++ b/citest/testdata.txt @@ -35,7 +35,7 @@ POCSAG512: Address: 1000003 Function: 3 Alpha: BOSWatch-Test: okay POCSAG512: Address: 1200001 Function: 1 Alpha: BOSWatch-Test ÖÄÜß: okay POCSAG512: Address: 1200001 Function: 1 Alpha: BOSWatch-Test öäü: okay -# witch csv +# with csv POCSAG512: Address: 1234567 Function: 1 Alpha: BOSWatch-Test: with csv # without csv @@ -83,8 +83,24 @@ POCSAG512: Address: 3333333 Function: 4 Alpha: BOSWatch-Test: invalid POCSAG1200: Address: 7777777 Function: 1 Alpha: BOSWatch-Test: denied # out of filter Range -POCSAG1200: Address: 0000004 Function: 1 Alpha: BOSWatch-Test: out of filter start -POCSAG1200: Address: 9000000 Function: 1 Alpha: BOSWatch-Test: out of filter end +#POCSAG1200: Address: 0000004 Function: 1 Alpha: BOSWatch-Test: out of filter start +#POCSAG1200: Address: 9000000 Function: 1 Alpha: BOSWatch-Test: out of filter end +# +##Probealram +POCSAG1200: Address: 0871004 Function: 1 Alpha: Dies ist ein Probealarm! +## Express Alarm +POCSAG1200: Address: 0871002 Function: 0 Alpha: +POCSAG1200: Address: 0860001 Function: 0 +POCSAG1200: Address: 0860002 Function: 0 +POCSAG1200: Address: 0860003 Function: 0 +POCSAG1200: Address: 0860004 Function: 0 +POCSAG1200: Address: 0860005 Function: 0 +POCSAG1200: Address: 0860006 Function: 0 +POCSAG1200: Address: 0860007 Function: 0 +POCSAG1200: Address: 0860008 Function: 0 +POCSAG1200: Address: 0860009 Function: 0 +POCSAG1200: Address: 0860010 Function: 0 +POCSAG1200: Address: 0871003 Function: 0 Alpha: B2 Feuer Gebäude Pers in Gefahr. bla bla bla # regEx-Filter? From 70d769862ca5481c2a2c85b08bee684e015d754b Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 21:36:53 +0200 Subject: [PATCH 013/114] Update testdata.txt --- citest/testdata.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/citest/testdata.txt b/citest/testdata.txt index 83dd6c8..bec6559 100644 --- a/citest/testdata.txt +++ b/citest/testdata.txt @@ -83,10 +83,10 @@ POCSAG512: Address: 3333333 Function: 4 Alpha: BOSWatch-Test: invalid POCSAG1200: Address: 7777777 Function: 1 Alpha: BOSWatch-Test: denied # out of filter Range -#POCSAG1200: Address: 0000004 Function: 1 Alpha: BOSWatch-Test: out of filter start -#POCSAG1200: Address: 9000000 Function: 1 Alpha: BOSWatch-Test: out of filter end -# -##Probealram +POCSAG1200: Address: 0000004 Function: 1 Alpha: BOSWatch-Test: out of filter start +POCSAG1200: Address: 9000000 Function: 1 Alpha: BOSWatch-Test: out of filter end + +#Probealram POCSAG1200: Address: 0871004 Function: 1 Alpha: Dies ist ein Probealarm! ## Express Alarm POCSAG1200: Address: 0871002 Function: 0 Alpha: From 7fd88a452bf29b591a23266d50468114f235d8bc Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 21:37:47 +0200 Subject: [PATCH 014/114] Update config.template.ini --- 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 f3373f3..d891580 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -118,7 +118,7 @@ netIdent_ric = 0174760, 1398098 # Using Express-Alarm (0 - off | 1 - on) expressAlarm = 0 -# time limit for alarms that do not belong to the Express-Alarm sequence +# time limit for alarms that do not belong to the Express-Alarm sequence in seconds expressAlarm_ignore_time = 15 # Express-Alarm delimiter RIC From 55f55295d009d2c9d716ca7bb4a0df6d9375b982 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 21:43:57 +0200 Subject: [PATCH 015/114] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ac3d336..4f88d2a 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ unless you are developer you can use the develop-Branch - may be unstable! - Ready for use BOSWatch as daemon - possibility to start plugins asynchron - NMA Error Handler +- Express-Alarm ##### Features for the future: - more plugins From f73e6f215be5c787a05164e8b81c4c8832a901b1 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Sep 2017 22:04:41 +0200 Subject: [PATCH 016/114] edit changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e997ab7..8ef1e91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### __[Unreleased]__ ##### Added +- zuschaltbare POCSAG Express-Alarm Funktionalität ##### Changed ##### Deprecated ##### Removed From 6af6981b68767d8aa7a05369f5625d2870ab5ac5 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 20 Sep 2017 06:25:06 +0200 Subject: [PATCH 017/114] changes for codacy --- includes/expressAlarm.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/includes/expressAlarm.py b/includes/expressAlarm.py index 03ca5d1..5b1c308 100644 --- a/includes/expressAlarm.py +++ b/includes/expressAlarm.py @@ -29,37 +29,37 @@ def newEntryExpressList(eatyp, eapoc_id, eapoc_sub, eapoc_text): if eapoc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_delimiter_ric"): expressList = [] logging.debug("Express-Alarm delimiter RIC received --> buffer cleared %s %s %s ", eapoc_id, eapoc_sub, eapoc_text) - else: + else: expressList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp]) logging.debug("Added %s %s %s to expressList", eapoc_id, eapoc_sub, eapoc_text) # check for old entries in expressList - for i in range(len(expressList)): + for i, exList in enumerate(expressList): # we have to remove entries older than timestamp - ignore time - if int(expressList[i][4]) > timestamp-globalVars.config.getint("ExpressAlarm", "expressAlarm_ignore_time"): - tmpexpressList.append(expressList[i]) + if int(exList[i][4]) > timestamp-globalVars.config.getint("ExpressAlarm", "expressAlarm_ignore_time"): + tmpexpressList.append(exList[i]) expressList = tmpexpressList def expressAlarmExec(typ, freq, data): """ call alarmHandler for every entry in expressList - + @return: nothing """ logging.debug("data before update from expressList: %s", data) - for i in range(len(expressList)): + for i, exList in enumerate(expressList): #update with eapoc_id (RIC) - data['ric'] = expressList[i][1] + data['ric'] = exList[i][1] #update with eapoc_sub (Sub RIC) - data['function'] = expressList[i][2] + data['function'] = exList[i][2] # Add function as character a-d to dataset (reused from includes/poc.py) data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d") #update with eapoc_id (RIC) - data['description'] = expressList[i][1] - logging.debug("data after update from expressList: %s", data) + data['description'] = exList[i][1] + logging.debug("data after update from expressList: %s", data) try: from includes import alarmHandler alarmHandler.processAlarmHandler(typ, freq, data) except: logging.error("processing alarm failed") - logging.debug("processing alarm failed", exc_info=True) \ No newline at end of file + logging.debug("processing alarm failed", exc_info=True) From 0ed8df0202fca78d24045fcb50eb5b6f807a0b76 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 20 Sep 2017 06:31:47 +0200 Subject: [PATCH 018/114] add ExpressAlarm to logging --- boswatch.py | 2 ++ config/config.template.ini | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/boswatch.py b/boswatch.py index e8b7b3a..50b1e03 100755 --- a/boswatch.py +++ b/boswatch.py @@ -217,6 +217,8 @@ try: # if given loglevel is debug: if globalVars.config.getint("BOSWatch","loglevel") == 10: configHandler.checkConfig("BOSWatch") + configHandler.checkConfig("ExpressAlarm") + configHandler.checkConfig("Filters") configHandler.checkConfig("FMS") configHandler.checkConfig("ZVEI") configHandler.checkConfig("POC") diff --git a/config/config.template.ini b/config/config.template.ini index d891580..d1c8c70 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -122,10 +122,10 @@ expressAlarm = 0 expressAlarm_ignore_time = 15 # Express-Alarm delimiter RIC -expressAlarm_delimiter_ric = +expressAlarm_delimiter_ric = # Express-Alarm RIC that is used to send the message -expressAlarm_ric = +expressAlarm_ric = [Filters] # RegEX Filter Configuration From ae03473f940caa9455a5d4ba40b0f80b363d148e Mon Sep 17 00:00:00 2001 From: f-kessler Date: Thu, 21 Sep 2017 12:09:17 +0200 Subject: [PATCH 019/114] Update config.template.ini Hinweis zur delimiter RIC angepasst. --- 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 d1c8c70..e54065e 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -121,7 +121,7 @@ expressAlarm = 0 # time limit for alarms that do not belong to the Express-Alarm sequence in seconds expressAlarm_ignore_time = 15 -# Express-Alarm delimiter RIC +# Express-Alarm delimiter RIC (usually used as a starting point for a Express-Alarm sequence) (can be empty) expressAlarm_delimiter_ric = # Express-Alarm RIC that is used to send the message From 0fc12abf44a2e51ef5e50c1c67c707c5f065c3e5 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Sat, 23 Sep 2017 09:23:49 +0200 Subject: [PATCH 020/114] Changed naming and description --- config/config.template.ini | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/config/config.template.ini b/config/config.template.ini index e54065e..fea5f17 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -114,18 +114,23 @@ ricd = Unwetter # Usually sent periodically, separated by comma netIdent_ric = 0174760, 1398098 -[ExpressAlarm] -# Using Express-Alarm (0 - off | 1 - on) -expressAlarm = 0 +[multicastAlarm] +# Configure multicastAlarm if your POCSAG network uses an optimized transmission scheme for alarms with more than one RIC (often found in Swissphone networks). +# The optimized transmission scheme sends a POCSAG telegram with each RIC that needs to be alarmed in a sequence. These telegrams are send without a text message. This sequence is directly followed by a telegram with a special RIC and the text message. +# A POCSAG pager (DME) can be configured to start an acoustic alarm if a specific RIC without text has been received. If afterwards the RIC with the text message will be received, the pager will show the message in it's display. +# multicastAlarm enables BOSwatch to forward the all received RIC joined with the text message +# +# enable multicastAlarm (0 - off | 1 - on) +multicastAlarm = 0 -# time limit for alarms that do not belong to the Express-Alarm sequence in seconds -expressAlarm_ignore_time = 15 +# time limit for alarms that do not belong to the multicastAlarm sequence in seconds +multicastAlarm_ignore_time = 15 -# Express-Alarm delimiter RIC (usually used as a starting point for a Express-Alarm sequence) (can be empty) -expressAlarm_delimiter_ric = +# multicastAlarm delimiter RIC (usually used as a starting point for a alarm sequence) (can be empty) +multicastAlarm_delimiter_ric = -# Express-Alarm RIC that is used to send the message -expressAlarm_ric = +# multicastAlarm RIC that is used to send the text message +multicastAlarm_ric = [Filters] # RegEX Filter Configuration From 07f42e15d8d1eb1fba7fe1ed0f6409848470741c Mon Sep 17 00:00:00 2001 From: f-kessler Date: Sat, 23 Sep 2017 09:25:08 +0200 Subject: [PATCH 021/114] Changed naming --- includes/expressAlarm.py | 65 -------------------------------------- includes/multicastAlarm.py | 65 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 includes/expressAlarm.py create mode 100644 includes/multicastAlarm.py diff --git a/includes/expressAlarm.py b/includes/expressAlarm.py deleted file mode 100644 index 5b1c308..0000000 --- a/includes/expressAlarm.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -""" -expressAlarm is the function to enable BOSwatch to deal with Swissfone Express-Alarm - -@author: Fabian Kessler - -@requires: Configuration has to be set in the config.ini -""" - -import logging # Global logger -import time # timestamp for expressAlarm - -from includes import globalVars # Global variables - -expressList = [] - -def newEntryExpressList(eatyp, eapoc_id, eapoc_sub, eapoc_text): - """ - add entry to express alarm list and remove old entries - - @return: nothing - """ - global expressList - tmpexpressList = [] - timestamp = int(time.time()) - # Express-Alarm processing if enabled and delimiter RIC has been received - if eapoc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_delimiter_ric"): - expressList = [] - logging.debug("Express-Alarm delimiter RIC received --> buffer cleared %s %s %s ", eapoc_id, eapoc_sub, eapoc_text) - else: - expressList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp]) - logging.debug("Added %s %s %s to expressList", eapoc_id, eapoc_sub, eapoc_text) - # check for old entries in expressList - for i, exList in enumerate(expressList): - # we have to remove entries older than timestamp - ignore time - if int(exList[i][4]) > timestamp-globalVars.config.getint("ExpressAlarm", "expressAlarm_ignore_time"): - tmpexpressList.append(exList[i]) - expressList = tmpexpressList - - -def expressAlarmExec(typ, freq, data): - """ - call alarmHandler for every entry in expressList - - @return: nothing - """ - logging.debug("data before update from expressList: %s", data) - for i, exList in enumerate(expressList): - #update with eapoc_id (RIC) - data['ric'] = exList[i][1] - #update with eapoc_sub (Sub RIC) - data['function'] = exList[i][2] - # Add function as character a-d to dataset (reused from includes/poc.py) - data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d") - #update with eapoc_id (RIC) - data['description'] = exList[i][1] - logging.debug("data after update from expressList: %s", data) - try: - from includes import alarmHandler - alarmHandler.processAlarmHandler(typ, freq, data) - except: - logging.error("processing alarm failed") - logging.debug("processing alarm failed", exc_info=True) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py new file mode 100644 index 0000000..9d00e23 --- /dev/null +++ b/includes/multicastAlarm.py @@ -0,0 +1,65 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +""" +multicastAlarm is the function to enable BOSwatch to deal networks that optimise the transmission of POCSAG telegrams + +@author: Fabian Kessler + +@requires: Configuration has to be set in the config.ini +""" + +import logging # Global logger +import time # timestamp for multicastAlarm + +from includes import globalVars # Global variables + +multiList = [] + +def newEntrymultiList(eatyp, eapoc_id, eapoc_sub, eapoc_text): + """ + add entry to multi alarm list and remove old entries + + @return: nothing + """ + global multiList + tmpmultiList = [] + timestamp = int(time.time()) + # multicastAlarm processing if enabled and delimiter RIC has been received + if eapoc_id == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"): + multiList = [] + logging.debug("multicastAlarm delimiter RIC received --> buffer cleared %s %s %s ", eapoc_id, eapoc_sub, eapoc_text) + else: + multiList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp]) + logging.debug("Added %s %s %s to multiList", eapoc_id, eapoc_sub, eapoc_text) + # check for old entries in multiList + for i in range(len(multiList)): + # we have to remove entries older than timestamp - ignore time + if int(multiList[i][4]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): + tmpmultiList.append(multiList[i]) + multiList = tmpmultiList + + +def multicastAlarmExec(typ, freq, data): + """ + call alarmHandler for every entry in multiList + + @return: nothing + """ + logging.debug("data before update from multiList: %s", data) + for i in range(len(multiList)): + #update with eapoc_id (RIC) + data['ric'] = multiList[i][1] + #update with eapoc_sub (Sub RIC) + data['function'] = multiList[i][2] + # Add function as character a-d to dataset (reused from includes/poc.py) + data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d") + #update with eapoc_id (RIC) + data['description'] = multiList[i][1] + logging.debug("data after update from multiList: %s", data) + try: + from includes import alarmHandler + alarmHandler.processAlarmHandler(typ, freq, data) + except: + logging.error("processing alarm failed") + logging.debug("processing alarm failed", exc_info=True) From d30eee586692bb1338c9b06d4b58a37ac1fd27c1 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Sat, 23 Sep 2017 09:25:43 +0200 Subject: [PATCH 022/114] Updated naming --- includes/decoders/poc.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index 1c9816b..3fc7e15 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -127,16 +127,16 @@ def decode(freq, decoded): if globalVars.config.getint("POC", "idDescribed"): from includes import descriptionList data["description"] = descriptionList.getDescription("POC", poc_id+data["functionChar"]) - # Express-Alarm processing if enabled and message without text ord delimiter RIC received - if globalVars.config.getint("ExpressAlarm", "expressAlarm") and (poc_text == "" or poc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_delimiter_ric")): - logging.debug("POCSAG%s: %s %s %s - Express-Alarm or delimiter RIC received - buffer until text received", bitrate, poc_id, poc_sub, poc_text) - from includes import expressAlarm - expressAlarm.newEntryExpressList("POC", poc_id, poc_sub, poc_text) - # Express-Alarm processing if enabled and alarm message has been received - elif globalVars.config.getint("ExpressAlarm", "expressAlarm") and poc_text != "" and poc_id == globalVars.config.get("ExpressAlarm", "expressAlarm_ric"): + # multicastAlarm processing if enabled and message without text ord delimiter RIC received + if globalVars.config.getint("multicastAlarm", "multicastAlarm") and (poc_text == "" or poc_id == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric")): + logging.debug("POCSAG%s: %s %s %s - multicastAlarm or delimiter RIC received - buffer until text received", bitrate, poc_id, poc_sub, poc_text) + from includes import multicastAlarm + multicastAlarm.newEntrymultiList("POC", poc_id, poc_sub, poc_text) + # multicastAlarm processing if enabled and alarm message has been received + elif globalVars.config.getint("multicastAlarm", "multicastAlarm") and poc_text != "" and poc_id == globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): logging.debug("EA RIC with text message - POCSAG%s: %s %s %s", bitrate, poc_id, poc_sub, poc_text) - from includes import expressAlarm - expressAlarm.expressAlarmExec("POC", freq, data) + from includes import multicastAlarm + multicastAlarm.multicastAlarmExec("POC", freq, data) else: # processing the alarm try: From 06d36b3b48f54b3870d44c37308890517aaefc59 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Sat, 23 Sep 2017 09:30:26 +0200 Subject: [PATCH 023/114] Changed EA to multicastAlarm --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f88d2a..5137f3f 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ unless you are developer you can use the develop-Branch - may be unstable! - Ready for use BOSWatch as daemon - possibility to start plugins asynchron - NMA Error Handler -- Express-Alarm +- multicastAlarm for transmission optimized networks ##### Features for the future: - more plugins From bd733b61b459a68cd0d809839afc5a14a87cf6be Mon Sep 17 00:00:00 2001 From: f-kessler Date: Sun, 24 Sep 2017 12:01:15 +0200 Subject: [PATCH 024/114] changed logging to multicastAlarm --- boswatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boswatch.py b/boswatch.py index 50b1e03..1a92c4a 100755 --- a/boswatch.py +++ b/boswatch.py @@ -217,7 +217,7 @@ try: # if given loglevel is debug: if globalVars.config.getint("BOSWatch","loglevel") == 10: configHandler.checkConfig("BOSWatch") - configHandler.checkConfig("ExpressAlarm") + configHandler.checkConfig("multicastAlarm") configHandler.checkConfig("Filters") configHandler.checkConfig("FMS") configHandler.checkConfig("ZVEI") From 736d0f95ce50c3cbdf9858cba7b53f8ddb75420d Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sun, 24 Sep 2017 12:11:50 +0200 Subject: [PATCH 025/114] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ef1e91..7bf85c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### __[Unreleased]__ ##### Added -- zuschaltbare POCSAG Express-Alarm Funktionalität +- zuschaltbare POCSAG Multicast-Alarm Funktionalität ##### Changed ##### Deprecated ##### Removed From f6e4c8d3a94f5c64a3a533ff872f34301e0b0ae6 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sun, 24 Sep 2017 12:12:27 +0200 Subject: [PATCH 026/114] Update testdata.txt --- citest/testdata.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/citest/testdata.txt b/citest/testdata.txt index bec6559..4f1d5d1 100644 --- a/citest/testdata.txt +++ b/citest/testdata.txt @@ -88,7 +88,7 @@ POCSAG1200: Address: 9000000 Function: 1 Alpha: BOSWatch-Test: out of filter #Probealram POCSAG1200: Address: 0871004 Function: 1 Alpha: Dies ist ein Probealarm! -## Express Alarm +## Multicast Alarm POCSAG1200: Address: 0871002 Function: 0 Alpha: POCSAG1200: Address: 0860001 Function: 0 POCSAG1200: Address: 0860002 Function: 0 From 8069ded206ed3bb649c43f687394fb224053e174 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Mon, 25 Sep 2017 20:47:06 +0200 Subject: [PATCH 027/114] enumerate() instead of range(len()) --- includes/multicastAlarm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index 9d00e23..b96e615 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -33,7 +33,7 @@ def newEntrymultiList(eatyp, eapoc_id, eapoc_sub, eapoc_text): multiList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp]) logging.debug("Added %s %s %s to multiList", eapoc_id, eapoc_sub, eapoc_text) # check for old entries in multiList - for i in range(len(multiList)): + for i in enumerate(multiList): # we have to remove entries older than timestamp - ignore time if int(multiList[i][4]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): tmpmultiList.append(multiList[i]) @@ -47,7 +47,7 @@ def multicastAlarmExec(typ, freq, data): @return: nothing """ logging.debug("data before update from multiList: %s", data) - for i in range(len(multiList)): + for i in enumerate(multiList): #update with eapoc_id (RIC) data['ric'] = multiList[i][1] #update with eapoc_sub (Sub RIC) From 00e4e52352a9c82cec895af393997f50204fe653 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Mon, 25 Sep 2017 20:57:28 +0200 Subject: [PATCH 028/114] Update multicastAlarm.py --- includes/multicastAlarm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index b96e615..a37c58d 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -33,7 +33,7 @@ def newEntrymultiList(eatyp, eapoc_id, eapoc_sub, eapoc_text): multiList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp]) logging.debug("Added %s %s %s to multiList", eapoc_id, eapoc_sub, eapoc_text) # check for old entries in multiList - for i in enumerate(multiList): + for i,j in enumerate(multiList): # we have to remove entries older than timestamp - ignore time if int(multiList[i][4]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): tmpmultiList.append(multiList[i]) @@ -47,7 +47,7 @@ def multicastAlarmExec(typ, freq, data): @return: nothing """ logging.debug("data before update from multiList: %s", data) - for i in enumerate(multiList): + for i,j in enumerate(multiList): #update with eapoc_id (RIC) data['ric'] = multiList[i][1] #update with eapoc_sub (Sub RIC) From 3aa0b382e9e8866d749d3f4861f5ed79c64ee772 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 29 Sep 2017 13:33:21 +0200 Subject: [PATCH 029/114] edit changelog with link --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c5c36a..65372fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,12 @@ ### __[v2.2.3]__ - unreleased ##### Added -- zuschaltbare POCSAG Multicast-Alarm Funktionalität +- zuschaltbare POCSAG Multicast-Alarm Funktionalität [#307](https://github.com/Schrolli91/BOSWatch/pull/307) ##### Changed ##### Deprecated ##### Removed ##### Fixed +- einige Code-Style Verbesserungen ##### Security From c54bd558888bebd2189ca05809c085453091faa1 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sun, 1 Oct 2017 18:06:56 +0200 Subject: [PATCH 030/114] change to data-field at checks --- includes/decoders/poc.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index 3fc7e15..552f06d 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -117,26 +117,31 @@ def decode(freq, decoded): if re.search("[0-9]{7}", poc_id) and re.search("[1-4]{1}", poc_sub): #if POC is valid if isAllowed(poc_id): + # check for double alarm if doubleFilter.checkID("POC", poc_id+poc_sub, poc_text): - logging.info("POCSAG%s: %s %s %s ", bitrate, poc_id, poc_sub, poc_text) data = {"ric":poc_id, "function":poc_sub, "msg":poc_text, "bitrate":bitrate, "description":poc_id} # Add function as character a-d to dataset data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d") + + logging.info("POCSAG%s: %s %s %s ", data["bitrate"], data["ric"], data["function"], data["msg"]) + # If enabled, look up description if globalVars.config.getint("POC", "idDescribed"): from includes import descriptionList - data["description"] = descriptionList.getDescription("POC", poc_id+data["functionChar"]) + data["description"] = descriptionList.getDescription("POC", data["ric"]+data["functionChar"]) + # multicastAlarm processing if enabled and message without text ord delimiter RIC received - if globalVars.config.getint("multicastAlarm", "multicastAlarm") and (poc_text == "" or poc_id == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric")): - logging.debug("POCSAG%s: %s %s %s - multicastAlarm or delimiter RIC received - buffer until text received", bitrate, poc_id, poc_sub, poc_text) + if globalVars.config.getint("multicastAlarm", "multicastAlarm") and (data["msg"] == "" or data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric")): + logging.debug(" - multicastAlarm or delimiter RIC received - buffer alarms until text received") from includes import multicastAlarm multicastAlarm.newEntrymultiList("POC", poc_id, poc_sub, poc_text) # multicastAlarm processing if enabled and alarm message has been received - elif globalVars.config.getint("multicastAlarm", "multicastAlarm") and poc_text != "" and poc_id == globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): - logging.debug("EA RIC with text message - POCSAG%s: %s %s %s", bitrate, poc_id, poc_sub, poc_text) + elif globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["msg"] != "" and data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): + logging.debug(" - multicastAlarm RIC with text message") from includes import multicastAlarm multicastAlarm.multicastAlarmExec("POC", freq, data) + else: # processing the alarm try: From b6077d522d02e094c2820e8a47f9fa6e864134b3 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Mon, 2 Oct 2017 15:32:01 +0200 Subject: [PATCH 031/114] enumerate value correction --- includes/multicastAlarm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index a37c58d..031c6e3 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -33,7 +33,7 @@ def newEntrymultiList(eatyp, eapoc_id, eapoc_sub, eapoc_text): multiList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp]) logging.debug("Added %s %s %s to multiList", eapoc_id, eapoc_sub, eapoc_text) # check for old entries in multiList - for i,j in enumerate(multiList): + for i, _ in enumerate(multiList): # we have to remove entries older than timestamp - ignore time if int(multiList[i][4]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): tmpmultiList.append(multiList[i]) @@ -47,7 +47,7 @@ def multicastAlarmExec(typ, freq, data): @return: nothing """ logging.debug("data before update from multiList: %s", data) - for i,j in enumerate(multiList): + for i, _ in enumerate(multiList): #update with eapoc_id (RIC) data['ric'] = multiList[i][1] #update with eapoc_sub (Sub RIC) From 166dd3e3f8dd7ee0c050ca48d661edbca3707a3c Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 3 Oct 2017 11:38:24 +0200 Subject: [PATCH 032/114] changed data buffering and updating for alarms --- includes/multicastAlarm.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index 031c6e3..a2a9a0c 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -multicastAlarm is the function to enable BOSwatch to deal networks that optimise the transmission of POCSAG telegrams +multicastAlarm is the function to enable BOSwatch to work in networks that optimise the transmission of POCSAG telegrams @author: Fabian Kessler @@ -16,7 +16,7 @@ from includes import globalVars # Global variables multiList = [] -def newEntrymultiList(eatyp, eapoc_id, eapoc_sub, eapoc_text): +def newEntrymultiList(typ, freq, data): """ add entry to multi alarm list and remove old entries @@ -26,16 +26,16 @@ def newEntrymultiList(eatyp, eapoc_id, eapoc_sub, eapoc_text): tmpmultiList = [] timestamp = int(time.time()) # multicastAlarm processing if enabled and delimiter RIC has been received - if eapoc_id == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"): + if data['ric'] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"): multiList = [] - logging.debug("multicastAlarm delimiter RIC received --> buffer cleared %s %s %s ", eapoc_id, eapoc_sub, eapoc_text) + logging.debug("multicastAlarm delimiter RIC received --> buffer cleared %s ", data) else: - multiList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp]) - logging.debug("Added %s %s %s to multiList", eapoc_id, eapoc_sub, eapoc_text) + multiList.append([typ, data['ric'], data['function'], data['functionChar'], data['msg'].strip(), data['description'], timestamp]) + logging.debug("Added %s %s %s %s to multiList", data['ric'], data['function'], data['functionChar'], data['msg'].strip()) # check for old entries in multiList for i, _ in enumerate(multiList): # we have to remove entries older than timestamp - ignore time - if int(multiList[i][4]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): + if int(multiList[i][6]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): tmpmultiList.append(multiList[i]) multiList = tmpmultiList @@ -48,14 +48,11 @@ def multicastAlarmExec(typ, freq, data): """ logging.debug("data before update from multiList: %s", data) for i, _ in enumerate(multiList): - #update with eapoc_id (RIC) + #update data with values multiList data['ric'] = multiList[i][1] - #update with eapoc_sub (Sub RIC) data['function'] = multiList[i][2] - # Add function as character a-d to dataset (reused from includes/poc.py) - data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d") - #update with eapoc_id (RIC) - data['description'] = multiList[i][1] + data['functionChar'] = multiList[i][3] + data['description'] = multiList[i][5] logging.debug("data after update from multiList: %s", data) try: from includes import alarmHandler From 6bcba28979016abd0b3dc10aa9ee1a0d85d48c48 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 3 Oct 2017 11:39:57 +0200 Subject: [PATCH 033/114] changed to send complete data to multicastAlarm for buffering --- includes/decoders/poc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index 552f06d..4813b9a 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -135,7 +135,8 @@ def decode(freq, decoded): if globalVars.config.getint("multicastAlarm", "multicastAlarm") and (data["msg"] == "" or data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric")): logging.debug(" - multicastAlarm or delimiter RIC received - buffer alarms until text received") from includes import multicastAlarm - multicastAlarm.newEntrymultiList("POC", poc_id, poc_sub, poc_text) + multicastAlarm.newEntrymultiList("POC", freq, data) + # multicastAlarm processing if enabled and alarm message has been received elif globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["msg"] != "" and data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): logging.debug(" - multicastAlarm RIC with text message") From 9aa163d5a8ed0f8d75d01e25ae7fbbc5ecd76504 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 3 Oct 2017 11:41:02 +0200 Subject: [PATCH 034/114] text for multicastAlarm config updated --- config/config.template.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/config.template.ini b/config/config.template.ini index 5e31d27..1177604 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -132,9 +132,9 @@ netIdent_ric = 0174760, 1398098 [multicastAlarm] # Configure multicastAlarm if your POCSAG network uses an optimized transmission scheme for alarms with more than one RIC (often found in Swissphone networks). -# The optimized transmission scheme sends a POCSAG telegram with each RIC that needs to be alarmed in a sequence. These telegrams are send without a text message. This sequence is directly followed by a telegram with a special RIC and the text message. -# A POCSAG pager (DME) can be configured to start an acoustic alarm if a specific RIC without text has been received. If afterwards the RIC with the text message will be received, the pager will show the message in it's display. -# multicastAlarm enables BOSwatch to forward the all received RIC joined with the text message +# In this optimized transmission scheme, a POCSAG telegram with each RIC that needs to be alarmed will be send in a sequence. These telegrams are send without a text message. This sequence is directly followed by a telegram with a specific RIC and the text message that belongs to the sequnece send right before. +# A POCSAG pager (DME) can be configured to start an acoustic alarm if a specific RIC without text has been received. If afterwards the specific RIC with the text message will be received, the pager will show the message in it's display. +# multicastAlarm enables BOSwatch to process the all received RICs joined with the text message. # # enable multicastAlarm (0 - off | 1 - on) multicastAlarm = 0 From b52d972c208a8f6c06c0d8be48001628b7b8a39e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 12:03:08 +0200 Subject: [PATCH 035/114] edit debug msg --- includes/decoders/poc.py | 4 ++-- includes/multicastAlarm.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index 4813b9a..9f18bb6 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -133,13 +133,13 @@ def decode(freq, decoded): # multicastAlarm processing if enabled and message without text ord delimiter RIC received if globalVars.config.getint("multicastAlarm", "multicastAlarm") and (data["msg"] == "" or data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric")): - logging.debug(" - multicastAlarm or delimiter RIC received - buffer alarms until text received") + logging.debug(" - multicastAlarm without msg") from includes import multicastAlarm multicastAlarm.newEntrymultiList("POC", freq, data) # multicastAlarm processing if enabled and alarm message has been received elif globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["msg"] != "" and data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): - logging.debug(" - multicastAlarm RIC with text message") + logging.debug(" - multicastAlarm with message") from includes import multicastAlarm multicastAlarm.multicastAlarmExec("POC", freq, data) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index a2a9a0c..de23a3f 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -28,10 +28,10 @@ def newEntrymultiList(typ, freq, data): # multicastAlarm processing if enabled and delimiter RIC has been received if data['ric'] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"): multiList = [] - logging.debug("multicastAlarm delimiter RIC received --> buffer cleared %s ", data) + logging.debug("multicastAlarm delimiter RIC received --> buffer cleared") else: multiList.append([typ, data['ric'], data['function'], data['functionChar'], data['msg'].strip(), data['description'], timestamp]) - logging.debug("Added %s %s %s %s to multiList", data['ric'], data['function'], data['functionChar'], data['msg'].strip()) + logging.debug("Added %s to multiList", data['ric']) # check for old entries in multiList for i, _ in enumerate(multiList): # we have to remove entries older than timestamp - ignore time From f701b6a010506b859b9da5e7b6357a00f16b6959 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 12:08:04 +0200 Subject: [PATCH 036/114] del typ and freq in adding routine --- includes/decoders/poc.py | 2 +- includes/multicastAlarm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index 9f18bb6..9490843 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -135,7 +135,7 @@ def decode(freq, decoded): if globalVars.config.getint("multicastAlarm", "multicastAlarm") and (data["msg"] == "" or data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric")): logging.debug(" - multicastAlarm without msg") from includes import multicastAlarm - multicastAlarm.newEntrymultiList("POC", freq, data) + multicastAlarm.newEntrymultiList(data) # multicastAlarm processing if enabled and alarm message has been received elif globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["msg"] != "" and data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index de23a3f..7d9c3d2 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -16,7 +16,7 @@ from includes import globalVars # Global variables multiList = [] -def newEntrymultiList(typ, freq, data): +def newEntrymultiList(data): """ add entry to multi alarm list and remove old entries From 9c446b0660a4e62d5aee86400017ebaaf0109f13 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 12:10:08 +0200 Subject: [PATCH 037/114] del typ and freq in adding routine --- includes/decoders/poc.py | 2 +- includes/multicastAlarm.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index 9490843..fe7f724 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -141,7 +141,7 @@ def decode(freq, decoded): elif globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["msg"] != "" and data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): logging.debug(" - multicastAlarm with message") from includes import multicastAlarm - multicastAlarm.multicastAlarmExec("POC", freq, data) + multicastAlarm.multicastAlarmExec(freq, data) else: # processing the alarm diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index 7d9c3d2..ec9e13d 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -40,7 +40,7 @@ def newEntrymultiList(data): multiList = tmpmultiList -def multicastAlarmExec(typ, freq, data): +def multicastAlarmExec(freq, data): """ call alarmHandler for every entry in multiList @@ -56,7 +56,7 @@ def multicastAlarmExec(typ, freq, data): logging.debug("data after update from multiList: %s", data) try: from includes import alarmHandler - alarmHandler.processAlarmHandler(typ, freq, data) + alarmHandler.processAlarmHandler("POC", freq, data) except: logging.error("processing alarm failed") logging.debug("processing alarm failed", exc_info=True) From 9aaa8aa267b5f19bd796654e1ef258900ed6dfe1 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 12:13:05 +0200 Subject: [PATCH 038/114] remove typ from adding --- includes/multicastAlarm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index ec9e13d..75582e0 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -30,7 +30,7 @@ def newEntrymultiList(data): multiList = [] logging.debug("multicastAlarm delimiter RIC received --> buffer cleared") else: - multiList.append([typ, data['ric'], data['function'], data['functionChar'], data['msg'].strip(), data['description'], timestamp]) + multiList.append([data['ric'], data['function'], data['functionChar'], data['msg'].strip(), data['description'], timestamp]) logging.debug("Added %s to multiList", data['ric']) # check for old entries in multiList for i, _ in enumerate(multiList): From 3220088e6cfb247bd70a2f9691279f368cce1b63 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 3 Oct 2017 12:43:12 +0200 Subject: [PATCH 039/114] update indexes after remove of typ from multiList --- includes/multicastAlarm.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index 75582e0..437e878 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -35,7 +35,7 @@ def newEntrymultiList(data): # check for old entries in multiList for i, _ in enumerate(multiList): # we have to remove entries older than timestamp - ignore time - if int(multiList[i][6]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): + if int(multiList[i][5]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): tmpmultiList.append(multiList[i]) multiList = tmpmultiList @@ -49,10 +49,10 @@ def multicastAlarmExec(freq, data): logging.debug("data before update from multiList: %s", data) for i, _ in enumerate(multiList): #update data with values multiList - data['ric'] = multiList[i][1] - data['function'] = multiList[i][2] - data['functionChar'] = multiList[i][3] - data['description'] = multiList[i][5] + data['ric'] = multiList[i][0] + data['function'] = multiList[i][1] + data['functionChar'] = multiList[i][2] + data['description'] = multiList[i][4] logging.debug("data after update from multiList: %s", data) try: from includes import alarmHandler From 63f2e58310cd4881034f49d79c58142ef48a3399 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 14:43:36 +0200 Subject: [PATCH 040/114] edit multicastAlarm --- includes/multicastAlarm.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index 437e878..b153a0b 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -14,6 +14,9 @@ import time # timestamp for multicastAlarm from includes import globalVars # Global variables +# +# ListStructure [0..n] = (Data, TimeStamp) +# multiList = [] def newEntrymultiList(data): @@ -22,22 +25,18 @@ def newEntrymultiList(data): @return: nothing """ - global multiList - tmpmultiList = [] timestamp = int(time.time()) # multicastAlarm processing if enabled and delimiter RIC has been received if data['ric'] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"): multiList = [] logging.debug("multicastAlarm delimiter RIC received --> buffer cleared") else: - multiList.append([data['ric'], data['function'], data['functionChar'], data['msg'].strip(), data['description'], timestamp]) + multiList.append([data, timestamp]) logging.debug("Added %s to multiList", data['ric']) # check for old entries in multiList - for i, _ in enumerate(multiList): - # we have to remove entries older than timestamp - ignore time - if int(multiList[i][5]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): - tmpmultiList.append(multiList[i]) - multiList = tmpmultiList + for (xData, xTimestamp) in multiList: + if xTimestamp > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): + multiList.remove([xData, xTimestamp]) def multicastAlarmExec(freq, data): @@ -47,12 +46,12 @@ def multicastAlarmExec(freq, data): @return: nothing """ logging.debug("data before update from multiList: %s", data) - for i, _ in enumerate(multiList): + for (xData, xTimestamp) in multiList: #update data with values multiList - data['ric'] = multiList[i][0] - data['function'] = multiList[i][1] - data['functionChar'] = multiList[i][2] - data['description'] = multiList[i][4] + data['ric'] = xData['ric'] + data['function'] = xData['ric'] + data['functionChar'] = xData['ric'] + data['description'] = xData['ric'] logging.debug("data after update from multiList: %s", data) try: from includes import alarmHandler From cb0fd5371367475df9de145296391ae88e3c2b41 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:26:16 +0200 Subject: [PATCH 041/114] insert history flag for netIdent --- config/config.template.ini | 2 ++ plugins/MySQL/MySQL.py | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config/config.template.ini b/config/config.template.ini index 7a959f2..1a10636 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -128,6 +128,8 @@ ricd = Unwetter # RIC for net identification # Usually sent periodically, separated by comma netIdent_ric = 0174760, 1398098 +# you can hold one entry per netIdent_ric [0] or the whole history [1] +netIdent_history = 0 [Filters] diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index e9d3d7e..e50d719 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -111,10 +111,13 @@ 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"]+"';") - if cursor.rowcount == 0: - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") - else: + if globalVars.config.getint("POC","netIdent_histry"): + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") + else: + 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"]+"');") + 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"])) else: From 0f13853cc8babdc41c77c3872c6bf91a618090c7 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:28:27 +0200 Subject: [PATCH 042/114] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3f07e2..31653e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### __[v2.2.2]__ - unreleased ##### Added - Installations Script für Services [#316](https://github.com/Schrolli91/BOSWatch/pull/316) +- Flag in Config um nur letzte Net Ident oder gesamte Historie zu speichern [#317](https://github.com/Schrolli91/BOSWatch/pull/317) ##### Changed - Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) - Versions Nummer und Branch Name getrennt [3fed1ac](https://github.com/Schrolli91/BOSWatch/commit/3fed1ac12af8690213766e0e81d71c237530ed2c) From a74ef0fe451c17f1fe8acd22f71ef2d4eb10fc6a Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:37:09 +0200 Subject: [PATCH 043/114] fix indentation level --- 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 e50d719..0b8b2aa 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -110,14 +110,14 @@ def run(typ,freq,data): cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"])) elif typ == "POC": - if isSignal(data["ric"]): + if isSignal(data["ric"]): if globalVars.config.getint("POC","netIdent_histry"): cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") else: 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"]+"');") - else: + 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"])) else: From cea266709cc721c5aa8dd52aa11711d8003981cf Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:39:18 +0200 Subject: [PATCH 044/114] fix indentation level --- plugins/MySQL/MySQL.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index 0b8b2aa..2c222b0 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -109,19 +109,19 @@ def run(typ,freq,data): elif typ == "ZVEI": cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"])) - elif typ == "POC": + elif typ == "POC": if isSignal(data["ric"]): if globalVars.config.getint("POC","netIdent_histry"): cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") else: - 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("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"]+"');") 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"])) + 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"])) - else: - logging.warning("Invalid Typ: %s", typ) + else: + logging.warning("Invalid Typ: %s", typ) except: logging.error("cannot Insert %s", typ) logging.debug("cannot Insert %s", typ, exc_info=True) From de6073e8f61942178f771b00750cecb3452d2a82 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:42:38 +0200 Subject: [PATCH 045/114] fix indentation level --- plugins/MySQL/MySQL.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index 2c222b0..fd9f603 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -109,19 +109,19 @@ def run(typ,freq,data): elif typ == "ZVEI": cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"])) - elif typ == "POC": - if isSignal(data["ric"]): - if globalVars.config.getint("POC","netIdent_histry"): - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") - else: - 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"]+"');") - 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"])) + elif typ == "POC": + if isSignal(data["ric"]): + if globalVars.config.getint("POC","netIdent_histry"): + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") + else: + 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"]+"');") + 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"])) - else: - logging.warning("Invalid Typ: %s", typ) + else: + logging.warning("Invalid Typ: %s", typ) except: logging.error("cannot Insert %s", typ) logging.debug("cannot Insert %s", typ, exc_info=True) From 5b9c8d75d9d083b6d87b679c64ecfeedb3326cb2 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 19:20:38 +0200 Subject: [PATCH 046/114] fix indentation level --- plugins/MySQL/MySQL.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index fd9f603..3d4db16 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -21,23 +21,23 @@ from includes import globalVars # Global variables from includes.helper import configHandler def isSignal(poc_id): - """ - @type poc_id: string - @param poc_id: POCSAG Ric + """ + @type poc_id: string + @param poc_id: POCSAG Ric - @requires: Configuration has to be set in the config.ini + @requires: Configuration has to be set in the config.ini - @return: True if the Ric is Signal, other False - @exception: none - """ - # If RIC is Signal return True, else False - if globalVars.config.get("POC", "netIdent_ric"): - if poc_id in globalVars.config.get("POC", "netIdent_ric"): - logging.info("RIC %s is net ident", poc_id) - return True - else: - logging.info("RIC %s is no net ident", poc_id) - return False + @return: True if the Ric is Signal, other False + @exception: none + """ + # If RIC is Signal return True, else False + if globalVars.config.get("POC", "netIdent_ric"): + if poc_id in globalVars.config.get("POC", "netIdent_ric"): + logging.info("RIC %s is net ident", poc_id) + return True + else: + logging.info("RIC %s is no net ident", poc_id) + return False ## From fca69b974e27c905ebf9a2dcd2c04b6b81c1bcf9 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 19:32:09 +0200 Subject: [PATCH 047/114] add placeholder (unused var) --- includes/multicastAlarm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index b153a0b..3f7b7bb 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -46,7 +46,7 @@ def multicastAlarmExec(freq, data): @return: nothing """ logging.debug("data before update from multiList: %s", data) - for (xData, xTimestamp) in multiList: + for (xData, _) in multiList: #update data with values multiList data['ric'] = xData['ric'] data['function'] = xData['ric'] From 578750a810bc1ebcb13bf9a0defb7ccfda7fa02d Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 22:08:38 +0200 Subject: [PATCH 048/114] fix global definition issue --- includes/multicastAlarm.py | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index 3f7b7bb..48c4209 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -25,6 +25,7 @@ def newEntrymultiList(data): @return: nothing """ + global multiList timestamp = int(time.time()) # multicastAlarm processing if enabled and delimiter RIC has been received if data['ric'] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"): From bcdac6e2e65f35b220a3e7df4ae07337a94e75ce Mon Sep 17 00:00:00 2001 From: f-kessler Date: Thu, 5 Oct 2017 21:09:24 +0200 Subject: [PATCH 049/114] exclude netIdent_ric from multicastAlarm If not excluded it cannot be used anywhere --- includes/decoders/poc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index fe7f724..a2ee308 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -131,8 +131,8 @@ def decode(freq, decoded): from includes import descriptionList data["description"] = descriptionList.getDescription("POC", data["ric"]+data["functionChar"]) - # multicastAlarm processing if enabled and message without text ord delimiter RIC received - if globalVars.config.getint("multicastAlarm", "multicastAlarm") and (data["msg"] == "" or data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric")): + # multicastAlarm processing if enabled and a message without text or delimiter RIC or netIdent_ric received + if globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["ric"] != globalVars.config.get("POC", "netIdent_ric") and (data["msg"] == "" or data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric")): logging.debug(" - multicastAlarm without msg") from includes import multicastAlarm multicastAlarm.newEntrymultiList(data) From 307731dabe1290f9722073143ff9f0364f0182da Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sun, 8 Oct 2017 10:19:53 +0200 Subject: [PATCH 050/114] Update Konzept.md --- Konzept.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Konzept.md b/Konzept.md index 6e3a5b1..7903dcc 100644 --- a/Konzept.md +++ b/Konzept.md @@ -2,6 +2,7 @@ ============ +Python 3 Verpacken der Funktionalitäten in Klassen um OOP-Grundsätze zu erreichen. @@ -12,11 +13,13 @@ Verpacken der Funktionalitäten in Klassen um OOP-Grundsätze zu erreichen. - reine Dekodierung mittels rtl-fm und multimon - Keine Filter usw. nur die Dekoder, Daten verpacken, verschicken - per TCP Socket an den Server + - versch Eingabequellen (DVB-T Stick, Audio Eingang) ### Server: - Empfängt die TCP Socket Pakete der einzelnen Clients - Durch doubleFiltering fallen doppelt eingehende Alarme der Clienten sowieso raus - - Danach Filterung usw. dann call an die plugins + - Danach Filterung nach neuen Filterkonzept + - dann call an die plugins From 8961148ecf16a7a79d475c9c36ab0933dc79591c Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sun, 8 Oct 2017 10:19:53 +0200 Subject: [PATCH 051/114] Update Konzept.md --- Konzept.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Konzept.md b/Konzept.md index 6e3a5b1..7903dcc 100644 --- a/Konzept.md +++ b/Konzept.md @@ -2,6 +2,7 @@ ============ +Python 3 Verpacken der Funktionalitäten in Klassen um OOP-Grundsätze zu erreichen. @@ -12,11 +13,13 @@ Verpacken der Funktionalitäten in Klassen um OOP-Grundsätze zu erreichen. - reine Dekodierung mittels rtl-fm und multimon - Keine Filter usw. nur die Dekoder, Daten verpacken, verschicken - per TCP Socket an den Server + - versch Eingabequellen (DVB-T Stick, Audio Eingang) ### Server: - Empfängt die TCP Socket Pakete der einzelnen Clients - Durch doubleFiltering fallen doppelt eingehende Alarme der Clienten sowieso raus - - Danach Filterung usw. dann call an die plugins + - Danach Filterung nach neuen Filterkonzept + - dann call an die plugins From b5d860f5cbdf010bc5f0f99485e3ac2bb9a7b4c5 Mon Sep 17 00:00:00 2001 From: Philip Giuliani Date: Mon, 9 Oct 2017 14:11:26 +0200 Subject: [PATCH 052/114] Fix output paths of the install script --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 5c251ea..1d214d9 100644 --- a/install.sh +++ b/install.sh @@ -213,8 +213,8 @@ echo "Installation ready!" tput cup 19 3 echo "Watch out: to run BOSWatch you have to generate and modify the config.ini!" echo "Do the following steps to have a running version of BOSWatch:" -echo "sudo cp $boswatchpath/BOSWatch/config/config.template.ini $boswatchpath/BOSWatch/config/config.ini" -echo "sudo nano $boswatchpath/BOSWatch/config/config.ini" +echo "sudo cp $boswatchpath/config/config.template.ini $boswatchpath/config/config.ini" +echo "sudo nano $boswatchpath/config/config.ini" echo "and modify the config as you need. This step is optional if you are upgrading an old version of BOSWatch. " tput cnorm From b7141d986b4a379f8a9afd81e1219627204a39a4 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Mon, 9 Oct 2017 20:59:03 +0200 Subject: [PATCH 053/114] fixed remove of old RICs and replacement of data for calling alarmHandler Changed for loop to iterate over a copy of multiList fixed replacement of data from xData --- includes/multicastAlarm.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index 48c4209..40a8344 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -30,14 +30,15 @@ def newEntrymultiList(data): # multicastAlarm processing if enabled and delimiter RIC has been received if data['ric'] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"): multiList = [] - logging.debug("multicastAlarm delimiter RIC received --> buffer cleared") + logging.debug("delimiter RIC received - buffer cleared") else: multiList.append([data, timestamp]) logging.debug("Added %s to multiList", data['ric']) # check for old entries in multiList - for (xData, xTimestamp) in multiList: - if xTimestamp > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): + for (xData, xTimestamp) in multiList[:]: + if xTimestamp < timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"): multiList.remove([xData, xTimestamp]) + logging.debug("RIC %s removed - %s sec. older than current timestamp", xData['ric'], xTimestamp-timestamp) def multicastAlarmExec(freq, data): @@ -50,9 +51,9 @@ def multicastAlarmExec(freq, data): for (xData, _) in multiList: #update data with values multiList data['ric'] = xData['ric'] - data['function'] = xData['ric'] - data['functionChar'] = xData['ric'] - data['description'] = xData['ric'] + data['function'] = xData['function'] + data['functionChar'] = xData['functionChar'] + data['description'] = xData['description'] logging.debug("data after update from multiList: %s", data) try: from includes import alarmHandler From 886dcf63d08770fe6203efc89c27555790c9d8e9 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:14:06 +0200 Subject: [PATCH 054/114] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d317f04..399d5c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ##### Deprecated ##### Removed ##### Fixed +- Schreibfehler der Pfadangabe im Installer [#317](https://github.com/Schrolli91/BOSWatch/pull/317) - Schreibfehler in Service Readme [#313](https://github.com/Schrolli91/BOSWatch/issues/313) - Einige Code-Style Verbesserungen [#310](https://github.com/Schrolli91/BOSWatch/pull/310) ##### Security From 7abc398a9447479bf13ea7ee4b4c82d1874a5f04 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:18:49 +0200 Subject: [PATCH 055/114] edit readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index eb8e805..e8abae2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ |Branch|Code Qualität|CI-Build| |---|---|---| |master|[![Codacy Badge](https://img.shields.io/codacy/grade/d512976554354a199555bd34ed179bb1/master.svg)](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763821)|[![Build Status](https://travis-ci.org/Schrolli91/BOSWatch.svg?branch=master)](https://travis-ci.org/Schrolli91/BOSWatch)| -|beta|[![Codacy Badge](https://img.shields.io/codacy/grade/d512976554354a199555bd34ed179bb1/beta.svg)](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=4213030)|[![Build Status](https://travis-ci.org/Schrolli91/BOSWatch.svg?branch=beta)](https://travis-ci.org/Schrolli91/BOSWatch)| |develop|[![Codacy Badge](https://img.shields.io/codacy/grade/d512976554354a199555bd34ed179bb1/develop.svg)](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763820)|[![Build Status](https://travis-ci.org/Schrolli91/BOSWatch.svg?branch=develop)](https://travis-ci.org/Schrolli91/BOSWatch)| From 2626a0418fa91f6921147d1cddf9cee248c34f39 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:20:34 +0200 Subject: [PATCH 056/114] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 399d5c0..e37c29b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) - Versions Nummer und Branch Name getrennt [3fed1ac](https://github.com/Schrolli91/BOSWatch/commit/3fed1ac12af8690213766e0e81d71c237530ed2c) ##### Deprecated +- Beta Branch aus Readme, Installer und Travis-CI entfernt ##### Removed ##### Fixed - Schreibfehler der Pfadangabe im Installer [#317](https://github.com/Schrolli91/BOSWatch/pull/317) From c49c76dd6b06e16125f43c75343f4619ffcf9cae Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:20:46 +0200 Subject: [PATCH 057/114] edit installer --- install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install.sh b/install.sh index 3fc8140..5470b24 100644 --- a/install.sh +++ b/install.sh @@ -78,7 +78,6 @@ for (( i=1; i<=$#; i=$i+2 )); do -b|--branch) case $arg2 in dev|develop) echo " !!! WARNING: you are using the DEV BRANCH !!! "; branch=dev ;; - beta) echo " !!! WARNING: you are using the BETA BRANCH !!! "; branch=beta ;; *) branch=master ;; esac ;; From 9e0e43ee135fe50a64ff16f50fc91c864f7456d2 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:20:53 +0200 Subject: [PATCH 058/114] edit travis config --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d1103be..0082739 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ sudo: required branches: only: - master - - beta - develop before_script: From 9cad78f71c15ce700d7693e5891051801195257e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:23:19 +0200 Subject: [PATCH 059/114] edit CL --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e37c29b..b00e065 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) - Versions Nummer und Branch Name getrennt [3fed1ac](https://github.com/Schrolli91/BOSWatch/commit/3fed1ac12af8690213766e0e81d71c237530ed2c) ##### Deprecated -- Beta Branch aus Readme, Installer und Travis-CI entfernt +- Beta Branch aus Readme, Installer und Travis-CI entfernt [#324](https://github.com/Schrolli91/BOSWatch/pull/324) ##### Removed ##### Fixed - Schreibfehler der Pfadangabe im Installer [#317](https://github.com/Schrolli91/BOSWatch/pull/317) From 5ec51d56cf721dca79816f00ac291c380a72ea35 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:33:08 +0200 Subject: [PATCH 060/114] edit CL for release --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 399d5c0..6346714 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,18 @@ # Changelog -### __[v2.3]__ - unreleased + +### __[v2.2.2]__ - 21.10.2017 ##### Added - Installations Script für Services [#316](https://github.com/Schrolli91/BOSWatch/pull/316) ##### Changed - Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) - Versions Nummer und Branch Name getrennt [3fed1ac](https://github.com/Schrolli91/BOSWatch/commit/3fed1ac12af8690213766e0e81d71c237530ed2c) ##### Deprecated -##### Removed +- Beta Branch wird mit nächstem Update entfernt [Forum](http://boswatch.de/index.php?thread/16-beta-branch-abschaffen/&postID=113#post113) ##### Fixed - Schreibfehler der Pfadangabe im Installer [#317](https://github.com/Schrolli91/BOSWatch/pull/317) - Schreibfehler in Service Readme [#313](https://github.com/Schrolli91/BOSWatch/issues/313) - Einige Code-Style Verbesserungen [#310](https://github.com/Schrolli91/BOSWatch/pull/310) -##### Security ### __[v2.2.1]__ - 19.09.2017 From c15de920ac2456c9f9ebe09923043e302c8d99de Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:34:37 +0200 Subject: [PATCH 061/114] edit CL --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6346714..cf8fdf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### __[2.3]__ - unreleased +##### Added +##### Changed +##### Deprecated +##### Removed +##### Fixed +##### Security + ### __[v2.2.2]__ - 21.10.2017 ##### Added From fea211f32a59668eac7dd2071abc05d01894243c Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:37:31 +0200 Subject: [PATCH 062/114] edit for release --- CHANGELOG.md | 8 -------- includes/globalVars.py | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf8fdf2..6346714 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,5 @@ # Changelog -### __[2.3]__ - unreleased -##### Added -##### Changed -##### Deprecated -##### Removed -##### Fixed -##### Security - ### __[v2.2.2]__ - 21.10.2017 ##### Added diff --git a/includes/globalVars.py b/includes/globalVars.py index be4305d..a6dcd60 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -10,8 +10,8 @@ Global variables # version info versionNr = "2.2.2" -branch = "dev" -buildDate = "unreleased" +branch = "master" +buildDate = "21.10.2017" # Global variables From 44821bbfcd9f0870b030d60c7ef75f03e0e71b2a Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:49:18 +0200 Subject: [PATCH 063/114] edit CL --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf8fdf2..65e9843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -### __[2.3]__ - unreleased +### __[2.x]__ - unreleased ##### Added ##### Changed ##### Deprecated From c144205eb0488c837fb62c1076c4afd4da2d0379 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:50:55 +0200 Subject: [PATCH 064/114] edit version --- includes/globalVars.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/globalVars.py b/includes/globalVars.py index be4305d..f5d416a 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,7 +9,7 @@ Global variables """ # version info -versionNr = "2.2.2" +versionNr = "2.3" branch = "dev" buildDate = "unreleased" From 50a2c70408df5437ae727b31fdb2fc8547d61965 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:55:46 +0200 Subject: [PATCH 065/114] edit CL --- CHANGELOG.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31653e9..fc0b047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,28 @@ # Changelog -### __[v2.2.2]__ - unreleased + +### __[2.x]__ - unreleased +##### Added +- Flag in Config um nur letzte Net Ident oder gesamte Historie zu speichern [#317](https://github.com/Schrolli91/BOSWatch/pull/317) +##### Changed +##### Deprecated +##### Removed +##### Fixed +##### Security + + +### __[v2.2.2]__ - 21.10.2017 ##### Added - Installations Script für Services [#316](https://github.com/Schrolli91/BOSWatch/pull/316) -- Flag in Config um nur letzte Net Ident oder gesamte Historie zu speichern [#317](https://github.com/Schrolli91/BOSWatch/pull/317) ##### Changed - Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) - Versions Nummer und Branch Name getrennt [3fed1ac](https://github.com/Schrolli91/BOSWatch/commit/3fed1ac12af8690213766e0e81d71c237530ed2c) ##### Deprecated -##### Removed +- Beta Branch wird mit nächstem Update entfernt [Forum](http://boswatch.de/index.php?thread/16-beta-branch-abschaffen/&postID=113#post113) ##### Fixed +- Schreibfehler der Pfadangabe im Installer [#317](https://github.com/Schrolli91/BOSWatch/pull/317) - Schreibfehler in Service Readme [#313](https://github.com/Schrolli91/BOSWatch/issues/313) - Einige Code-Style Verbesserungen [#310](https://github.com/Schrolli91/BOSWatch/pull/310) -##### Security ### __[v2.2.1]__ - 19.09.2017 From fb82b1868d71526f133e8e260f63160c1649475e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:57:10 +0200 Subject: [PATCH 066/114] edit CL --- CHANGELOG.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 450fb2a..cf39bf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,28 @@ # Changelog -### __[v2.2.2]__ - unreleased + +### __[2.x]__ - unreleased ##### Added - zuschaltbare POCSAG Multicast-Alarm Funktionalität [#307](https://github.com/Schrolli91/BOSWatch/pull/307) +##### Changed +##### Deprecated +##### Removed +##### Fixed +##### Security + + +### __[v2.2.2]__ - 21.10.2017 +##### Added - Installations Script für Services [#316](https://github.com/Schrolli91/BOSWatch/pull/316) ##### Changed - Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) - Versions Nummer und Branch Name getrennt [3fed1ac](https://github.com/Schrolli91/BOSWatch/commit/3fed1ac12af8690213766e0e81d71c237530ed2c) ##### Deprecated -##### Removed +- Beta Branch wird mit nächstem Update entfernt [Forum](http://boswatch.de/index.php?thread/16-beta-branch-abschaffen/&postID=113#post113) ##### Fixed +- Schreibfehler der Pfadangabe im Installer [#317](https://github.com/Schrolli91/BOSWatch/pull/317) - Schreibfehler in Service Readme [#313](https://github.com/Schrolli91/BOSWatch/issues/313) - Einige Code-Style Verbesserungen [#310](https://github.com/Schrolli91/BOSWatch/pull/310) -##### Security ### __[v2.2.1]__ - 19.09.2017 From 9d06e38de97d462a5f794bf3050720387a48cc21 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 21 Oct 2017 22:57:52 +0200 Subject: [PATCH 067/114] edit CL --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca9d986..d9fe700 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -### __[2.3]__ - unreleased +### __[2.x]__ - unreleased ##### Added ##### Changed ##### Deprecated From 59b78a4f64ee58ec0bd19cf2f82179f0317ae0c2 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Mon, 23 Oct 2017 20:34:25 +0200 Subject: [PATCH 068/114] multi delimiter and text RICs Changed to support multiple delimiters and text RICs --- includes/decoders/poc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index a2ee308..da86318 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -132,13 +132,13 @@ def decode(freq, decoded): data["description"] = descriptionList.getDescription("POC", data["ric"]+data["functionChar"]) # multicastAlarm processing if enabled and a message without text or delimiter RIC or netIdent_ric received - if globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["ric"] != globalVars.config.get("POC", "netIdent_ric") and (data["msg"] == "" or data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric")): + if globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["ric"] != globalVars.config.get("POC", "netIdent_ric") and (data["msg"] == "" or data["ric"] in globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric")): logging.debug(" - multicastAlarm without msg") from includes import multicastAlarm multicastAlarm.newEntrymultiList(data) # multicastAlarm processing if enabled and alarm message has been received - elif globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["msg"] != "" and data["ric"] == globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): + elif globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["msg"] != "" and data["ric"] in globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): logging.debug(" - multicastAlarm with message") from includes import multicastAlarm multicastAlarm.multicastAlarmExec(freq, data) From eb10fdce4312df4b22de33e1e3eea2b6d79f1a53 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 15 Dec 2017 23:23:54 +0100 Subject: [PATCH 069/114] insert BW3 forum info --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index eb8e805..fa97e5e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +### Arbeiten an BOSWatch 3 gestartet +#### Work on BOSWatch 3 has started +## see: https://boswatch.de/index.php?thread/29-boswatch-3/ + + |Branch|Code Qualität|CI-Build| |---|---|---| |master|[![Codacy Badge](https://img.shields.io/codacy/grade/d512976554354a199555bd34ed179bb1/master.svg)](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763821)|[![Build Status](https://travis-ci.org/Schrolli91/BOSWatch.svg?branch=master)](https://travis-ci.org/Schrolli91/BOSWatch)| From 84932346b53f22c107b3b4126c86a753778dad7b Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Dec 2017 08:35:10 +0100 Subject: [PATCH 070/114] fix http request plugin bug data field overwrite bug --- .gitignore | 4 ++++ plugins/httpRequest/httpRequest.py | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 7617a01..e02c9e9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ *.log config.ini log/ + +\.project + +\.pydevproject diff --git a/plugins/httpRequest/httpRequest.py b/plugins/httpRequest/httpRequest.py index 56e35a6..f5f5e89 100644 --- a/plugins/httpRequest/httpRequest.py +++ b/plugins/httpRequest/httpRequest.py @@ -68,11 +68,13 @@ def run(typ,freq,data): try: # - # Replace special characters in data Strings for URL + # Make a copy of the data field to not overwrite the data in it + # Replace special characters in dataCopy Strings for URL # - for key in data: - if isinstance(data[key], basestring): - data[key] = urllib.quote(data[key]) + dataCopy = data + for key in dataCopy: + if isinstance(dataCopy[key], basestring): + dataCopy[key] = urllib.quote(dataCopy[key]) # # Get URLs # @@ -90,7 +92,7 @@ def run(typ,freq,data): # replace wildcards # for (i, url) in enumerate(urls): - urls[i] = wildcardHandler.replaceWildcards(urls[i].strip(), data) + urls[i] = wildcardHandler.replaceWildcards(urls[i].strip(), dataCopy) # # HTTP-Request # From 1771c2ec6f9f71b3f378d2468ab5abc22ecf45bc Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Dec 2017 08:36:58 +0100 Subject: [PATCH 071/114] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 472e03c..86dd0a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ##### Removed - Beta Branch aus Readme, Installer und Travis-CI entfernt [#324](https://github.com/Schrolli91/BOSWatch/pull/324) ##### Fixed +- Bug in httpRequest Plugin (data Field wurde überschrieben) [#337](https://github.com/Schrolli91/BOSWatch/pull/337) ##### Security From 0539e33207a8a239e53ecb15ac515c5d8484c667 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Dec 2017 09:05:27 +0100 Subject: [PATCH 072/114] fix copy fail only made a ref not a real copy --- plugins/httpRequest/httpRequest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/httpRequest/httpRequest.py b/plugins/httpRequest/httpRequest.py index f5f5e89..1622a8b 100644 --- a/plugins/httpRequest/httpRequest.py +++ b/plugins/httpRequest/httpRequest.py @@ -71,7 +71,7 @@ def run(typ,freq,data): # Make a copy of the data field to not overwrite the data in it # Replace special characters in dataCopy Strings for URL # - dataCopy = data + dataCopy = dict(data) for key in dataCopy: if isinstance(dataCopy[key], basestring): dataCopy[key] = urllib.quote(dataCopy[key]) From 4646012723478958ceb6b529e52c8396d7f01438 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Dec 2017 11:28:04 +0100 Subject: [PATCH 073/114] comment for FE in source --- plugins/firEmergency/firEmergency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/firEmergency/firEmergency.py b/plugins/firEmergency/firEmergency.py index a724cd2..89a325c 100644 --- a/plugins/firEmergency/firEmergency.py +++ b/plugins/firEmergency/firEmergency.py @@ -5,7 +5,7 @@ firEmergency-Plugin to dispatch ZVEI- and POCSAG - messages to firEmergency firEmergency configuration: -- set input to "FMS32" at Port 5555 +- set input to "Standartschnittstelle" at Port 5555 @autor: Smith-fms From 2b90ebef8accdab4cb0ae02c311682a0146623cd Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Dec 2017 11:38:47 +0100 Subject: [PATCH 074/114] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 472e03c..24e41ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ##### Removed - Beta Branch aus Readme, Installer und Travis-CI entfernt [#324](https://github.com/Schrolli91/BOSWatch/pull/324) ##### Fixed +- Kommentar für FirEmergency Einstellung angepasst [#338](https://github.com/Schrolli91/BOSWatch/pull/338) ##### Security From 76253ac90028f942c447004c580547da9bf3208e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Dec 2017 13:45:12 +0100 Subject: [PATCH 075/114] fix travis build fail --- citest/config.httpRequest.ini | 20 ++++++++++++++++++++ citest/config.mysql.ini | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/citest/config.httpRequest.ini b/citest/config.httpRequest.ini index bfa08ec..665a66e 100644 --- a/citest/config.httpRequest.ini +++ b/citest/config.httpRequest.ini @@ -114,6 +114,26 @@ ricd = Unwetter # Usually sent periodically, separated by comma netIdent_ric = 0174760, 1398098 + +[multicastAlarm] +# Configure multicastAlarm if your POCSAG network uses an optimized transmission scheme for alarms with more than one RIC (often found in Swissphone networks). +# In this optimized transmission scheme, a POCSAG telegram with each RIC that needs to be alarmed will be send in a sequence. These telegrams are send without a text message. This sequence is directly followed by a telegram with a specific RIC and the text message that belongs to the sequnece send right before. +# A POCSAG pager (DME) can be configured to start an acoustic alarm if a specific RIC without text has been received. If afterwards the specific RIC with the text message will be received, the pager will show the message in it's display. +# multicastAlarm enables BOSwatch to process the all received RICs joined with the text message. +# +# enable multicastAlarm (0 - off | 1 - on) +multicastAlarm = 0 + +# time limit for alarms that do not belong to the multicastAlarm sequence in seconds +multicastAlarm_ignore_time = 15 + +# multicastAlarm delimiter RIC (usually used as a starting point for a alarm sequence) (can be empty) +multicastAlarm_delimiter_ric = + +# multicastAlarm RIC that is used to send the text message +multicastAlarm_ric = + + [Filters] # RegEX Filter Configuration # http://www.regexr.com/ - RegEX Test Tool an Documentation diff --git a/citest/config.mysql.ini b/citest/config.mysql.ini index 7766f77..317d3d9 100644 --- a/citest/config.mysql.ini +++ b/citest/config.mysql.ini @@ -114,6 +114,26 @@ ricd = Unwetter # Usually sent periodically, separated by comma netIdent_ric = 0174760, 1398098 + +[multicastAlarm] +# Configure multicastAlarm if your POCSAG network uses an optimized transmission scheme for alarms with more than one RIC (often found in Swissphone networks). +# In this optimized transmission scheme, a POCSAG telegram with each RIC that needs to be alarmed will be send in a sequence. These telegrams are send without a text message. This sequence is directly followed by a telegram with a specific RIC and the text message that belongs to the sequnece send right before. +# A POCSAG pager (DME) can be configured to start an acoustic alarm if a specific RIC without text has been received. If afterwards the specific RIC with the text message will be received, the pager will show the message in it's display. +# multicastAlarm enables BOSwatch to process the all received RICs joined with the text message. +# +# enable multicastAlarm (0 - off | 1 - on) +multicastAlarm = 0 + +# time limit for alarms that do not belong to the multicastAlarm sequence in seconds +multicastAlarm_ignore_time = 15 + +# multicastAlarm delimiter RIC (usually used as a starting point for a alarm sequence) (can be empty) +multicastAlarm_delimiter_ric = + +# multicastAlarm RIC that is used to send the text message +multicastAlarm_ric = + + [Filters] # RegEX Filter Configuration # http://www.regexr.com/ - RegEX Test Tool an Documentation From 9fd07658f6c973b14a2c4f6e73cdd637eb8079e3 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 20 Dec 2017 11:23:29 +0100 Subject: [PATCH 076/114] multimon and sdr-rtl as submodule added the used tools as a git submodule to have better control over versions --- .gitignore | 2 ++ .gitmodules | 6 ++++++ submodules/multimon | 1 + submodules/rtl-sdr | 1 + 4 files changed, 10 insertions(+) create mode 100644 .gitmodules create mode 160000 submodules/multimon create mode 160000 submodules/rtl-sdr diff --git a/.gitignore b/.gitignore index e02c9e9..3b70e90 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ log/ \.project \.pydevproject + +\.settings/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..85e0a7b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "submodules/multimon"] + path = submodules/multimon + url = https://github.com/EliasOenal/multimon-ng +[submodule "submodules/rtl-sdr"] + path = submodules/rtl-sdr + url = https://github.com/osmocom/rtl-sdr diff --git a/submodules/multimon b/submodules/multimon new file mode 160000 index 0000000..d01dd89 --- /dev/null +++ b/submodules/multimon @@ -0,0 +1 @@ +Subproject commit d01dd89bd24bc801af71a4bf499e3381d6066e3a diff --git a/submodules/rtl-sdr b/submodules/rtl-sdr new file mode 160000 index 0000000..b04c2f9 --- /dev/null +++ b/submodules/rtl-sdr @@ -0,0 +1 @@ +Subproject commit b04c2f9f035c5aede43d731e5d58e4725d2f8bb4 From b96e099ceadf748fc281f9c854384efdfc0c1ecd Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 21 Dec 2017 09:11:37 +0100 Subject: [PATCH 077/114] rev sub's to last release version --- submodules/multimon | 2 +- submodules/rtl-sdr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/multimon b/submodules/multimon index d01dd89..9548e27 160000 --- a/submodules/multimon +++ b/submodules/multimon @@ -1 +1 @@ -Subproject commit d01dd89bd24bc801af71a4bf499e3381d6066e3a +Subproject commit 9548e270956fd7a23fba356e14e6a02ba769a0f1 diff --git a/submodules/rtl-sdr b/submodules/rtl-sdr index b04c2f9..df9596b 160000 --- a/submodules/rtl-sdr +++ b/submodules/rtl-sdr @@ -1 +1 @@ -Subproject commit b04c2f9f035c5aede43d731e5d58e4725d2f8bb4 +Subproject commit df9596b2d1ebd36cdb14549cfdd76c25092e14d0 From 9a63c25640081815a2eb80ebe502bc9b87c5072c Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 21 Dec 2017 09:17:37 +0100 Subject: [PATCH 078/114] del submodules --- .gitmodules | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 85e0a7b..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "submodules/multimon"] - path = submodules/multimon - url = https://github.com/EliasOenal/multimon-ng -[submodule "submodules/rtl-sdr"] - path = submodules/rtl-sdr - url = https://github.com/osmocom/rtl-sdr From a9ac73a6341ba68d0d9c37cd4f0d275dea35c7d4 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 21 Dec 2017 09:17:59 +0100 Subject: [PATCH 079/114] del submodules --- submodules/multimon | 1 - submodules/rtl-sdr | 1 - 2 files changed, 2 deletions(-) delete mode 160000 submodules/multimon delete mode 160000 submodules/rtl-sdr diff --git a/submodules/multimon b/submodules/multimon deleted file mode 160000 index 9548e27..0000000 --- a/submodules/multimon +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9548e270956fd7a23fba356e14e6a02ba769a0f1 diff --git a/submodules/rtl-sdr b/submodules/rtl-sdr deleted file mode 160000 index df9596b..0000000 --- a/submodules/rtl-sdr +++ /dev/null @@ -1 +0,0 @@ -Subproject commit df9596b2d1ebd36cdb14549cfdd76c25092e14d0 From decd4461d7ba93065c465bdb954b3b50ef60906e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 21 Dec 2017 09:20:31 +0100 Subject: [PATCH 080/114] prepare new Version 2.3 --- CHANGELOG.md | 2 +- includes/globalVars.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea276d5..9a28116 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog -### __[2.x]__ - unreleased +### __[2.3]__ - 22.12.2017 ##### Added - zuschaltbare POCSAG Multicast-Alarm Funktionalität [#307](https://github.com/Schrolli91/BOSWatch/pull/307) - Flag in Config um nur letzte Net Ident oder gesamte Historie zu speichern [#317](https://github.com/Schrolli91/BOSWatch/pull/317) diff --git a/includes/globalVars.py b/includes/globalVars.py index f5d416a..23f9377 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -10,8 +10,8 @@ Global variables # version info versionNr = "2.3" -branch = "dev" -buildDate = "unreleased" +branch = "master" +buildDate = "22/12/2017" # Global variables From ba1c35b44dcd40c1d8fb9af601e2502c73145221 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 21 Dec 2017 09:27:00 +0100 Subject: [PATCH 081/114] dev ready for next version --- CHANGELOG.md | 9 +++++++++ includes/globalVars.py | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 447246f..e829202 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # Changelog +### __[2.3.1]__ - Unreleased +##### Added +##### Changed +##### Deprecated +##### Removed +##### Fixed +##### Security + + ### __[2.3]__ - 22.12.2017 ##### Added - zuschaltbare POCSAG Multicast-Alarm Funktionalität [#307](https://github.com/Schrolli91/BOSWatch/pull/307) diff --git a/includes/globalVars.py b/includes/globalVars.py index 23f9377..3b71248 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,9 +9,9 @@ Global variables """ # version info -versionNr = "2.3" -branch = "master" -buildDate = "22/12/2017" +versionNr = "2.3.1" +branch = "dev" +buildDate = "unreleased" # Global variables From 5cabb9ab4dcf292779e9239d9dbe128b9b3b743b Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 21 Dec 2017 09:31:06 +0100 Subject: [PATCH 082/114] dev ready for next version --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e829202..bfff188 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog -### __[2.3.1]__ - Unreleased +### __[v2.3.1]__ - Unreleased ##### Added ##### Changed ##### Deprecated @@ -10,7 +10,7 @@ ##### Security -### __[2.3]__ - 22.12.2017 +### __[v2.3]__ - 22.12.2017 ##### Added - zuschaltbare POCSAG Multicast-Alarm Funktionalität [#307](https://github.com/Schrolli91/BOSWatch/pull/307) - Flag in Config um nur letzte Net Ident oder gesamte Historie zu speichern [#317](https://github.com/Schrolli91/BOSWatch/pull/317) @@ -57,7 +57,7 @@ Zum schreiben des Changelog's siehe: http://keepachangelog.com/de/1.0.0/ -### __[version]__ - date +### __[v#.#]__ - date ##### Added ##### Changed ##### Deprecated From b565a31637394a73401cbf20876075619bdf8209 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Plogmann Date: Sat, 23 Dec 2017 12:35:02 +0100 Subject: [PATCH 083/114] added mysql Port to mysql connect and config --- config/config.template.ini | 1 + plugins/MySQL/MySQL.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/config.template.ini b/config/config.template.ini index bbb6e95..23cf14b 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -192,6 +192,7 @@ template = 0 [MySQL] # MySQL configuration dbserver = localhost +dbport = 3306 #default port: 3306 dbuser = boswatch dbpassword = root database = boswatch diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index 3d4db16..e7414df 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -91,7 +91,7 @@ def run(typ,freq,data): # Connect to MySQL # logging.debug("connect to MySQL") - connection = mysql.connector.connect(host = globalVars.config.get("MySQL","dbserver"), user = globalVars.config.get("MySQL","dbuser"), passwd = globalVars.config.get("MySQL","dbpassword"), db = globalVars.config.get("MySQL","database"), charset='utf8') + connection = mysql.connector.connect(host = globalVars.config.get("MySQL","dbserver"), host = globalVars.config.get("port","dbport"), user = globalVars.config.get("MySQL","dbuser"), passwd = globalVars.config.get("MySQL","dbpassword"), db = globalVars.config.get("MySQL","database"), charset='utf8') cursor = connection.cursor() except: logging.error("cannot connect to MySQL") From 46f7719c8972d8fd967d128724a7c3d03c141487 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Plogmann Date: Sat, 23 Dec 2017 12:37:13 +0100 Subject: [PATCH 084/114] fixed syntax --- plugins/MySQL/MySQL.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index e7414df..69bbb22 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -91,7 +91,7 @@ def run(typ,freq,data): # Connect to MySQL # logging.debug("connect to MySQL") - connection = mysql.connector.connect(host = globalVars.config.get("MySQL","dbserver"), host = globalVars.config.get("port","dbport"), user = globalVars.config.get("MySQL","dbuser"), passwd = globalVars.config.get("MySQL","dbpassword"), db = globalVars.config.get("MySQL","database"), charset='utf8') + connection = mysql.connector.connect(host = globalVars.config.get("MySQL","dbserver"), port = globalVars.config.get("MySQL","dbport"), user = globalVars.config.get("MySQL","dbuser"), passwd = globalVars.config.get("MySQL","dbpassword"), db = globalVars.config.get("MySQL","database"), charset='utf8') cursor = connection.cursor() except: logging.error("cannot connect to MySQL") From c212eac45b6cc7656326e4b414c9d165fcc5dbd6 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 23 Dec 2017 13:24:02 +0100 Subject: [PATCH 085/114] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfff188..c9abc23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### __[v2.3.1]__ - Unreleased ##### Added +- Config Eintrag um Port für MySQL Plugin festzulegen [#345](https://github.com/Schrolli91/BOSWatch/pull/345) ##### Changed ##### Deprecated ##### Removed From 16f576064efa761a559e84c3a143b7940ae0a394 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 23 Dec 2017 14:54:07 +0100 Subject: [PATCH 086/114] fix travis build --- citest/config.mysql.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/citest/config.mysql.ini b/citest/config.mysql.ini index 317d3d9..723df46 100644 --- a/citest/config.mysql.ini +++ b/citest/config.mysql.ini @@ -175,6 +175,7 @@ template = 0 [MySQL] # MySQL configuration dbserver = localhost +dbport = 3306 #default port: 3306 dbuser = boswatch dbpassword = root database = boswatch From 52e724be5dd11ec7680467a5de28c831f5ab79a1 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 23 Dec 2017 18:24:05 +0100 Subject: [PATCH 087/114] fix travis build --- citest/config.httpRequest.ini | 4 +++- citest/config.mysql.ini | 3 ++- config/config.template.ini | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/citest/config.httpRequest.ini b/citest/config.httpRequest.ini index 665a66e..512070a 100644 --- a/citest/config.httpRequest.ini +++ b/citest/config.httpRequest.ini @@ -174,8 +174,10 @@ template = 0 [MySQL] # MySQL configuration +#default port: 3306 dbserver = localhost -dbuser = root +dbport = 3306 +dbuser = boswatch dbpassword = root database = boswatch diff --git a/citest/config.mysql.ini b/citest/config.mysql.ini index 723df46..bad62e6 100644 --- a/citest/config.mysql.ini +++ b/citest/config.mysql.ini @@ -174,8 +174,9 @@ template = 0 [MySQL] # MySQL configuration +#default port: 3306 dbserver = localhost -dbport = 3306 #default port: 3306 +dbport = 3306 dbuser = boswatch dbpassword = root database = boswatch diff --git a/config/config.template.ini b/config/config.template.ini index 23cf14b..8f21093 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -191,8 +191,9 @@ template = 0 [MySQL] # MySQL configuration +#default port: 3306 dbserver = localhost -dbport = 3306 #default port: 3306 +dbport = 3306 dbuser = boswatch dbpassword = root database = boswatch From 7c6611a072854b2d8e3e22380e69aee567c6ce6c Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 3 Jan 2018 12:10:20 +0100 Subject: [PATCH 088/114] fix mysql plugin --- plugins/MySQL/MySQL.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index 69bbb22..c38410f 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -111,7 +111,7 @@ def run(typ,freq,data): elif typ == "POC": if isSignal(data["ric"]): - if globalVars.config.getint("POC","netIdent_histry"): + if globalVars.config.getint("POC","netIdent_history"): cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") else: cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';") From 64a5fe5868eeee5ca713d9b100cd32a012dfe528 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 3 Jan 2018 12:13:43 +0100 Subject: [PATCH 089/114] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9abc23..a778e71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ##### Deprecated ##### Removed ##### Fixed +- Fehler beim auslesen der netIdent_RIC im MySQL Plugin [#347](https://github.com/Schrolli91/BOSWatch/pull/347) ##### Security From 173e552018fc85ec09448203dc0340a57d57c325 Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 14 Jan 2018 23:33:39 +0100 Subject: [PATCH 090/114] Enabling FMS and ZVEI for Pushover - enabling alarmtype-specific titles and messages (and prios) --- config/config.template.ini | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/config/config.template.ini b/config/config.template.ini index 8f21093..496070b 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -377,14 +377,24 @@ api_key = # Pushover Userkey or Groupkey to receive message user_key = -# Title of the message -title = BOSWatch Message - +# Section for POCSAG # Adapt Pocsag Subric (a,b,c,d) to Pushover Priorities (see https://pushover.net/api#priority) -SubA = 0 -SubB = 2 -SubC = 1 -SubD = 0 +SubA = 1 +SubB = 1 +SubC = 2 +SubD = -2 +poc_title = Alarm: %RIC%%LPAR%%FUNCCHAR%%RPAR% +poc_message = %DATE% %TIME% - %DESCR%: %MSG% + +# Section for ZVEI +zvei_prio = 1 +zvei_title = Alarm: %ZVEI% +zvei_message = %DATE% %TIME%: %ZVEI% + +# Section for FMS +fms_prio = 1 +fms_title = FMS: %FMS% +fms_message = %DATE% %TIME%: %FMS%%BR%Status: %STATUS% - Direction: %DIRT% - TSI: %TSI% %LPAR%%DESCR%%RPAR% # how often should Pushover re-alert in seconds (emergency-messages) retry = 30 From 098fcc2c460710b30795d71ae124b39447e06455 Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 14 Jan 2018 23:35:31 +0100 Subject: [PATCH 091/114] Increasing functions for FMS and ZVEI - reading new sections from config - enabling wildcard-handling - sending POCSAG, ZVEI and FMS --- plugins/Pushover/Pushover.py | 91 ++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 30 deletions(-) diff --git a/plugins/Pushover/Pushover.py b/plugins/Pushover/Pushover.py index 1f97c95..d1edb66 100644 --- a/plugins/Pushover/Pushover.py +++ b/plugins/Pushover/Pushover.py @@ -16,6 +16,7 @@ from includes import globalVars # Global variables #from includes.helper import timeHandler from includes.helper import configHandler +from includes.helper import wildcardHandler ## # @@ -59,31 +60,62 @@ def run(typ,freq,data): try: if configHandler.checkConfig("Pushover"): #read and debug the config - try: + if typ == "FMS": + # + # building message for FMS + # + + message = globalVars.config.get("Pushover", "fms_message") + title = globalVars.config.get("Pushover", "fms_title") + priority = globalVars.config.get("Pushover", "fms_prio") + logging.debug("Sending message: %s", message) + + elif typ == "ZVEI": + # + # building message for ZVEI + # + message = globalVars.config.get("Pushover", "zvei_message") + title = globalVars.config.get("Pushover", "zvei_title") + priority = globalVars.config.get("Pushover", "zvei_prio") + logging.debug("Sending message: %s", message) + + elif typ == "POC": + # # Pushover-Request # - logging.debug("send Pushover %s", typ) - - if data["function"] == '1': - priority = globalVars.config.get("Pushover", "SubA") - elif data["function"] == '2': - priority = globalVars.config.get("Pushover", "SubB") - elif data["function"] == '3': - priority = globalVars.config.get("Pushover", "SubC") - elif data["function"] == '4': - priority = globalVars.config.get("Pushover", "SubD") - else: - priority = 0 - + logging.debug("send Pushover for %s", typ) + + if data["function"] == '1': + priority = globalVars.config.get("Pushover", "SubA") + elif data["function"] == '2': + priority = globalVars.config.get("Pushover", "SubB") + elif data["function"] == '3': + priority = globalVars.config.get("Pushover", "SubC") + elif data["function"] == '4': + priority = globalVars.config.get("Pushover", "SubD") + else: + priority = 0 + message = globalVars.config.get("Pushover", "poc_message") + title = globalVars.config.get("Pushover", "poc_title") + + else: + logging.warning("Invalid type: %s", typ) + + try: + # replace the wildcards + message = wildcardHandler.replaceWildcards(message,data) + title = wildcardHandler.replaceWildcards(title,data) + + # start the connection conn = httplib.HTTPSConnection("api.pushover.net:443") conn.request("POST", "/1/messages.json", urllib.urlencode({ "token": globalVars.config.get("Pushover", "api_key"), "user": globalVars.config.get("Pushover", "user_key"), - "message": ""+data["description"]+"
"+data["msg"].replace(";", "
"), + "message": message, "html": globalVars.config.get("Pushover", "html"), - "title": globalVars.config.get("Pushover", "title"), + "title": title, "priority": priority, "retry": globalVars.config.get("Pushover", "retry"), "expire": globalVars.config.get("Pushover", "expire") @@ -94,20 +126,19 @@ def run(typ,freq,data): logging.debug("cannot send Pushover request", exc_info=True) return - else: - try: - # - # check Pushover-Response - # - response = conn.getresponse() - if str(response.status) == "200": #Check Pushover Response and print a Log or Error - logging.debug("Pushover response: %s - %s" , str(response.status), str(response.reason)) - else: - logging.warning("Pushover response: %s - %s" , str(response.status), str(response.reason)) - except: #otherwise - logging.error("cannot get Pushover response") - logging.debug("cannot get Pushover response", exc_info=True) - return + try: + # + # check Pushover-Response + # + response = conn.getresponse() + if str(response.status) == "200": #Check Pushover Response and print a Log or Error + logging.debug("Pushover response: %s - %s" , str(response.status), str(response.reason)) + else: + logging.warning("Pushover response: %s - %s" , str(response.status), str(response.reason)) + except: #otherwise + logging.error("cannot get Pushover response") + logging.debug("cannot get Pushover response", exc_info=True) + return finally: logging.debug("close Pushover-Connection") From f92ce0d5f8ca3da203943b3694a39e5a8a34874a Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Mon, 15 Jan 2018 06:55:52 +0100 Subject: [PATCH 092/114] edit CL --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a778e71..c4e9d3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,13 @@ ### __[v2.3.1]__ - Unreleased ##### Added - Config Eintrag um Port für MySQL Plugin festzulegen [#345](https://github.com/Schrolli91/BOSWatch/pull/345) +- FMS und ZVEI Support für Pushover Plugin [#352](https://github.com/Schrolli91/BOSWatch/pull/352) +- Benutzerdefinierte Nachrichten für Pushover Plugin in config [#352](https://github.com/Schrolli91/BOSWatch/pull/352) ##### Changed ##### Deprecated ##### Removed ##### Fixed -- Fehler beim auslesen der netIdent_RIC im MySQL Plugin [#347](https://github.com/Schrolli91/BOSWatch/pull/347) +- Fehler beim Auslesen der netIdent_RIC im MySQL Plugin [#347](https://github.com/Schrolli91/BOSWatch/pull/347) ##### Security From cf1b5b3fc4960f6c688d242b227c00d4e8e24666 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Mon, 15 Jan 2018 06:56:12 +0100 Subject: [PATCH 093/114] PEP8 changes to pushover --- .gitignore | 2 + plugins/Pushover/Pushover.py | 225 ++++++++++++++++++----------------- 2 files changed, 115 insertions(+), 112 deletions(-) diff --git a/.gitignore b/.gitignore index 3b70e90..f37fd5c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ log/ \.pydevproject \.settings/ + +\.idea/ diff --git a/plugins/Pushover/Pushover.py b/plugins/Pushover/Pushover.py index d1edb66..d220de6 100644 --- a/plugins/Pushover/Pushover.py +++ b/plugins/Pushover/Pushover.py @@ -9,31 +9,32 @@ Pushover-Plugin to send FMS-, ZVEI- and POCSAG - messages to Pushover Clients @requires: Pushover-Configuration has to be set in the config.ini """ -import logging # Global logger -import httplib #for the HTTP request +import logging # Global logger +import httplib # for the HTTP request import urllib from includes import globalVars # Global variables -#from includes.helper import timeHandler +# from includes.helper import timeHandler from includes.helper import configHandler from includes.helper import wildcardHandler + ## # # onLoad (init) function of plugin # will be called one time by the pluginLoader on start # def onLoad(): - """ - While loading the plugins by pluginLoader.loadPlugins() - this onLoad() routine is called one time for initialize the plugin + """ + While loading the plugins by pluginLoader.loadPlugins() + this onLoad() routine is called one time for initialize the plugin - @requires: nothing + @requires: nothing - @return: nothing - """ - # nothing to do for this plugin - return + @return: nothing + """ + # nothing to do for this plugin + return ## @@ -41,112 +42,112 @@ def onLoad(): # Main function of Pushover-plugin # will be called by the alarmHandler # -def run(typ,freq,data): - """ - This function is the implementation of the Pushover-Plugin. - It will send the data to Pushover API +def run(typ, freq, data): + """ + This function is the implementation of the Pushover-Plugin. + It will send the data to Pushover API - @type typ: string (FMS|ZVEI|POC) - @param typ: Typ of the dataset - @type data: map of data (structure see readme.md in plugin folder) - @param data: Contains the parameter - @type freq: string - @keyword freq: frequency of the SDR Stick + @type typ: string (FMS|ZVEI|POC) + @param typ: Typ of the dataset + @type data: map of data (structure see readme.md in plugin folder) + @param data: Contains the parameter + @type freq: string + @keyword freq: frequency of the SDR Stick - @requires: Pushover-Configuration has to be set in the config.ini + @requires: Pushover-Configuration has to be set in the config.ini - @return: nothing - """ - try: - if configHandler.checkConfig("Pushover"): #read and debug the config + @return: nothing + """ + try: + if configHandler.checkConfig("Pushover"): # read and debug the config - if typ == "FMS": - # - # building message for FMS - # - - message = globalVars.config.get("Pushover", "fms_message") - title = globalVars.config.get("Pushover", "fms_title") - priority = globalVars.config.get("Pushover", "fms_prio") - logging.debug("Sending message: %s", message) - - elif typ == "ZVEI": - # - # building message for ZVEI - # - message = globalVars.config.get("Pushover", "zvei_message") - title = globalVars.config.get("Pushover", "zvei_title") - priority = globalVars.config.get("Pushover", "zvei_prio") - logging.debug("Sending message: %s", message) - - elif typ == "POC": - - # - # Pushover-Request - # - logging.debug("send Pushover for %s", typ) - - if data["function"] == '1': - priority = globalVars.config.get("Pushover", "SubA") - elif data["function"] == '2': - priority = globalVars.config.get("Pushover", "SubB") - elif data["function"] == '3': - priority = globalVars.config.get("Pushover", "SubC") - elif data["function"] == '4': - priority = globalVars.config.get("Pushover", "SubD") - else: - priority = 0 - message = globalVars.config.get("Pushover", "poc_message") - title = globalVars.config.get("Pushover", "poc_title") - - else: - logging.warning("Invalid type: %s", typ) - - try: - # replace the wildcards - message = wildcardHandler.replaceWildcards(message,data) - title = wildcardHandler.replaceWildcards(title,data) - - # start the connection - conn = httplib.HTTPSConnection("api.pushover.net:443") - conn.request("POST", "/1/messages.json", - urllib.urlencode({ - "token": globalVars.config.get("Pushover", "api_key"), - "user": globalVars.config.get("Pushover", "user_key"), - "message": message, - "html": globalVars.config.get("Pushover", "html"), - "title": title, - "priority": priority, - "retry": globalVars.config.get("Pushover", "retry"), - "expire": globalVars.config.get("Pushover", "expire") - }),{"Content-type": "application/x-www-form-urlencoded"}) + if typ == "FMS": + # + # building message for FMS + # - except: - logging.error("cannot send Pushover request") - logging.debug("cannot send Pushover request", exc_info=True) - return + message = globalVars.config.get("Pushover", "fms_message") + title = globalVars.config.get("Pushover", "fms_title") + priority = globalVars.config.get("Pushover", "fms_prio") + logging.debug("Sending message: %s", message) - try: - # - # check Pushover-Response - # - response = conn.getresponse() - if str(response.status) == "200": #Check Pushover Response and print a Log or Error - logging.debug("Pushover response: %s - %s" , str(response.status), str(response.reason)) - else: - logging.warning("Pushover response: %s - %s" , str(response.status), str(response.reason)) - except: #otherwise - logging.error("cannot get Pushover response") - logging.debug("cannot get Pushover response", exc_info=True) - return + elif typ == "ZVEI": + # + # building message for ZVEI + # + message = globalVars.config.get("Pushover", "zvei_message") + title = globalVars.config.get("Pushover", "zvei_title") + priority = globalVars.config.get("Pushover", "zvei_prio") + logging.debug("Sending message: %s", message) - finally: - logging.debug("close Pushover-Connection") - try: - request.close() - except: - pass + elif typ == "POC": - except: - logging.error("unknown error") - logging.debug("unknown error", exc_info=True) + # + # Pushover-Request + # + logging.debug("send Pushover for %s", typ) + + if data["function"] == '1': + priority = globalVars.config.get("Pushover", "SubA") + elif data["function"] == '2': + priority = globalVars.config.get("Pushover", "SubB") + elif data["function"] == '3': + priority = globalVars.config.get("Pushover", "SubC") + elif data["function"] == '4': + priority = globalVars.config.get("Pushover", "SubD") + else: + priority = 0 + message = globalVars.config.get("Pushover", "poc_message") + title = globalVars.config.get("Pushover", "poc_title") + + else: + logging.warning("Invalid type: %s", typ) + + try: + # replace the wildcards + message = wildcardHandler.replaceWildcards(message, data) + title = wildcardHandler.replaceWildcards(title, data) + + # start the connection + conn = httplib.HTTPSConnection("api.pushover.net:443") + conn.request("POST", "/1/messages.json", + urllib.urlencode({ + "token": globalVars.config.get("Pushover", "api_key"), + "user": globalVars.config.get("Pushover", "user_key"), + "message": message, + "html": globalVars.config.get("Pushover", "html"), + "title": title, + "priority": priority, + "retry": globalVars.config.get("Pushover", "retry"), + "expire": globalVars.config.get("Pushover", "expire") + }), {"Content-type": "application/x-www-form-urlencoded"}) + + except: + logging.error("cannot send Pushover request") + logging.debug("cannot send Pushover request", exc_info=True) + return + + try: + # + # check Pushover-Response + # + response = conn.getresponse() + if str(response.status) == "200": # Check Pushover Response and print a Log or Error + logging.debug("Pushover response: %s - %s", str(response.status), str(response.reason)) + else: + logging.warning("Pushover response: %s - %s", str(response.status), str(response.reason)) + except: # otherwise + logging.error("cannot get Pushover response") + logging.debug("cannot get Pushover response", exc_info=True) + return + + finally: + logging.debug("close Pushover-Connection") + try: + request.close() + except: + pass + + except: + logging.error("unknown error") + logging.debug("unknown error", exc_info=True) From 5209ac0804bbe799d172260643b266b1364953ad Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 18 Jan 2018 08:00:30 +0100 Subject: [PATCH 094/114] edit comment in config (%FUNCTEXT%) --- config/config.template.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/config/config.template.ini b/config/config.template.ini index 496070b..d17cd3f 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -486,6 +486,7 @@ test2 = 123456 # %RIC% = POCSAG RIC # %FUNC% = POCSAG function/Subric (1-4) # %FUNCCHAR% = POCSAG function/Subric als character (a-d) +# %FUNCTEXT% = POCSAG static Subric message (see [POC]) # %MSG% = Message of the POCSAG telegram # %BITRATE% = Bitrate of the POCSAG telegram # %DESCR% = Description, if description-module is used From fcae71a7d1a88777fcec64f39593c591f65cab9e Mon Sep 17 00:00:00 2001 From: CJHarms Date: Tue, 13 Feb 2018 18:31:04 +0100 Subject: [PATCH 095/114] Added some more Logging Added more Debug Logging for the alarmHeaders --- plugins/FFAgent/FFAgent.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/FFAgent/FFAgent.py b/plugins/FFAgent/FFAgent.py index 8dcff85..fa16d76 100644 --- a/plugins/FFAgent/FFAgent.py +++ b/plugins/FFAgent/FFAgent.py @@ -132,6 +132,7 @@ def run(typ,freq,data): "selectiveCallCode": selectiveCallCode, "hmac": hmac.new(webApiKey, webApiToken + selectiveCallCode + accessToken + alarmData, digestmod=hashlib.sha256).hexdigest() } + logging.debug(alarmHeaders) if globalVars.config.get("FFAgent", "live") == "1": r = requests.post(url, data=alarmData, headers=headers, verify=serverCertFile, cert=(clientCertFile, clientCertPass)) From 14df7d7fa40744cd4f873efefdc6a41ec7ab9218 Mon Sep 17 00:00:00 2001 From: CJHarms Date: Tue, 13 Feb 2018 18:31:40 +0100 Subject: [PATCH 096/114] Fixed small Typo Fixed a small Typo --- plugins/FFAgent/FFAgent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/FFAgent/FFAgent.py b/plugins/FFAgent/FFAgent.py index fa16d76..561ca86 100644 --- a/plugins/FFAgent/FFAgent.py +++ b/plugins/FFAgent/FFAgent.py @@ -135,7 +135,7 @@ def run(typ,freq,data): logging.debug(alarmHeaders) if globalVars.config.get("FFAgent", "live") == "1": - r = requests.post(url, data=alarmData, headers=headers, verify=serverCertFile, cert=(clientCertFile, clientCertPass)) + r = requests.post(url, data=alarmData, headers=alarmHeaders, verify=serverCertFile, cert=(clientCertFile, clientCertPass)) else: r = requests.post(url, data=alarmData, headers=alarmHeaders, verify=serverCertFile) From 0468db2647d8d36f098bfd64832cb6bf2666dc38 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 15 Feb 2018 12:20:39 +0100 Subject: [PATCH 097/114] Fixing deprecated functions Replacing old functions --- exampleAddOns/simpleWeb/mysql.class.php | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/exampleAddOns/simpleWeb/mysql.class.php b/exampleAddOns/simpleWeb/mysql.class.php index 69d5fbd..a74b4b6 100644 --- a/exampleAddOns/simpleWeb/mysql.class.php +++ b/exampleAddOns/simpleWeb/mysql.class.php @@ -23,16 +23,16 @@ Simple Database Class (C) by Bastian Schroll 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; @@ -41,17 +41,17 @@ Simple Database Class (C) by Bastian Schroll /** * Database::query() * - * F�hrt einen MySQL Query aus + * Fuehrt einen MySQL Query aus * - * @param mixed $query Auszuf�hrender Query + * @param mixed $query Auszufuehrender Query * @return Result-Handler/FALSE */ 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; @@ -60,51 +60,51 @@ Simple Database Class (C) by Bastian Schroll /** * Database::fetchAssoc() * - * Liefert alle gefundnen Datens�tze als Assoc + * Liefert alle gefundnen Datensaetze als Assoc * * @param mixed $result Externer Result-Handler - * @return gefundene Datens�tze als Assoc + * @return gefundene Datensaetze als Assoc */ 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); } } /** * Database::count() * - * Z�hlt alle gefundenen Datens�tze + * Zaehlt alle gefundenen Datensaetze * * @param mixed $result Externer Result-Handler - * @return Anzahl gefundener Datens�tze + * @return Anzahl gefundener Datensaetze */ function count($result = null) { if ($result != null) { - return @mysql_num_rows($result); + return @mysqli_num_rows($result); } else { - return @mysql_num_rows($this->result); + return @mysqli_num_rows($this->result); } } /** * Database::closeConnection() * - * Schlie�t die bestehende MySQL Verbindung + * Schliesst die bestehende MySQL Verbindung * * @return TRUE/FALSE */ function closeConnection() { - if (!@mysql_close($this->conn)) + if (!@mysqli_close($this->conn)) { $this->error("Verbindung zur Datenbank konnte nicht getrennt werden!", mysql_error()); return false; From 9257cb2cfe654295ae23950e3bc57900c154ea73 Mon Sep 17 00:00:00 2001 From: CJHarms Date: Fri, 16 Feb 2018 22:07:45 +0100 Subject: [PATCH 098/114] Convert alarmHeaders to OrderedDict Used OrderedDict for the alarmHeaders to make sure the Dictionary Order is preserved to serve a correctly formated and ordered JSON when using Perl <3.6 --- plugins/FFAgent/FFAgent.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/FFAgent/FFAgent.py b/plugins/FFAgent/FFAgent.py index 561ca86..759ec19 100644 --- a/plugins/FFAgent/FFAgent.py +++ b/plugins/FFAgent/FFAgent.py @@ -18,6 +18,9 @@ from includes import globalVars # Global variables #from includes.helper import timeHandler from includes.helper import configHandler +# needed for Ordered Dictionaries to serve correctly ordered JSON +from collections import OrderedDict + ## # # onLoad (init) function of plugin @@ -125,13 +128,13 @@ def run(typ,freq,data): alarmData = json.dumps(alarmData) logging.debug(alarmData) - alarmHeaders = { - "Content-Type": "application/json", - "webApiToken": webApiToken, - "accessToken": accessToken, - "selectiveCallCode": selectiveCallCode, - "hmac": hmac.new(webApiKey, webApiToken + selectiveCallCode + accessToken + alarmData, digestmod=hashlib.sha256).hexdigest() - } + alarmHeaders = OrderedDict([ + ("Content-Type", "application/json"), + ("webApiToken", webApiToken), + ("accessToken", accessToken), + ("selectiveCallCode", selectiveCallCode), + ("hmac", hmac.new(webApiKey, webApiToken + selectiveCallCode + accessToken + alarmData, digestmod=hashlib.sha256).hexdigest()) + ]) logging.debug(alarmHeaders) if globalVars.config.get("FFAgent", "live") == "1": From 3ed90b4a97c6c8aa39bdedf36ca0b6e3e2d4809f Mon Sep 17 00:00:00 2001 From: CJHarms Date: Mon, 19 Feb 2018 17:37:02 +0100 Subject: [PATCH 099/114] Revert "Convert alarmHeaders to OrderedDict" This reverts commit 9257cb2cfe654295ae23950e3bc57900c154ea73. --- plugins/FFAgent/FFAgent.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/plugins/FFAgent/FFAgent.py b/plugins/FFAgent/FFAgent.py index 759ec19..561ca86 100644 --- a/plugins/FFAgent/FFAgent.py +++ b/plugins/FFAgent/FFAgent.py @@ -18,9 +18,6 @@ from includes import globalVars # Global variables #from includes.helper import timeHandler from includes.helper import configHandler -# needed for Ordered Dictionaries to serve correctly ordered JSON -from collections import OrderedDict - ## # # onLoad (init) function of plugin @@ -128,13 +125,13 @@ def run(typ,freq,data): alarmData = json.dumps(alarmData) logging.debug(alarmData) - alarmHeaders = OrderedDict([ - ("Content-Type", "application/json"), - ("webApiToken", webApiToken), - ("accessToken", accessToken), - ("selectiveCallCode", selectiveCallCode), - ("hmac", hmac.new(webApiKey, webApiToken + selectiveCallCode + accessToken + alarmData, digestmod=hashlib.sha256).hexdigest()) - ]) + alarmHeaders = { + "Content-Type": "application/json", + "webApiToken": webApiToken, + "accessToken": accessToken, + "selectiveCallCode": selectiveCallCode, + "hmac": hmac.new(webApiKey, webApiToken + selectiveCallCode + accessToken + alarmData, digestmod=hashlib.sha256).hexdigest() + } logging.debug(alarmHeaders) if globalVars.config.get("FFAgent", "live") == "1": From 6ce67f24ddd596a9dc273e9e9196feecfc1f2a4b Mon Sep 17 00:00:00 2001 From: f-kessler Date: Thu, 22 Feb 2018 14:20:33 +0100 Subject: [PATCH 100/114] Enhancement for multicastAlarm. The RICs configured in multicastAlarm_delimiter_ric and multicastAlarm_ric no longer need to be included in allow_ric or filter_range_start/filter_range_end. --- includes/decoders/poc.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/includes/decoders/poc.py b/includes/decoders/poc.py index da86318..30a0e22 100644 --- a/includes/decoders/poc.py +++ b/includes/decoders/poc.py @@ -62,11 +62,23 @@ def isAllowed(poc_id): return True else: allowed = 0 + # 5.) Implementation for multicastAlarm + if globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"): + if poc_id in globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"): + logging.info("RIC %s as multicastAlarm delimiter", poc_id) + return True + else: + allowed = 0 + if globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): + if poc_id in globalVars.config.get("multicastAlarm", "multicastAlarm_ric"): + logging.info("RIC %s as multicastAlarm message", poc_id) + return True + else: + allowed = 0 if allowed == 0: return False return True - ## # # POCSAG decoder function From fadb1de813ca30d8dc97838bbca51bb4f412504d Mon Sep 17 00:00:00 2001 From: f-kessler Date: Fri, 23 Feb 2018 14:42:47 +0100 Subject: [PATCH 101/114] =?UTF-8?q?347=20und=20357=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4e9d3a..3a5e25e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,13 @@ - FMS und ZVEI Support für Pushover Plugin [#352](https://github.com/Schrolli91/BOSWatch/pull/352) - Benutzerdefinierte Nachrichten für Pushover Plugin in config [#352](https://github.com/Schrolli91/BOSWatch/pull/352) ##### Changed +- multicastAlarm Plugin - RICs die von multicastAlarm genutzt werden, müssen nicht mehr in der config bei allow_ric bzw. filter_range_start/filter_range_end berücksichtigt werden. [#357](https://github.com/Schrolli91/BOSWatch/pull/357) +- FFAgent Plugin - Debug Logging für die alarmHeaders eingebaut zwecks Troubleshooting [#354](https://github.com/Schrolli91/BOSWatch/pull/354) ##### Deprecated ##### Removed ##### Fixed - Fehler beim Auslesen der netIdent_RIC im MySQL Plugin [#347](https://github.com/Schrolli91/BOSWatch/pull/347) +- FFAgent Plugin - Typo bei alarmHeaders für Live Betrieb gefixt [#354](https://github.com/Schrolli91/BOSWatch/pull/354) ##### Security From 58ad0e5308a995fb5ebced9c79691ed4523b292b Mon Sep 17 00:00:00 2001 From: f-kessler Date: Fri, 10 Aug 2018 23:12:42 +0200 Subject: [PATCH 102/114] Clear buffer after multicastAlarm_ric received Fix for networks that mix normal alarms with multicastAlarms (delimiter needs to be deactivated). If the delimiter is deactivated, RICs in the buffer will be deleted only if they are older than multicastAlarm_ignore_time. This could cause a mixture of RICs of the current and the privious multicastAlarm. This problem can be fixed, by clearing the buffer after the multicastAlarm sequence has finished. --- includes/multicastAlarm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index 40a8344..b6d1e7d 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -58,6 +58,8 @@ def multicastAlarmExec(freq, data): try: from includes import alarmHandler alarmHandler.processAlarmHandler("POC", freq, data) + multiList = [] + logging.debug("multicastAlarm finished - buffer cleared") except: logging.error("processing alarm failed") logging.debug("processing alarm failed", exc_info=True) From 86c0467ee23b05982171f58333d2739d3dd63a2b Mon Sep 17 00:00:00 2001 From: f-kessler Date: Fri, 10 Aug 2018 23:19:08 +0200 Subject: [PATCH 103/114] Updated description for the multicastAlarm_delimiter_ric --- 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 d17cd3f..11a6caf 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -144,7 +144,7 @@ multicastAlarm = 0 # time limit for alarms that do not belong to the multicastAlarm sequence in seconds multicastAlarm_ignore_time = 15 -# multicastAlarm delimiter RIC (usually used as a starting point for a alarm sequence) (can be empty) +# multicastAlarm delimiter RIC (usually used as a starting point for a alarm sequence). Needs to be empty if multicastAlarms are interrupted by normal alarms. multicastAlarm_delimiter_ric = # multicastAlarm RIC that is used to send the text message From 8c1351ccbd467f2b6bb2ef44b45687021dbc054d Mon Sep 17 00:00:00 2001 From: f-kessler Date: Sat, 11 Aug 2018 12:52:30 +0200 Subject: [PATCH 104/114] fixed the delete of all contents in multiList --- includes/multicastAlarm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index b6d1e7d..e9b8122 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -29,7 +29,7 @@ def newEntrymultiList(data): timestamp = int(time.time()) # multicastAlarm processing if enabled and delimiter RIC has been received if data['ric'] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"): - multiList = [] + del multiList[:] logging.debug("delimiter RIC received - buffer cleared") else: multiList.append([data, timestamp]) @@ -58,7 +58,7 @@ def multicastAlarmExec(freq, data): try: from includes import alarmHandler alarmHandler.processAlarmHandler("POC", freq, data) - multiList = [] + del multiList[:] logging.debug("multicastAlarm finished - buffer cleared") except: logging.error("processing alarm failed") From ce144c82e19fa3517971cc94ba27f4d2a5c54703 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Sat, 11 Aug 2018 13:37:30 +0200 Subject: [PATCH 105/114] moved delete to the end of the function --- includes/multicastAlarm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index e9b8122..d8736fd 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -58,8 +58,8 @@ def multicastAlarmExec(freq, data): try: from includes import alarmHandler alarmHandler.processAlarmHandler("POC", freq, data) - del multiList[:] - logging.debug("multicastAlarm finished - buffer cleared") except: logging.error("processing alarm failed") logging.debug("processing alarm failed", exc_info=True) + del multiList[:] + logging.debug("multicastAlarm finished - buffer cleared") From e5db9fed097970c1a3492dfb005e5842f661ec6e Mon Sep 17 00:00:00 2001 From: f-kessler Date: Sat, 11 Aug 2018 16:43:38 +0200 Subject: [PATCH 106/114] fixed indenting bug --- includes/multicastAlarm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/multicastAlarm.py b/includes/multicastAlarm.py index d8736fd..8aafadd 100644 --- a/includes/multicastAlarm.py +++ b/includes/multicastAlarm.py @@ -61,5 +61,5 @@ def multicastAlarmExec(freq, data): except: logging.error("processing alarm failed") logging.debug("processing alarm failed", exc_info=True) - del multiList[:] - logging.debug("multicastAlarm finished - buffer cleared") + del multiList[:] + logging.debug("multicastAlarm finished - buffer cleared") From 95262e0c7c5f74ed64f38d338b9bbdfe51c05ffc Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 15 Aug 2018 07:26:22 +0200 Subject: [PATCH 107/114] edit dev version --- includes/globalVars.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/globalVars.py b/includes/globalVars.py index 3b71248..b14594d 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,7 +9,7 @@ Global variables """ # version info -versionNr = "2.3.1" +versionNr = "2.5" branch = "dev" buildDate = "unreleased" From cf7e8ead5afbbdf4eed296e0e36e3591a58855c5 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Thu, 16 Aug 2018 10:58:10 +0200 Subject: [PATCH 108/114] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a5e25e..e9475dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ##### Changed - multicastAlarm Plugin - RICs die von multicastAlarm genutzt werden, müssen nicht mehr in der config bei allow_ric bzw. filter_range_start/filter_range_end berücksichtigt werden. [#357](https://github.com/Schrolli91/BOSWatch/pull/357) - FFAgent Plugin - Debug Logging für die alarmHeaders eingebaut zwecks Troubleshooting [#354](https://github.com/Schrolli91/BOSWatch/pull/354) +- multicastAlarm Plugin - Buffer nach jedem Alarm löschen - erlaubt in kombination mit "doubleFilter_check_msg" die Verwendung in Netzen, die zwischen multicastAlarm RICs auch normale Alarme senden. #370(https://github.com/Schrolli91/BOSWatch/pull/370) ##### Deprecated ##### Removed ##### Fixed From 110d3bf66f04ef944adc81df2d9c9b35968c5e0d Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 16 Aug 2018 20:19:47 +0200 Subject: [PATCH 109/114] prepare after release changes --- CHANGELOG.md | 14 ++++++++++---- includes/globalVars.py | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9475dc..95e857f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,16 @@ # Changelog -### __[v2.3.1]__ - Unreleased +### __[v2.#]__ - Unreleased +##### Added +##### Changed +##### Deprecated +##### Removed +##### Fixed +##### Security + + +### __[v2.4]__ - 17.08.2018 ##### Added - Config Eintrag um Port für MySQL Plugin festzulegen [#345](https://github.com/Schrolli91/BOSWatch/pull/345) - FMS und ZVEI Support für Pushover Plugin [#352](https://github.com/Schrolli91/BOSWatch/pull/352) @@ -10,12 +19,9 @@ - multicastAlarm Plugin - RICs die von multicastAlarm genutzt werden, müssen nicht mehr in der config bei allow_ric bzw. filter_range_start/filter_range_end berücksichtigt werden. [#357](https://github.com/Schrolli91/BOSWatch/pull/357) - FFAgent Plugin - Debug Logging für die alarmHeaders eingebaut zwecks Troubleshooting [#354](https://github.com/Schrolli91/BOSWatch/pull/354) - multicastAlarm Plugin - Buffer nach jedem Alarm löschen - erlaubt in kombination mit "doubleFilter_check_msg" die Verwendung in Netzen, die zwischen multicastAlarm RICs auch normale Alarme senden. #370(https://github.com/Schrolli91/BOSWatch/pull/370) -##### Deprecated -##### Removed ##### Fixed - Fehler beim Auslesen der netIdent_RIC im MySQL Plugin [#347](https://github.com/Schrolli91/BOSWatch/pull/347) - FFAgent Plugin - Typo bei alarmHeaders für Live Betrieb gefixt [#354](https://github.com/Schrolli91/BOSWatch/pull/354) -##### Security ### __[v2.3]__ - 22.12.2017 diff --git a/includes/globalVars.py b/includes/globalVars.py index b14594d..921975f 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,7 +9,7 @@ Global variables """ # version info -versionNr = "2.5" +versionNr = "2.4" branch = "dev" buildDate = "unreleased" From 04ef809e51ef771f3c225eb1cd71398e0b5447f4 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 16 Aug 2018 20:39:37 +0200 Subject: [PATCH 110/114] fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95e857f..82f64fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ ##### Changed - multicastAlarm Plugin - RICs die von multicastAlarm genutzt werden, müssen nicht mehr in der config bei allow_ric bzw. filter_range_start/filter_range_end berücksichtigt werden. [#357](https://github.com/Schrolli91/BOSWatch/pull/357) - FFAgent Plugin - Debug Logging für die alarmHeaders eingebaut zwecks Troubleshooting [#354](https://github.com/Schrolli91/BOSWatch/pull/354) -- multicastAlarm Plugin - Buffer nach jedem Alarm löschen - erlaubt in kombination mit "doubleFilter_check_msg" die Verwendung in Netzen, die zwischen multicastAlarm RICs auch normale Alarme senden. #370(https://github.com/Schrolli91/BOSWatch/pull/370) +- multicastAlarm Plugin - Buffer nach jedem Alarm löschen - erlaubt in kombination mit "doubleFilter_check_msg" die Verwendung in Netzen, die zwischen multicastAlarm RICs auch normale Alarme senden. [#370](https://github.com/Schrolli91/BOSWatch/pull/370) ##### Fixed - Fehler beim Auslesen der netIdent_RIC im MySQL Plugin [#347](https://github.com/Schrolli91/BOSWatch/pull/347) - FFAgent Plugin - Typo bei alarmHeaders für Live Betrieb gefixt [#354](https://github.com/Schrolli91/BOSWatch/pull/354) From bf31a04e074f5b02ec4e56fe245c3a263fc2de12 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 5 Sep 2018 07:18:06 +0200 Subject: [PATCH 111/114] remove NMA --- boswatch.py | 23 -- config/config.template.ini | 34 --- includes/NMAHandler.py | 73 ----- includes/pynma/README.md | 137 ---------- includes/pynma/__init__.py | 3 - includes/pynma/pynma.py | 153 ----------- plugins/notifyMyAndroid/notifyMyAndroid.py | 301 --------------------- 7 files changed, 724 deletions(-) delete mode 100644 includes/NMAHandler.py delete mode 100644 includes/pynma/README.md delete mode 100644 includes/pynma/__init__.py delete mode 100644 includes/pynma/pynma.py delete mode 100644 plugins/notifyMyAndroid/notifyMyAndroid.py diff --git a/boswatch.py b/boswatch.py index 2ad194d..8d316b6 100755 --- a/boswatch.py +++ b/boswatch.py @@ -249,29 +249,6 @@ try: logging.debug("cannot set loglevel of fileHandler", exc_info=True) - # - # Add NMA logging handler - # - try: - if configHandler.checkConfig("NMAHandler"): - # is NMAHandler enabled? - if globalVars.config.getboolean("NMAHandler", "enableHandler") == True: - # we only could do something, if an APIKey is given: - if len(globalVars.config.get("NMAHandler","APIKey")) > 0: - logging.debug("add NMA logging handler") - from includes import NMAHandler - if globalVars.config.get("NMAHandler","appName") == "": - nmaHandler = NMAHandler.NMAHandler(globalVars.config.get("NMAHandler","APIKey")) - else: - nmaHandler = NMAHandler.NMAHandler(globalVars.config.get("NMAHandler","APIKey"), globalVars.config.get("NMAHandler","appName")) - nmaHandler.setLevel(globalVars.config.getint("NMAHandler","loglevel")) - myLogger.addHandler(nmaHandler) - except: - # It's an error, but we could work without that stuff... - logging.error("cannot add NMA logging handler") - logging.debug("cannot add NMA logging handler", exc_info=True) - - # initialization was fine, continue with main program... # diff --git a/config/config.template.ini b/config/config.template.ini index 11a6caf..dd999a5 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -64,22 +64,6 @@ doubleFilter_check_msg = 0 writeMultimonRaw = 0 -[NMAHandler] -# you can use a logging handler for sending logging records to NotifyMyAndroid -# enableHandler (0|1) will enable the NMA handler -enableHandler = 0 - -# loglevel for NMAHandler (see BOSWatch loglevel description) -loglevel = 50 - -# logging record will send to APIKey -APIKey = - -# you can change the name of the application (default: BOSWatch) -# (f.e. if you use more than one instance of BOSWatch) -appName = BOSWatch - - [FMS] # look-up-table for adding a description # using description (0 - off | 1 - on) @@ -177,7 +161,6 @@ eMail = 0 BosMon = 0 firEmergency = 0 jsonSocket = 0 -notifyMyAndroid = 0 SMS = 0 Sms77 = 0 FFAgent = 0 @@ -287,23 +270,6 @@ server = 192.168.0.1 port = 8888 -[notifyMyAndroid] -# APIKey given from notifyMyAndroid -APIKey = - -# Priority goes from -2 (lowest) to 2 (highest). The default priority is 0 (normal) -priority = 0 - -# You can change the name of the application (default: BOSWatch) -# (f.e. if you use more than one instance of BOSWatch) -appName = BOSWatch - -# instead of a given APIKey/priority you could import them by a csv-file (0|1) -# APIKey and priority above will be ignored, if you use a csv -# configuration loaded from csv/nma.csv -usecsv = 0 - - [SMS] # be aware that you need 'gammu' installed and running # at least you need an UMTS-stick which is supported by 'gammu' diff --git a/includes/NMAHandler.py b/includes/NMAHandler.py deleted file mode 100644 index 990e6f9..0000000 --- a/includes/NMAHandler.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/python -# -*- coding: UTF-8 -*- - -""" -Logging Handler for NotifyMyAndroid - -@author: Jens Herrmann -""" - -import logging -from includes.pynma import pynma - -class NMAHandler(logging.Handler): # Inherit from logging.Handler - """ - Handler instances dispatch logging events to NotifyMyAndroid. - """ - - def __init__(self, APIKey, application="BOSWatch", event="Logging-Handler"): - """ - Initializes the handler with NMA-specific parameters. - - @param APIKey: might be a string containing 1 key or an array of keys - @param application: application name [256] - @param event: event name [1000] - """ - # run the regular Handler __init__ - logging.Handler.__init__(self) - # Our custom argument - self.APIKey = APIKey - self.application = application - self.event = event - self.nma = pynma.PyNMA(self.APIKey) - - - def emit(self, record): - """ - Send logging record via NMA - """ - # record.message is the log message - message = record.message - - # if exist, add details as NMA event: - # record.module is the module- or filename - if (len(record.module) > 0): - event = "Module: " + record.module - # record.functionName is the name of the function - # will be "" if the message is not in a function - if len(record.funcName) > 0: - if not record.funcName == "": - event += " - " + record.funcName + "()" - else: - # we have to set an event-text, use self.event now - event = self.event - - # record.levelno is the log level - # loglevel: 10 = debug => priority: -2 - # loglevel: 20 = info => priority: -1 - # loglevel: 30 = warning => priority: 0 - # loglevel: 40 = error => priority: 1 - # loglevel: 50 = critical => priority: 2 - if record.levelno >= 50: - priority = 2 - elif record.levelno >= 40: - priority = 1 - elif record.levelno >= 30: - priority = 0 - elif record.levelno >= 20: - priority = -1 - else: - priority = -2 - - # pynma.push(self, application="", event="", description="", url="", contenttype=None, priority=0, batch_mode=False, html=False) - self.nma.push(application=self.application, event=event, description=message, priority=priority) diff --git a/includes/pynma/README.md b/includes/pynma/README.md deleted file mode 100644 index e72ff1e..0000000 --- a/includes/pynma/README.md +++ /dev/null @@ -1,137 +0,0 @@ -Pynma -====== - -Pynma is a simple python module for the [NotifyMyAndroid][nma] [API][NMA API]. - -[nma]: http://nma.usk.bz/ -[NMA API]: http://nma.usk.bz/api.php - -Credits to: Damien Degois (github.com/babs) -Refactoring: Adriano Maia (adriano@usk.bz) - -[NotifyMyAndroid][nma] ---------------- -NotifyMyAndroid is a Prowl-like application for the Android. Notifications can be sent from your application Android device using push. NMA has an extensive API, which allows your scripts to integrate beautifully. (source: http://nma.usk.bz/) - -### How it works: -First, import the module: - - import pynma - -#### Keys management - -Create a PyNMA simple instance: - - p = pynma.PyNMA( "apikey(s)", "developerkey") - -A developerkey is optional. If you'd like to add just one API key, set it as string, if you want more, just provide a list of API key strings. - - p = pynma.PyNMA(['apikey1','apikey2']) # multiple API keys - p = pynma.PyNMA("apikey1","providerkey") # 1 API key with a providerkey - -For more flexible usage, you can add and remove keys: - - p.addkey("apikey1") - p.addkey(["apikey2","apikey3"]) - -Or set or change the providerkey - - p.developerkey("developerkey") - -#### Notification or Push or Add - - p.push(application, event, description, (opt) url, (opt) priority, (opt) batch mode) - -##### Application - -Application is your message generating application name (limited to 256) - -ex: my music player - -##### Event - -Event is the event name (limited to 1000) - -ex: switched to next track - -##### Description - -The description is the payload of your message (limited to 10000 (10k)) -ex: - - Playing next song, Blah Blah Blah - Artist: blah blah - Album: blah blah - Track: 18/24 - -##### Url - -The URL which should be attached to the notification. -This will trigger a redirect when on the user's device launched, and is viewable in the notification list. - -##### Priority - -Priority goes from -2 (lowest) to 2 (highest). the default priority is 0 (normal) - -##### Batch mode - -Batch mode is a boolean value to set if you'd like to push the same message to multiple API keys 5 by 5 (as the actual verion of prowl API allows you). This can reduce the number of call you make to the API which are limited. - -#### Return - -The push method returns a dict containing different values depending of the success of you call: - -##### The call succeed - -you'll have in the dict those keys: - - type: success - code: the HTTP like code (200 if success) - remaining: the number of API call you can to until the reset - resetdate: number of remaining minutes till the hourly reset of your API call limit - -##### The call failed - -For wathever reason, you call failed, the dict key "message" will contains the erro message returned by Prowl API. You'll find those keys: - - code: 400, 401, 402 or 500 (depends of the error kind) - message: API error message - -For the code description, please refer to [NMA API documentation][NMA API] for more informations - -##### The python module encountered an unhandled problem (mostly during parsing) - -The return keys will be: - - code: 600 - type: pynmaerror - message: the exception message - -Thanks ------- - -* **Cev** for URL integration and some fixes in docstring -* **ChaoticXSinZ** for UTF-8 integration and other typos - -License (MIT) -------------- - - Copyright (c) 2010-2011, Damien Degois. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. diff --git a/includes/pynma/__init__.py b/includes/pynma/__init__.py deleted file mode 100644 index 5df62d5..0000000 --- a/includes/pynma/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/python - -from .pynma import PyNMA diff --git a/includes/pynma/pynma.py b/includes/pynma/pynma.py deleted file mode 100644 index 5649f05..0000000 --- a/includes/pynma/pynma.py +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/python - -from xml.dom.minidom import parseString - -try: - from http.client import HTTPSConnection -except ImportError: - from httplib import HTTPSConnection - -try: - from urllib.parse import urlencode -except ImportError: - from urllib import urlencode - -__version__ = "1.0" - -API_SERVER = 'www.notifymyandroid.com' -ADD_PATH = '/publicapi/notify' - -USER_AGENT="PyNMA/v%s"%__version__ - -def uniq_preserve(seq): # Dave Kirby - # Order preserving - seen = set() - return [x for x in seq if x not in seen and not seen.add(x)] - -def uniq(seq): - # Not order preserving - return list({}.fromkeys(seq).keys()) - -class PyNMA(object): - """PyNMA(apikey=[], developerkey=None) -takes 2 optional arguments: - - (opt) apykey: might me a string containing 1 key or an array of keys - - (opt) developerkey: where you can store your developer key -""" - - def __init__(self, apikey=[], developerkey=None): - self._developerkey = None - self.developerkey(developerkey) - if apikey: - if isinstance(apikey, str): - apikey = [apikey] - self._apikey = uniq(apikey) - - def addkey(self, key): - "Add a key (register ?)" - if isinstance(key, str): - if not key in self._apikey: - self._apikey.append(key) - elif isinstance(key, list): - for k in key: - if not k in self._apikey: - self._apikey.append(k) - - def delkey(self, key): - "Removes a key (unregister ?)" - if isinstance(key, str): - if key in self._apikey: - self._apikey.remove(key) - elif isinstance(key, list): - for k in key: - if key in self._apikey: - self._apikey.remove(k) - - def developerkey(self, developerkey): - "Sets the developer key (and check it has the good length)" - 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): - """Special Funktion""" - if apikey: - if isinstance(apikey, str): - apikey = [apikey] - self._apikey = uniq(apikey) - return self.push(application, event, description, url, contenttype, priority, batch_mode, html) - - def push(self, application="", event="", description="", url="", contenttype=None, priority=0, batch_mode=False, html=False): - """Pushes a message on the registered API keys. -takes 5 arguments: - - (req) application: application name [256] - - (req) event: event name [1000] - - (req) description: description [10000] - - (opt) url: url [512] - - (opt) contenttype: Content Type (act: None (plain text) or text/html) - - (opt) priority: from -2 (lowest) to 2 (highest) (def:0) - - (opt) batch_mode: push to all keys at once (def:False) - - (opt) html: shortcut for contenttype=text/html -Warning: using batch_mode will return error only if all API keys are bad - cf: http://nma.usk.bz/api.php -""" - datas = { - 'application': application[:256].encode('utf8'), - 'event': event[:1024].encode('utf8'), - 'description': description[:10000].encode('utf8'), - 'priority': priority - } - - if url: - datas['url'] = url[:512] - - if contenttype == "text/html" or html == True: # Currently only accepted content type - datas['content-type'] = "text/html" - - if self._developerkey: - datas['developerkey'] = self._developerkey - - results = {} - - if not batch_mode: - for key in self._apikey: - datas['apikey'] = key - res = self.callapi('POST', ADD_PATH, datas) - results[key] = res - else: - datas['apikey'] = ",".join(self._apikey) - res = self.callapi('POST', ADD_PATH, datas) - results[datas['apikey']] = res - return results - - def callapi(self, method, path, args): - headers = { 'User-Agent': USER_AGENT } - if method == "POST": - headers['Content-type'] = "application/x-www-form-urlencoded" - http_handler = HTTPSConnection(API_SERVER) - http_handler.request(method, path, urlencode(args), headers) - resp = http_handler.getresponse() - - try: - res = self._parse_reponse(resp.read()) - except Exception as e: - res = {'type': "pynmaerror", - 'code': 600, - 'message': str(e) - } - - return res - - def _parse_reponse(self, response): - root = parseString(response).firstChild - for elem in root.childNodes: - if elem.nodeType == elem.TEXT_NODE: continue - if elem.tagName == 'success': - res = dict(list(elem.attributes.items())) - res['message'] = "" - res['type'] = elem.tagName - return res - if elem.tagName == 'error': - res = dict(list(elem.attributes.items())) - res['message'] = elem.firstChild.nodeValue - res['type'] = elem.tagName - return res diff --git a/plugins/notifyMyAndroid/notifyMyAndroid.py b/plugins/notifyMyAndroid/notifyMyAndroid.py deleted file mode 100644 index a8ab127..0000000 --- a/plugins/notifyMyAndroid/notifyMyAndroid.py +++ /dev/null @@ -1,301 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -""" -notifyMyAndroid-Plugin to dispatch FMS-, ZVEI- and POCSAG-messages via UDP/TCP - -@author: Jens Herrmann - -@requires: notifyMyAndroid-Configuration has to be set in the config.ini -""" - -import logging # Global logger -import csv # for loading the APIKeys - - -from includes import globalVars # Global variables - -from includes.helper import configHandler -from includes.helper import timeHandler -from includes.helper import stringConverter -from includes.pynma import pynma - - -# local variables -application = "BOSWatch" -APIKey = None -remainingMsgs = None -usecsv = False -# data structures: xAPIKeyList[id][i] = (APIKey, priority, eventPrefix) -fmsAPIKeyList = {} -zveiAPIKeyList = {} -pocAPIKeyList = {} - - -def checkResponse(response, APIKey): - """ - Helper function to check the response of NMA - - @type response: dict - @param response: Response of the pyNMA.push() method - @type data: string / array - @param data: a string containing 1 key or an array of keys - - @return: nothing - """ - # local variables - global remainingMsgs - try: - # - # check HTTP-Response - # - if str(response[APIKey]['code']) == "200": #Check HTTP Response an print a Log or Error - logging.debug("NMA response: %s" , str(response[APIKey]['code'])) - remainingMsgs = response[APIKey]['remaining'] - if int(remainingMsgs) == 0: - logging.error("NMA remaining msgs: %s" , str(remainingMsgs)) - if int(response[APIKey]['remaining']) < 20: - logging.warning("NMA remaining msgs: %s" , str(remainingMsgs)) - else: - logging.debug("NMA remaining msgs: %s" , str(remainingMsgs)) - else: - logging.warning("NMA response: %s - %s" , str(response[APIKey]['code']), str(response[APIKey]['message'])) - except: - logging.error("cannot read pynma response") - logging.debug("cannot read pynma response", exc_info=True) - return - - -## -# -# onLoad (init) function of plugin -# will be called one time by the pluginLoader on start -# -def onLoad(): - """ - While loading the plugins by pluginLoader.loadPlugins() - this onLoad() routine is called one time for initialize the plugin - - @requires: nothing - - @return: nothing - """ - # local variables - global application - global APIKey - global usecsv - - # load config: - configHandler.checkConfig("notifyMyAndroid") - application = stringConverter.convertToUnicode(globalVars.config.get("notifyMyAndroid","appName")) - usecsv = globalVars.config.getboolean("notifyMyAndroid","usecsv") - - # if no csv should use, we take the APIKey directly - if usecsv == False: - APIKey = globalVars.config.get("notifyMyAndroid","APIKey") - else: - # import the csv-file - try: - logging.debug("-- loading nma.csv") - with open(globalVars.script_path+'/csv/nma.csv') as csvfile: - # DictReader expected structure described in first line of csv-file - reader = csv.DictReader(csvfile) - for row in reader: - logging.debug(row) - # only import rows with an supported types - supportedTypes = ["FMS", "ZVEI", "POC"] - if row['typ'] in supportedTypes: - try: - if "FMS" in row['typ']: - # if len for id in mainList raise an KeyErrorException, we have to init it... - try: - if len(fmsAPIKeyList[row['id']]) > 0: - pass - except KeyError: - fmsAPIKeyList[row['id']] = [] - # data structure: fmsAPIKeyList[fms][i] = (APIKey, priority) - fmsAPIKeyList[row['id']].append((row['APIKey'], row['priority'], row['eventPrefix'])) - - elif "ZVEI" in row['typ']: - # if len for id in mainList raise an KeyErrorException, we have to init it... - try: - if len(zveiAPIKeyList[row['id']]) > 0: - pass - except KeyError: - zveiAPIKeyList[row['id']] = [] - # data structure: zveiAPIKeyList[zvei][i] = (APIKey, priority) - zveiAPIKeyList[row['id']].append((row['APIKey'], row['priority'], row['eventPrefix'])) - - elif "POC" in row['typ']: - # if len for id in mainList raise an KeyErrorException, we have to init it... - try: - if len(pocAPIKeyList[row['id']]) > 0: - pass - except KeyError: - pocAPIKeyList[row['id']] = [] - # data structure: zveiAPIKeyList[ric][i] = (APIKey, priority) - pocAPIKeyList[row['id']].append((row['APIKey'], row['priority'], row['eventPrefix'])) - - except: - # skip entry in case of an exception - logging.debug("error in shifting...", exc_info=True) - # if row['typ'] in supportedTypes - # for row in reader: - logging.debug("-- loading csv finished") - except: - logging.error("loading csvList for nma failed") - logging.debug("loading csvList for nma failed", exc_info=True) - raise - # and if usecsv == True - return - - -## -# -# Main function of jsonSocket-plugin -# will be called by the alarmHandler -# -def run(typ,freq,data): - """ - This function is the implementation of the notifyMyAndroid-Plugin. - - The configuration is set in the config.ini. - - @type typ: string (FMS|ZVEI|POC) - @param typ: Typ of the dataset for sending via UDP/TCP - @type data: map of data (structure see readme.md in plugin folder) - @param data: Contains the parameter for dispatch to UDP. - @type freq: string - @keyword freq: frequency of the SDR Stick - - @requires: notifyMyAndroid-Configuration has to be set in the config.ini - - @return: nothing - """ - # local variables - - try: - try: - # - # initialize to pyNMA - # - nma = pynma.PyNMA() - except: - logging.error("cannot initialize pyNMA") - logging.debug("cannot initialize pyNMA", exc_info=True) - # Without class, plugin couldn't work - return - - else: - # toDo is equals for all types, so only check if typ is supported - supportedTypes = ["FMS", "ZVEI", "POC"] - if typ in supportedTypes: - logging.debug("Start %s to NMA", typ) - try: - # build event and msg - # pyNMA expect strings are not in UTF-8 - event = stringConverter.convertToUnicode(data['description']) - msg = timeHandler.getDateTime(data['timestamp']) - if ("POC" in typ) and (len(data['msg']) > 0): - msg += "\n" + data['msg'] - msg = stringConverter.convertToUnicode(msg) - - # if not using csv-import, all is simple... - if usecsv == False: - response = nma.pushWithAPIKey(APIKey, application, event, msg, priority=globalVars.config.getint("notifyMyAndroid","priority")) - checkResponse(response, APIKey) - else: - if "FMS" in typ: - # lets look for fms in fmsAPIKeyList - xID = data['fms'] - try: - # data structure: fmsAPIKeyList[xID][i] = (xAPIKey, xPriority, xEventPrefix) - for i in range(len(fmsAPIKeyList[xID])): - xEvent = event - (xAPIKey, xPriority, xEventPrefix) = fmsAPIKeyList[xID][i] - if len(xEventPrefix) > 0: - xEvent = xEventPrefix + ": " + xEvent - response = nma.pushWithAPIKey(xAPIKey, application, xEvent, msg, priority=xPriority) - checkResponse(response, xAPIKey) - except KeyError: - # nothing found - pass - - elif "ZVEI" in typ: - # lets look for zvei in zveiAPIKeyList - xID = data['zvei'] - try: - # data structure: zveiAPIKeyList[xID][i] = (xAPIKey, xPriority, xEventPrefix) - for i in range(len(zveiAPIKeyList[xID])): - xEvent = event - (xAPIKey, xPriority, xEventPrefix) = zveiAPIKeyList[xID][i] - if len(xEventPrefix) > 0: - xEvent = xEventPrefix + ": " + xEvent - response = nma.pushWithAPIKey(xAPIKey, application, xEvent, msg, priority=xPriority) - checkResponse(response, xAPIKey) - except KeyError: - # nothing found - pass - - elif "POC" in typ: - xID = "" - # 1. lets look for ric+functionChar in pocAPIKeyList - try: - xID = data['ric'] + data['functionChar'] - # data structure: pocAPIKeyList[xID][i] = (xAPIKey, xPriority, xEventPrefix) - for i in range(len(pocAPIKeyList[xID])): - xEvent = event - (xAPIKey, xPriority, xEventPrefix) = pocAPIKeyList[xID][i] - if len(xEventPrefix) > 0: - xEvent = xEventPrefix + ": " + xEvent - response = nma.pushWithAPIKey(xAPIKey, application, xEvent, msg, priority=xPriority) - checkResponse(response, xAPIKey) - except KeyError: - # nothing found - pass - # 2. lets look for ric* in pocAPIKeyList - try: - xID = data['ric'] + "*" - # data structure: pocAPIKeyList[xID][i] = (xAPIKey, xPriority, xEventPrefix) - for i in range(len(pocAPIKeyList[xID])): - xEvent = event - (xAPIKey, xPriority, xEventPrefix) = pocAPIKeyList[xID][i] - if len(xEventPrefix) > 0: - xEvent = xEventPrefix + ": " + xEvent - response = nma.pushWithAPIKey(xAPIKey, application, xEvent, msg, priority=xPriority) - checkResponse(response, xAPIKey) - except KeyError: - # nothing found - pass - # 3. lets look for ric prefixes in pocAPIKeyList - for prefixLength in reversed(range(6)): - ricPrefix = data['ric'][:prefixLength] - #fill the ric with stars - ricPrefix = ricPrefix.ljust(8,'*') - try: - xID = ricPrefix - # data structure: pocAPIKeyList[xID][i] = (xAPIKey, xPriority, xEventPrefix) - for i in range(len(pocAPIKeyList[xID])): - xEvent = event - (xAPIKey, xPriority, xEventPrefix) = pocAPIKeyList[xID][i] - if len(xEventPrefix) > 0: - xEvent = xEventPrefix + ": " + xEvent - response = nma.pushWithAPIKey(xAPIKey, application, xEvent, msg, priority=xPriority) - checkResponse(response, xAPIKey) - except KeyError: - # nothing found - pass - - # end if "POC" in typ - # end if usecsv == True - except: - logging.error("%s to NMA failed", typ) - logging.debug("%s to NMA failed", typ, exc_info=True) - return - else: - logging.warning("Invalid Typ: %s", typ) - - except: - # something very mysterious - logging.error("unknown error") - logging.debug("unknown error", exc_info=True) From af9e01398ce26c899b1bcd24af043f80db15cc7b Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 5 Sep 2018 07:21:50 +0200 Subject: [PATCH 112/114] edit changelog --- .idea/BOSWatch.iml | 12 + .idea/inspectionProfiles/Project_Default.xml | 29 ++ .idea/misc.xml | 4 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + .idea/workspace.xml | 357 +++++++++++++++++++ CHANGELOG.md | 1 + 7 files changed, 417 insertions(+) create mode 100644 .idea/BOSWatch.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/BOSWatch.iml b/.idea/BOSWatch.iml new file mode 100644 index 0000000..e98082a --- /dev/null +++ b/.idea/BOSWatch.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..7feb4b2 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,29 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..65531ca --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..34a1ace --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..4591a05 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,357 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nam + nma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - 1515995451240 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file