From e3fcd9033d486f9ef9875e8cb4aa602f7c4b57bf Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 30 Mar 2017 21:37:22 +0200 Subject: [PATCH 001/131] 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 bd0cd55..6bb3835 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -10,7 +10,7 @@ Global variables # version info versionNr = "2.2-beta" -buildDate = "2016/02/23" +buildDate = "2017/03/30" # Global variables config = 0 From ac5db0dc9840f458f287f388bacf986b4f95977e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Mon, 18 Sep 2017 20:46:43 +0200 Subject: [PATCH 002/131] prepare for changelog --- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b3c8999 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,31 @@ +# Changelog + +### __[Unreleased]__ +#### Added +#### Changed +#### Deprecated +#### Removed +#### Fixed +#### Security + +### __[v2.2]__ +### __[v2.1]__ +### __[v2.0]__ + + +Zum schreiben des Changelog's siehe: +http://keepachangelog.com/de/1.0.0/ + +### Arten von Änderungen + +__Added__ für neue Features. + +__Changed__ für Änderungen an der bestehenden Funktionalität. + +__Deprecated__ für Features, die in zukünftigen Versionen entfernt werden. + +__Removed__ für Deprecated-Features, die in dieser Version entfernt wurden. + +__Fixed__ für alle Bug-Fixes. + +__Security__ um Benutzer im Fall von geschlossenen Sicherheitslücken zu einer Aktualisierung aufzufordern. From 53aa810df8607264d425fd1f62f43441cebdbc6e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Sep 2017 17:56:44 +0200 Subject: [PATCH 003/131] new release 2.2.1 --- CHANGELOG.md | 43 +++++++++++++++++++----------------------- includes/globalVars.py | 4 ++-- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3c8999..6d14a03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,31 +1,26 @@ # Changelog -### __[Unreleased]__ -#### Added -#### Changed -#### Deprecated -#### Removed -#### Fixed -#### Security -### __[v2.2]__ -### __[v2.1]__ -### __[v2.0]__ +#### __[v2.2.1]__ - 19.09.2017 +##### Added +- Neues Service Script +- Eigene Message fpr jeden Typ im Telegram Plugin + +##### Changed +- Name der csv Dateien um überschreiben bei Update zu vermeiden +- Description Liste kann nun zusätzlich Einträge für jede Subric enthalten +- RegEX verbietet nun grundsätzlich alles - Es muss explizit zugelassen werden + +##### Deprecated +##### Removed +##### Fixed +- Bug im SMS77 Plugin + +##### Security + + +---------------------------- Zum schreiben des Changelog's siehe: http://keepachangelog.com/de/1.0.0/ - -### Arten von Änderungen - -__Added__ für neue Features. - -__Changed__ für Änderungen an der bestehenden Funktionalität. - -__Deprecated__ für Features, die in zukünftigen Versionen entfernt werden. - -__Removed__ für Deprecated-Features, die in dieser Version entfernt wurden. - -__Fixed__ für alle Bug-Fixes. - -__Security__ um Benutzer im Fall von geschlossenen Sicherheitslücken zu einer Aktualisierung aufzufordern. diff --git a/includes/globalVars.py b/includes/globalVars.py index 2cdcfa7..9871af2 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,8 +9,8 @@ Global variables """ # version info -versionNr = "2.2-dev" -buildDate = "2017/03/30" +versionNr = "2.2.1" +buildDate = "2017/09/19" # Global variables config = 0 From 8a0c05f626db0603eb1c0dc3bca00f9fc70d583c Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Sep 2017 18:04:33 +0200 Subject: [PATCH 004/131] 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 e5391a2b75ea65df3c5fc0d473200f1ce176dbe4 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Sep 2017 18:05:26 +0200 Subject: [PATCH 005/131] edit vers nr --- CHANGELOG.md | 1 + includes/globalVars.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d14a03..5e7ee29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changelog +#### __[Unreleased]__ #### __[v2.2.1]__ - 19.09.2017 ##### Added diff --git a/includes/globalVars.py b/includes/globalVars.py index 0d6f2b3..513d231 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-dev" buildDate = "2017/09/19" From afa224a9aa1c8791b2f432d406fc65d0bf0c4a56 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Sep 2017 18:11:37 +0200 Subject: [PATCH 006/131] edit changelog --- CHANGELOG.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e7ee29..15a0976 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog #### __[Unreleased]__ +##### Added +##### Changed +##### Deprecated +##### Removed +##### Fixed +##### Security + #### __[v2.2.1]__ - 19.09.2017 ##### Added @@ -12,16 +19,20 @@ - Description Liste kann nun zusätzlich Einträge für jede Subric enthalten - RegEX verbietet nun grundsätzlich alles - Es muss explizit zugelassen werden -##### Deprecated -##### Removed ##### Fixed - Bug im SMS77 Plugin -##### Security - ---------------------------- Zum schreiben des Changelog's siehe: http://keepachangelog.com/de/1.0.0/ + +#### __[Unreleased]__ +##### Added +##### Changed +##### Deprecated +##### Removed +##### Fixed +##### Security From c698a9eb15346fe5305cf1855a293a7a8fd02c1b Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 19 Sep 2017 18:16:41 +0200 Subject: [PATCH 007/131] edit CL --- CHANGELOG.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15a0976..e997ab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -#### __[Unreleased]__ +### __[Unreleased]__ ##### Added ##### Changed ##### Deprecated @@ -9,18 +9,18 @@ ##### Security -#### __[v2.2.1]__ - 19.09.2017 +### __[v2.2.1]__ - 19.09.2017 ##### Added - Neues Service Script -- Eigene Message fpr jeden Typ im Telegram Plugin +- Eigene Message für jeden Typ im Telegram Plugin in der config definierbar ##### Changed -- Name der csv Dateien um überschreiben bei Update zu vermeiden -- Description Liste kann nun zusätzlich Einträge für jede Subric enthalten -- RegEX verbietet nun grundsätzlich alles - Es muss explizit zugelassen werden +- Name der csv Dateien geändert um überschreiben bei Update zu vermeiden +- Description Liste kann nun zusätzlich Einträge für jede Subric enthalten (POCSAG) +- RegEX verbietet nun grundsätzlich alles - Es muss explizit zugelassen werden (wenn RegEX aktiv) ##### Fixed -- Bug im SMS77 Plugin +- Bug im SMS77 Plugin behoben ---------------------------- @@ -29,7 +29,7 @@ Zum schreiben des Changelog's siehe: http://keepachangelog.com/de/1.0.0/ -#### __[Unreleased]__ +### __[Unreleased]__ ##### Added ##### Changed ##### Deprecated From f31532d79a5f1e146751b2df25700382aa3373b3 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 19 Sep 2017 20:49:36 +0200 Subject: [PATCH 008/131] 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 009/131] 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 010/131] 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 011/131] 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 012/131] 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 013/131] 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 014/131] 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 015/131] 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 016/131] 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 017/131] 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 018/131] 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 019/131] 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 020/131] 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 021/131] 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 022/131] 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 023/131] 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 024/131] 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 8beb46f55a01311ced032b35ec60b48e40bfa6a6 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 20 Sep 2017 21:27:08 +0200 Subject: [PATCH 025/131] edit readme wiki doubles deleted --- README.md | 72 ++++++++++--------------------------------------------- 1 file changed, 12 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index ac3d336..eb8e805 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ In der Zukunft wollen wir die Möglichkeit schaffen, codierte Nachrichten zu ent :satellite: Python Script to receive and decode German BOS Information with rtl_fm and multimon-NG :satellite: +#### WICHTIG +**Es wird darauf hingewiesen, dass für die Teilnahme am BOS-Funk nur nach den Technischen Richtlinien der BOS zugelassene Funkanlagen verwendet werden dürfen.** +**Der BOS-Funk ist ein nichtöffentlicher mobiler Landfunk. Privatpersonen gehören nicht zum Kreis der berechtigten Funkteilnehmer.** _(Quelle: TR-BOS)_ + #### Notice: The intercept of the German BOS radio is **strictly prohibited** and will be prosecuted. the use is **only authorized** personnel permitted. The software was developed using the Multimon-NG code, a function in the real operation can not be guaranteed. @@ -23,10 +27,13 @@ The software was developed using the Multimon-NG code, a function in the real op **Please** only use Code from **master**-Branch - thats **the only stable!** +beta-branch is for beta-test of new features + unless you are developer you can use the develop-Branch - may be unstable! ### Features ##### Implemented features: +**list is not complete!** - FMS, ZVEI and POCSAG512/1200/2400 decoding and displaying - Plugin support for easy functional extension - Filtering double alarms with adjustable time and check width @@ -41,30 +48,12 @@ unless you are developer you can use the develop-Branch - may be unstable! - possibility to start plugins asynchron - NMA Error Handler -##### Features for the future: -- more plugins -- other Ideas per Issues please - ### Plugins If you want to code your own Plugin, see `plugins/README.md`. ##### Implemented plugins: - -|Plugin|Function|FMS|ZVEI|POC| -|-----|---------|:-:|:--:|:-:| -|MySQL|insert data into MySQL database|:white_check_mark:|:white_check_mark:|:white_check_mark:| -|httpRequest|send a request with parameter to an URL|:white_check_mark:|:white_check_mark:|:white_check_mark:| -|eMail|send Mails with own text|:white_check_mark:|:white_check_mark:|:white_check_mark:| -|BosMon|send data to BosMon server|:white_check_mark:|:white_check_mark:|:white_check_mark:| -|firEmergency|send data to firEmergency server|:x:|:white_check_mark:|:white_check_mark:| -|jsonSocket|send data as jsonString to a socket server|:white_check_mark:|:white_check_mark:|:white_check_mark:| -|NMA|send data to Notify my Android|:white_check_mark:|:white_check_mark:|:white_check_mark:| - -- for more Information to the plugins see `config.ini` - -##### Plugins for the Future: -- Ideas per Issues please +please look at the wiki page ### Configuration @@ -105,52 +94,15 @@ Take a look into the parser.php for the parsing functions~~ ### Usage -`sudo python boswatch.py -f 85.235M -a FMS ZVEI` -Starts boswatch at frequency 85.235 MHz with the demodulation functions FMS and ZVEI. -Parameter -f/--freq and -a/--demod are required! - -Help to all usable parameters with `sudo python boswatch.py -h` - -``` -usage: boswatch.py [-h] -f FREQ [-d DEVICE] [-e ERROR] -a - {FMS,ZVEI,POC512,POC1200,POC2400} - [{FMS,ZVEI,POC512,POC1200,POC2400} ...] [-s SQUELCH] [-v] - -optional arguments: - -h, --help show this help message and exit - -f FREQ, --freq FREQ Frequency you want to listen - -d DEVICE, --device DEVICE Device you want to use (Check with rtl_test) - -e ERROR, --error ERROR Frequency-Error of your device in PPM - -a {FMS,ZVEI,POC512,POC1200,POC2400} [{FMS,ZVEI,POC512,POC1200,POC2400} ...], - --demod {FMS,ZVEI,POC512,POC1200,POC2400} [{FMS,ZVEI,POC512,POC1200,POC2400} ...] - Demodulation functions - -s SQUELCH, --squelch SQUELCH level of squelch - -u, --usevarlog Use '/var/log/boswatch' for logfiles instead of subdir 'log' in BOSWatch directory - -v, --verbose Shows more information - -q, --quiet Shows no information. Only logfiles -``` - +please look at the wiki page ### Installation -Please follow the instructions written down in the wiki: - -https://github.com/Schrolli91/BOSWatch/wiki - -You just need to download a single file since the installer manages the whole process except the installation of a webserver and a database. +please look at the wiki page If you want to use BOSWatch as a daemon, you have to set your configuration in `service/boswatch.sh` and copy it to `/etc/init.d`. Then you can start BOSWatch with `sudo /etc/init.d/boswatch.sh start`. For configuration-details see `service/README.md`. -### Requirements -- RTL_SDR (rtl_fm) -- Multimon-NG -- Python Support -- MySQL Connector for Python (for MySQL-plugin) - -Thanks to smith_fms and McBo from Funkmeldesystem.de - Forum for Inspiration and Groundwork! - - -### Code your own Plugin -See `plugins/README.md` +##### Big thanks +to smith_fms and McBo from Funkmeldesystem.de - Forum for Inspiration and Groundwork! From ae03473f940caa9455a5d4ba40b0f80b363d148e Mon Sep 17 00:00:00 2001 From: f-kessler Date: Thu, 21 Sep 2017 12:09:17 +0200 Subject: [PATCH 026/131] 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 2f3817c64fc738f4aa3d6d3a8f5a91e7779e6001 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 21 Sep 2017 13:16:42 +0200 Subject: [PATCH 027/131] Update CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e997ab7..e6c0eae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -### __[Unreleased]__ +### __[v2.2.3]__ - unreleased ##### Added ##### Changed ##### Deprecated @@ -29,7 +29,7 @@ Zum schreiben des Changelog's siehe: http://keepachangelog.com/de/1.0.0/ -### __[Unreleased]__ +### __[version]__ - date ##### Added ##### Changed ##### Deprecated From 167c0b90f308ad468bfdfe91f965c23ccbce0e74 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 22 Sep 2017 06:33:29 +0200 Subject: [PATCH 028/131] wildcard params harmonized in config --- config/config.template.ini | 157 +++++++++++++------------------------ 1 file changed, 53 insertions(+), 104 deletions(-) diff --git a/config/config.template.ini b/config/config.template.ini index d943faf..d1a21e1 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -171,36 +171,18 @@ tableSIG = bos_signal # multiple URLs can be separated by comma -# you can use the following wildcards in your URL as GET params: +# you can use the 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) +#Wildcards can be used, see end of the file! #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) +#Wildcards can be used, see end of the file! #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) +#Wildcards can be used, see end of the file! #poc_url = http://www.google.de?ric=%RIC%&subric=%FUNC%&msg=%MSG% poc_url = @@ -225,42 +207,15 @@ to = user@irgendwo, user2@woanders # 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% = ) +#Wildcards can be used, see end of the file! 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% = ) +#Wildcards can be used, see end of the file! 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% = ) +#Wildcards can be used, see end of the file! poc_subject = Alarm: %RIC%%LPAR%%FUNCCHAR%%RPAR% poc_message = %DATE% %TIME% - %DESCR%: %MSG% @@ -415,36 +370,13 @@ RICforLocationAPIKey = # 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% = ) +#Wildcards can be used, see end of the file! 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% = ) +#Wildcards can be used, see end of the file! 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% = ) +#Wildcards can be used, see end of the file! POC_message = %MSG% @@ -456,36 +388,13 @@ 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% = ) +#Wildcards can be used, see end of the file! 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% = ) +#Wildcards can be used, see end of the file! 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% = ) +#Wildcards can be used, see end of the file! poc_message = %MSG% @@ -496,3 +405,43 @@ poc_message = %MSG% [template] test1 = testString test2 = 123456 + + +##################### +##### WILDCARDS ##### +##################### + +##### FMS +# %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% = ) + +##### ZVEI +# %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% = ) + +##### POCSAG +# %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) +# %BR% = Insert line wrap (only in message) +# %LPAR% = ( +# %RPAR% = ) From 2d8d5e42d9ff2e756726a5d8b6389f250622db93 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 22 Sep 2017 16:09:29 +0200 Subject: [PATCH 029/131] edit config file little changes an a new header --- config/config.template.ini | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/config/config.template.ini b/config/config.template.ini index d1a21e1..7a959f2 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -1,6 +1,17 @@ -######################## -# BOSWatch Config File # -######################## + +# ____ ____ ______ __ __ __ +# / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ +# / __ / / / /\__ \| | /| / / __ / __/ ___/ __ \ +# / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / +# /_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ +# German BOS Information Script +# configuration file +# +# The intercept of the German BOS radio is strictly +# prohibited and will be prosecuted. +# The use is only authorized personnel permitted! +# + [BOSWatch] # set loglevel for logfile @@ -31,6 +42,7 @@ processAlarmAsync = 0 # Using RegEx-filter (0 - off | 1 - on) # filter-configuration in section [Filters] +# if you are using the RegEx filter you must add filter rules to forward alarms useRegExFilter = 0 # for double check save the last n IDs @@ -51,6 +63,7 @@ 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 @@ -79,12 +92,14 @@ idDescribed = 0 # 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 ",") @@ -114,16 +129,17 @@ ricd = Unwetter # Usually sent periodically, separated by comma netIdent_ric = 0174760, 1398098 + [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 +# If RegEX is enabled - only alloewd data will 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) +# 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 +# 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} @@ -148,7 +164,7 @@ Pushover = 0 Telegram = 0 yowsup = 0 -# for developing template-module +# for developing - template-module template = 0 From 0fc12abf44a2e51ef5e50c1c67c707c5f065c3e5 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Sat, 23 Sep 2017 09:23:49 +0200 Subject: [PATCH 030/131] 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 031/131] 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 032/131] 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 033/131] 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 034/131] 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 035/131] 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 036/131] 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 037/131] 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 038/131] 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 45f4887163c65d2cc187dc78dea093f1983a8e54 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 29 Sep 2017 13:26:06 +0200 Subject: [PATCH 039/131] edit changelog with links --- CHANGELOG.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6c0eae..4439a17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,16 +11,18 @@ ### __[v2.2.1]__ - 19.09.2017 ##### Added -- Neues Service Script -- Eigene Message für jeden Typ im Telegram Plugin in der config definierbar +- Neues Service Script [#263](https://github.com/Schrolli91/BOSWatch/pull/263) +- Eigene Message für jeden Typ im Telegram Plugin in der config definierbar [#267](https://github.com/Schrolli91/BOSWatch/pull/267) +- httpRequest Plugin unterstützt nun mehrere URLs [254](https://github.com/Schrolli91/BOSWatch/pull/254) ##### Changed -- Name der csv Dateien geändert um überschreiben bei Update zu vermeiden -- Description Liste kann nun zusätzlich Einträge für jede Subric enthalten (POCSAG) -- RegEX verbietet nun grundsätzlich alles - Es muss explizit zugelassen werden (wenn RegEX aktiv) +- Name der csv Dateien geändert um überschreiben bei Update zu vermeiden [#262](https://github.com/Schrolli91/BOSWatch/pull/262) +- Description Liste kann nun zusätzlich Einträge für jede Subric enthalten (POCSAG) [#271](https://github.com/Schrolli91/BOSWatch/pull/271) +- RegEX verbietet nun grundsätzlich alles - Es muss explizit zugelassen werden (wenn RegEX aktiv) [#284](https://github.com/Schrolli91/BOSWatch/pull/284) ##### Fixed -- Bug im SMS77 Plugin behoben +- Bug im SMS77 Plugin behoben [#257](https://github.com/Schrolli91/BOSWatch/issues/257) +- einige Code-Style Verbesserungen ---------------------------- From 3aa0b382e9e8866d749d3f4861f5ed79c64ee772 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 29 Sep 2017 13:33:21 +0200 Subject: [PATCH 040/131] 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 0774a581939a1786bc92bd4744fa08565f2fab96 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 30 Sep 2017 15:56:10 +0200 Subject: [PATCH 041/131] rename systemcl to systemctl http://boswatch.de/index.php?thread/4-version-2-2-1/&postID=31#post31 --- service/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/README.md b/service/README.md index 41337a9..58ad6f9 100644 --- a/service/README.md +++ b/service/README.md @@ -10,8 +10,8 @@ Enter the frequency and the decoder(s) you want to use in line 7; you can add mo ### Install the service 1. Copy the file to /lib/systemd/system: sudo cp /opt/boswatch/service/boswatch.service /lib/systemd/system/ 2. Change the rights: sudo chmod 644 /lib/systemd/system/boswatch.service -3. Enable the service: sudo systemcl enable boswatch.service -4. Start the service: sudo systemcl start boswatch.service +3. Enable the service: sudo systemctl enable boswatch.service +4. Start the service: sudo systemctl start boswatch.service --- From 760f6c1abaa80a7398658d2ea7a2f21a79bbab2e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 30 Sep 2017 16:05:23 +0200 Subject: [PATCH 042/131] Update globalVars.py --- includes/globalVars.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/globalVars.py b/includes/globalVars.py index 513d231..c081608 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,8 +9,8 @@ Global variables """ # version info -versionNr = "2.2.1-dev" -buildDate = "2017/09/19" +versionNr = "2.2.2-dev" +buildDate = "in dev" # Global variables From b2df53430d93cd56d261b7d73557680a0d32e492 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 30 Sep 2017 16:07:32 +0200 Subject: [PATCH 043/131] edit CL --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4439a17..609abc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,12 @@ # Changelog -### __[v2.2.3]__ - unreleased +### __[v2.2.2]__ - unreleased ##### Added ##### Changed ##### Deprecated ##### Removed ##### Fixed +- Schreibfehler in Service Readme [#313](https://github.com/Schrolli91/BOSWatch/issues/313) ##### Security From d4946bf714e4053f33209c0fd68287f4b01f6400 Mon Sep 17 00:00:00 2001 From: PeterLaemmle Date: Sat, 30 Sep 2017 18:11:20 +0200 Subject: [PATCH 044/131] Update Telegram.py Import libraries urllib and googlemaps only if RICforLocationAPIKey is defined. --- plugins/Telegram/Telegram.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/Telegram/Telegram.py b/plugins/Telegram/Telegram.py index fc4acc7..dc4cc6e 100644 --- a/plugins/Telegram/Telegram.py +++ b/plugins/Telegram/Telegram.py @@ -11,9 +11,11 @@ Plugin to send FMS-, ZVEI- and POCSAG-messages via Telegram # Imports # import logging # Global logger -import urllib, telegram, googlemaps +import telegram from telegram.error import (TelegramError, Unauthorized, BadRequest, NetworkError) from includes import globalVars # Global variables +if globalVars.config.get("Telegram","RICforLocationAPIKey"): + import urllib, googlemaps # Helper function, uncomment to use from includes.helper import wildcardHandler From 47bdff4b28292a6c0ff3009cc3fbab195037d59f Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 30 Sep 2017 18:27:11 +0200 Subject: [PATCH 045/131] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 609abc4..15ca61e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### __[v2.2.2]__ - unreleased ##### Added ##### Changed +- Telegram Plugin importiert Google Maps Funktionen nur noch wenn API Key eingetragen ist [#315](https://github.com/Schrolli91/BOSWatch/pull/315) ##### Deprecated ##### Removed ##### Fixed From 9d552e5d244c0a19b0987a6a08be5214f1fd3a09 Mon Sep 17 00:00:00 2001 From: Florian Date: Sat, 30 Sep 2017 22:51:42 +0200 Subject: [PATCH 046/131] Add explanation Add description on how to use subric-specific description (according to #271 and #312) --- csv/poc.template.csv | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/csv/poc.template.csv b/csv/poc.template.csv index 87a5073..9dfe7d4 100644 --- a/csv/poc.template.csv +++ b/csv/poc.template.csv @@ -5,6 +5,12 @@ ric,description # For each RIC-Address you could set a description-text # Use the structure: ric,"Description-Text" # +# You can even define specific subrics, therefore you +# 1. need to specify a main RIC: 1234567, "Unit One" +# 2. specify a certain subric: 1234567B, "Subunit Bravo" +# The result for 1234567B will be "Unit One Subunit Bravo" +# - Be sure having defined the main RIC (step one)! - +# # !!! DO NOT delete the first line !!! # 1234567,"POCSAG testdata äöüß" From c54bd558888bebd2189ca05809c085453091faa1 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sun, 1 Oct 2017 18:06:56 +0200 Subject: [PATCH 047/131] 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 acbef6591c6032617792d5b71f8a1824f1d3342b Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Mon, 2 Oct 2017 07:25:22 +0200 Subject: [PATCH 048/131] edits for codacy (#310) --- CHANGELOG.md | 1 + includes/helper/stringConverter.py | 1 - includes/pynma/pynma.py | 14 ++++----- install.sh | 4 +-- plugins/MySQL/MySQL.py | 32 ++++++++++---------- plugins/Sms77/Sms77.py | 2 +- plugins/httpRequest/httpRequest.py | 4 +-- plugins/notifyMyAndroid/notifyMyAndroid.py | 34 +++++++++++----------- 8 files changed, 46 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ca61e..5777b2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ##### Removed ##### Fixed - 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 diff --git a/includes/helper/stringConverter.py b/includes/helper/stringConverter.py index 01ada06..acd9a26 100644 --- a/includes/helper/stringConverter.py +++ b/includes/helper/stringConverter.py @@ -159,7 +159,6 @@ def convertToUTF8(inputString = ""): raise # End of exception UnicodeDecodeError: check given string is already UTF-8 - pass except: logging.warning("error checking given string") diff --git a/includes/pynma/pynma.py b/includes/pynma/pynma.py index 08a71cb..5649f05 100644 --- a/includes/pynma/pynma.py +++ b/includes/pynma/pynma.py @@ -3,14 +3,14 @@ from xml.dom.minidom import parseString try: - from http.client import HTTPSConnection + from http.client import HTTPSConnection except ImportError: - from httplib import HTTPSConnection + from httplib import HTTPSConnection try: - from urllib.parse import urlencode + from urllib.parse import urlencode except ImportError: - from urllib import urlencode + from urllib import urlencode __version__ = "1.0" @@ -55,10 +55,10 @@ takes 2 optional arguments: def delkey(self, key): "Removes a key (unregister ?)" - if type(key) == str: + if isinstance(key, str): if key in self._apikey: self._apikey.remove(key) - elif type(key) == list: + elif isinstance(key, list): for k in key: if key in self._apikey: self._apikey.remove(k) @@ -71,7 +71,7 @@ takes 2 optional arguments: def pushWithAPIKey(self, apikey=[], application="", event="", description="", url="", contenttype=None, priority=0, batch_mode=False, html=False): """Special Funktion""" if apikey: - if type(apikey) == str: + if isinstance(apikey, str): apikey = [apikey] self._apikey = uniq(apikey) return self.push(application, event, description, url, contenttype, priority, batch_mode, html) diff --git a/install.sh b/install.sh index 5c251ea..4b549a8 100644 --- a/install.sh +++ b/install.sh @@ -51,7 +51,7 @@ didBackup=false if [ -f $boswatchpath/BOSWatch/boswatch.py ]; then echo "Old installation found!" echo "A backup will be copied to $boswatchpath/old" - + mkdir /tmp/boswatch mv $boswatchpath/BOSWatch/* /tmp/boswatch/ didBackup=true @@ -61,7 +61,7 @@ fi if [ -f $boswatchpath/boswatch.py ]; then echo "Old installation found!" echo "A backup will be copied to $boswatchpath/old" - + mkdir /tmp/boswatch mv $boswatchpath/* /tmp/boswatch/ didBackup=true diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index 5941571..e9d3d7e 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 ## @@ -87,7 +87,7 @@ def run(typ,freq,data): if configHandler.checkConfig("MySQL"): #read and debug the config try: - # + # # Connect to MySQL # logging.debug("connect to MySQL") diff --git a/plugins/Sms77/Sms77.py b/plugins/Sms77/Sms77.py index e4353d1..6d30a1a 100644 --- a/plugins/Sms77/Sms77.py +++ b/plugins/Sms77/Sms77.py @@ -58,7 +58,7 @@ def run(typ,freq,data): """ try: if configHandler.checkConfig("Sms77"): #read and debug the config - + # create an empty message an fill it with the required information message = "Alarm" if typ == "FMS": diff --git a/plugins/httpRequest/httpRequest.py b/plugins/httpRequest/httpRequest.py index 744f621..56e35a6 100644 --- a/plugins/httpRequest/httpRequest.py +++ b/plugins/httpRequest/httpRequest.py @@ -71,8 +71,8 @@ def run(typ,freq,data): # Replace special characters in data Strings for URL # for key in data: - if isinstance(data[key], basestring): - data[key] = urllib.quote(data[key]) + if isinstance(data[key], basestring): + data[key] = urllib.quote(data[key]) # # Get URLs # diff --git a/plugins/notifyMyAndroid/notifyMyAndroid.py b/plugins/notifyMyAndroid/notifyMyAndroid.py index 7fa535f..a8ab127 100644 --- a/plugins/notifyMyAndroid/notifyMyAndroid.py +++ b/plugins/notifyMyAndroid/notifyMyAndroid.py @@ -268,23 +268,23 @@ def run(typ,freq,data): # 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 + 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 From b6077d522d02e094c2820e8a47f9fa6e864134b3 Mon Sep 17 00:00:00 2001 From: f-kessler Date: Mon, 2 Oct 2017 15:32:01 +0200 Subject: [PATCH 049/131] 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 625d6b643e7292aab8c547bffaf90234c3d5ec7c Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 2 Oct 2017 23:27:12 +0200 Subject: [PATCH 050/131] Update README.md Fixing description on how to install the service --- service/README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/service/README.md b/service/README.md index 58ad6f9..805ef88 100644 --- a/service/README.md +++ b/service/README.md @@ -8,10 +8,14 @@ We assume that BOSWatch is installed to /opt/boswatch! Otherwise you need to ada Enter the frequency and the decoder(s) you want to use in line 7; you can add more specific switches if you need to ### Install the service -1. Copy the file to /lib/systemd/system: sudo cp /opt/boswatch/service/boswatch.service /lib/systemd/system/ -2. Change the rights: sudo chmod 644 /lib/systemd/system/boswatch.service -3. Enable the service: sudo systemctl enable boswatch.service -4. Start the service: sudo systemctl start boswatch.service +1. Use the install-script install_service.sh as sudo: `sudo bash install_service.sh` (self explaining) + +OR + +1. Copy the file to /etc/systemd/system: sudo cp /opt/boswatch/service/boswatch.service /etc/systemd/system/ +2. Enable the service: sudo systemctl enable boswatch.service +3. Start the service: sudo systemctl start boswatch.service +4. Check the status: sudo systemctl status boswatch.service --- From d248a7d45dce3c4042a29b0fcaa04eed3ebe85e1 Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 2 Oct 2017 23:41:57 +0200 Subject: [PATCH 051/131] Installscript for service A tiny to script to install and register the service automatically There is also a possibility to remove the service --- service/install_service.sh | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 service/install_service.sh diff --git a/service/install_service.sh b/service/install_service.sh new file mode 100644 index 0000000..d973b5a --- /dev/null +++ b/service/install_service.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Tiny script to install BOSWatch-service to use it via systemctl +# Just a few simple steps are required to (un)register your service + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root!" 1>&2 + exit 1 +fi + +read -p"Do you want to install (i) or remove (r) the service? " action + +if [ "$action" == "i" ]; then + + # 1 Check whether the right data are in the service-file + + read -p"Did you adapt the file boswatch.service (y/n)? " response + + if [ "$response" == "y" ]; then + # 2 Copy the file + cp boswatch.service /etc/systemd/system + + # 3 Enable the service and check status + systemctl enable boswatch.service + systemctl is-enabled boswatch.service + + # 4 fire it up + systemctl start boswatch.service + + # 5 post the status + systemctl status boswatch.service + else + echo "Please adapt your personal boswatch.service-file" + exit 1 + fi +else # we want to remove the service + # stop it... + systemctl stop boswatch.service + + # disable it + systemctl disable boswatch.service + + # and remove it + rm /etc/systemd/system/boswatch.service +fi From eacb72adeadfa24a6836c83c9f552e9516145e9f Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 08:50:11 +0200 Subject: [PATCH 052/131] edit CL --- CHANGELOG.md | 1 + service/install_service.sh | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5777b2f..621b231 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### __[v2.2.2]__ - unreleased ##### 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) ##### Deprecated diff --git a/service/install_service.sh b/service/install_service.sh index d973b5a..1ec6c7e 100644 --- a/service/install_service.sh +++ b/service/install_service.sh @@ -13,9 +13,9 @@ read -p"Do you want to install (i) or remove (r) the service? " action if [ "$action" == "i" ]; then # 1 Check whether the right data are in the service-file - + read -p"Did you adapt the file boswatch.service (y/n)? " response - + if [ "$response" == "y" ]; then # 2 Copy the file cp boswatch.service /etc/systemd/system @@ -36,7 +36,7 @@ if [ "$action" == "i" ]; then else # we want to remove the service # stop it... systemctl stop boswatch.service - + # disable it systemctl disable boswatch.service From 166dd3e3f8dd7ee0c050ca48d661edbca3707a3c Mon Sep 17 00:00:00 2001 From: f-kessler Date: Tue, 3 Oct 2017 11:38:24 +0200 Subject: [PATCH 053/131] 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 054/131] 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 055/131] 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 056/131] 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 057/131] 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 058/131] 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 059/131] 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 060/131] 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 061/131] 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 3fed1ac12af8690213766e0e81d71c237530ed2c Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 16:00:31 +0200 Subject: [PATCH 062/131] decouple vers nr and branch name --- boswatch.py | 1 + includes/globalVars.py | 5 +++-- includes/shellHeader.py | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/boswatch.py b/boswatch.py index e8b7b3a..f21937b 100755 --- a/boswatch.py +++ b/boswatch.py @@ -162,6 +162,7 @@ try: # try: logging.debug("SW Version: %s",globalVars.versionNr) + logging.debug("Branch: %s",globalVars.branch) logging.debug("Build Date: %s",globalVars.buildDate) logging.debug("BOSWatch given arguments") if args.test: diff --git a/includes/globalVars.py b/includes/globalVars.py index c081608..be4305d 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,8 +9,9 @@ Global variables """ # version info -versionNr = "2.2.2-dev" -buildDate = "in dev" +versionNr = "2.2.2" +branch = "dev" +buildDate = "unreleased" # Global variables diff --git a/includes/shellHeader.py b/includes/shellHeader.py index 561603a..ab82eae 100644 --- a/includes/shellHeader.py +++ b/includes/shellHeader.py @@ -31,6 +31,7 @@ def printHeader(args): print " by Bastian Schroll, Jens Herrmann " print "" print "SW Version: "+globalVars.versionNr + print "Branch: "+globalVars.branch print "Build Date: "+globalVars.buildDate print "" From e503130a03e4a9b30abea05eb1ed825b24d101a8 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 16:03:27 +0200 Subject: [PATCH 063/131] edit CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5777b2f..4648a8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ##### Added ##### 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 ##### Fixed From e86059a2f3d98847379febd2daafe7c7c4023843 Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 3 Oct 2017 17:08:22 +0200 Subject: [PATCH 064/131] Update install_service.sh Adding errorhandling due to wrong input characters --- service/install_service.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/service/install_service.sh b/service/install_service.sh index 1ec6c7e..2789a35 100644 --- a/service/install_service.sh +++ b/service/install_service.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Tiny script to install BOSWatch-service to use it via systemctl +# Tiny script to install BOSWatch-service via systemctl # Just a few simple steps are required to (un)register your service if [[ $EUID -ne 0 ]]; then @@ -13,9 +13,9 @@ read -p"Do you want to install (i) or remove (r) the service? " action if [ "$action" == "i" ]; then # 1 Check whether the right data are in the service-file - + read -p"Did you adapt the file boswatch.service (y/n)? " response - + if [ "$response" == "y" ]; then # 2 Copy the file cp boswatch.service /etc/systemd/system @@ -29,17 +29,23 @@ if [ "$action" == "i" ]; then # 5 post the status systemctl status boswatch.service - else + elif [ "$response" == "n" ]; then echo "Please adapt your personal boswatch.service-file" exit 1 + else + echo "Invalid input - please try again" + exit 1 fi -else # we want to remove the service +elif [ "$action" == "r" ]; then # we want to remove the service # stop it... systemctl stop boswatch.service - + # disable it systemctl disable boswatch.service # and remove it rm /etc/systemd/system/boswatch.service +else # error handling + echo "Invalid input - please try again" + exit 1 fi From cb0fd5371367475df9de145296391ae88e3c2b41 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 18:26:16 +0200 Subject: [PATCH 065/131] 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 066/131] 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 067/131] 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 068/131] 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 069/131] 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 070/131] 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 071/131] 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 7fa4a97ba42663fc6c329d7f092f9b64275fd612 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 20:23:48 +0200 Subject: [PATCH 072/131] edit CL --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3f07e2..d317f04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -### __[v2.2.2]__ - unreleased +### __[v2.3]__ - unreleased ##### Added - Installations Script für Services [#316](https://github.com/Schrolli91/BOSWatch/pull/316) ##### Changed From 578750a810bc1ebcb13bf9a0defb7ccfda7fa02d Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 22:08:38 +0200 Subject: [PATCH 073/131] 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 594ddb44529f87e2c04aef8775397db1addd96c0 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 3 Oct 2017 22:26:05 +0200 Subject: [PATCH 074/131] add config debug prints --- boswatch.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boswatch.py b/boswatch.py index f21937b..08f8403 100755 --- a/boswatch.py +++ b/boswatch.py @@ -221,6 +221,10 @@ try: configHandler.checkConfig("FMS") configHandler.checkConfig("ZVEI") configHandler.checkConfig("POC") + configHandler.checkConfig("Plugins") + configHandler.checkConfig("Filters") + if globalVar.config.getint("NMAHandler","enableHandler"): + configHandler.checkConfig("NMAHandler") except: # we couldn't work without config -> exit logging.critical("cannot read config file") From cc66f4547ac1737200b11ba8283586818f291095 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 4 Oct 2017 06:16:37 +0200 Subject: [PATCH 075/131] print python vers nr in log --- boswatch.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/boswatch.py b/boswatch.py index 08f8403..46f864f 100755 --- a/boswatch.py +++ b/boswatch.py @@ -18,11 +18,12 @@ GitHUB: https://github.com/Schrolli91/BOSWatch import logging import logging.handlers -import argparse # for parse the args -import ConfigParser # for parse the config file -import os # for log mkdir -import time # for time.sleep() -import subprocess # for starting rtl_fm and multimon-ng +import argparse # for parse the args +import ConfigParser # for parse the config file +import os # for log mkdir +import sys # for py version +import time # for time.sleep() +import subprocess # for starting rtl_fm and multimon-ng from includes import globalVars # Global variables from includes import MyTimedRotatingFileHandler # extension of TimedRotatingFileHandler @@ -164,6 +165,7 @@ try: logging.debug("SW Version: %s",globalVars.versionNr) logging.debug("Branch: %s",globalVars.branch) logging.debug("Build Date: %s",globalVars.buildDate) + logging.debug("Python Vers: %s",sys.version) logging.debug("BOSWatch given arguments") if args.test: logging.debug(" - Test-Mode!") From 33706e5f2d0f644ee3d5db2e610c95cdb4bfd1a2 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 4 Oct 2017 06:30:53 +0200 Subject: [PATCH 076/131] little fix --- boswatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boswatch.py b/boswatch.py index 46f864f..ff2cb74 100755 --- a/boswatch.py +++ b/boswatch.py @@ -225,7 +225,7 @@ try: configHandler.checkConfig("POC") configHandler.checkConfig("Plugins") configHandler.checkConfig("Filters") - if globalVar.config.getint("NMAHandler","enableHandler"): + if globalVars.config.getint("NMAHandler","enableHandler"): configHandler.checkConfig("NMAHandler") except: # we couldn't work without config -> exit From 37829740949168f501910d3d3518c0701bbd13c2 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 4 Oct 2017 06:43:44 +0200 Subject: [PATCH 077/131] edit log output --- boswatch.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/boswatch.py b/boswatch.py index ff2cb74..df1e5e6 100755 --- a/boswatch.py +++ b/boswatch.py @@ -225,8 +225,7 @@ try: configHandler.checkConfig("POC") configHandler.checkConfig("Plugins") configHandler.checkConfig("Filters") - if globalVars.config.getint("NMAHandler","enableHandler"): - configHandler.checkConfig("NMAHandler") + #NMAHandler is outputed below except: # we couldn't work without config -> exit logging.critical("cannot read config file") From 18425e2be22db01f388343fa84b913e7bb21ecbf Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 4 Oct 2017 08:54:23 +0200 Subject: [PATCH 078/131] Update install.sh Clean up old statements Fix a few typos (#318) --- install.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 4b549a8..38a4530 100644 --- a/install.sh +++ b/install.sh @@ -12,7 +12,7 @@ function exitcodefunction { echo "Action: $action on $module failed." echo "Exitcode: $errorcode" echo "" - echo " -> If you want to open an Issue at https://github.com/Schrolli91/BOSWatch/issues" + echo " -> If you want to open an issue at https://github.com/Schrolli91/BOSWatch/issues" echo " please post the logfile, located at $boswatchpath/install/setup_log.txt" exit 1 else @@ -82,7 +82,7 @@ for (( i=1; i<=$#; i=$i+2 )); do *) branch=master ;; esac ;; - -p|--path) echo " !!! WARNING: you install BOSWATCH to alternative path !!! "; boswatchpath=$arg2 ;; + -p|--path) echo " !!! WARNING: you'll install BOSWATCH to alternative path !!! "; boswatchpath=$arg2 ;; *) echo "Internal error!" ; exit 1 ;; esac @@ -205,15 +205,14 @@ tput cup 15 5 echo "-> configure..........................." cd $boswatchpath/ chmod +x * -echo $'# BOSWatch - blacklist the DVB drivers to avoid conflict with the SDR driver\n blacklist dvb_usb_rtl28xxu \n blacklist rtl2830\n blacklist dvb_usb_v2\n blacklist dvb_core' >> /etc/modprobe.d/boswatch_blacklist_sdr.conf +echo $'# BOSWatch - blacklist the DVB drivers to avoid conflicts with the SDR driver\n blacklist dvb_usb_rtl28xxu \n blacklist rtl2830\n blacklist dvb_usb_v2\n blacklist dvb_core' >> /etc/modprobe.d/boswatch_blacklist_sdr.conf tput cup 17 1 echo "BOSWatch is now installed in $boswatchpath/" 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 "Watch out: to run BOSWatch you have to modify the config.ini!" +echo "Do the following step to do so:" echo "sudo nano $boswatchpath/BOSWatch/config/config.ini" echo "and modify the config as you need. This step is optional if you are upgrading an old version of BOSWatch. " From bcdac6e2e65f35b220a3e7df4ae07337a94e75ce Mon Sep 17 00:00:00 2001 From: f-kessler Date: Thu, 5 Oct 2017 21:09:24 +0200 Subject: [PATCH 079/131] 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 080/131] 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 081/131] 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 082/131] 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 083/131] 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 084/131] 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 085/131] 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 086/131] 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 087/131] 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 088/131] 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 089/131] 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 090/131] 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 091/131] 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 092/131] 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 093/131] 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 094/131] 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 095/131] 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 096/131] 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 097/131] 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 098/131] 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 099/131] 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 100/131] 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 101/131] 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 102/131] 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 103/131] 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 104/131] 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 105/131] 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 106/131] 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 107/131] 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 108/131] 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 109/131] 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 110/131] 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 111/131] 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 112/131] 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 113/131] 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 114/131] 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 115/131] 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 116/131] 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 117/131] 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 118/131] 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 119/131] 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 120/131] 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 121/131] 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 122/131] 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 123/131] 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 124/131] 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 125/131] 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 126/131] 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 127/131] 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 128/131] 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 129/131] 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 130/131] 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 131/131] =?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