Skip to content

Commit

Permalink
Changed how openwb.conf is assigned to variables to prevent code inje…
Browse files Browse the repository at this point in the history
…ction using the config file
  • Loading branch information
remogloor committed May 11, 2020
1 parent 37b0b8e commit 2ce650f
Show file tree
Hide file tree
Showing 152 changed files with 18 additions and 273 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ Exemplarisch der Aufbau erklärt am bezug_http Modul:


#!/bin/bash
#Laden der openwb.conf Einstellung
. /var/www/html/openWB/openwb.conf
#Die eigentliche (in dem Fall http) Abfrage. Die Variable sollte den Modulnamen und im Anschluss den Wert enthalten um sie eindeutig zu identifizieren
wattbezug=$(curl --connect-timeout 10 -s $bezug_http_w_url)
#Prüfung auf Richtigkeit der Variable. Sie darf bei bezug modulen ein - enthalten sowie die Zahlen 0-9
Expand Down Expand Up @@ -265,7 +263,6 @@ Fronius bietet eine Json API an. Diese wird hier auf die Werte die gebraucht wer

#!/bin/bash
#Auslesen eine Fronius Symo WR über die integrierte API des WR. Rückgabewert ist die aktuelle Wattleistung
. /var/www/html/openWB/openwb.conf
#Abfrage der kompletten Json Rückgabe
pvwatttmp=$(curl --connect-timeout 5 -s $wrfroniusip/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System)
# Das Tool jq verarbeitet die Rückgabe und reduziert sie auf die gewünschte Zeile. sed & tr entfernen ungewollte Klammern, Punkte und \n newline Zeichen um die reine Zahl zu erhalten
Expand Down
1 change: 0 additions & 1 deletion ladelog.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. openwb.conf
monthlyfile="/var/www/html/openWB/web/logging/data/ladelog/$(date +%Y%m).csv"
if [ ! -f $monthlyfile ]; then
echo $monthlyfile
Expand Down
10 changes: 10 additions & 0 deletions loadconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
while read -r x; do
value="${x#*=}"
if [[ ${value:0:1} == "'" ]] ; then
value=${value:1:-1}
key="${x%%=*}"
export "$key"="$value"
else
export $x
fi
done < /var/www/html/openWB/openwb.conf
1 change: 0 additions & 1 deletion modules/bezug_alphaess/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/bezug_alphaess/readalpha.py
wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
echo $wattbezug
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_discovergy/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
output=$(curl --connect-timeout 3 -s -u $discovergyuser:$discovergypass "https://api.discovergy.com/public/v1/last_reading?meterId=$discovergyevuid")

einspeisungwh=$(echo $output | jq .values.energyOut)
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_e3dc/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

sudo python /var/www/html/openWB/modules/bezug_e3dc/e3dc.py $e3dcip
wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_ethmpm3pm/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
if (( evukitversion == 1 )); then
sudo python /var/www/html/openWB/modules/bezug_ethmpm3pm/readlovato.py
else
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_fems/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
watt=$(curl --connect-timeout 2 -s "http://x:user@$femsip:8084/rest/channel/meter0/ActivePower" | jq .value)
iwh=$(curl --connect-timeout 2 -s "http://x:user@$femsip:8084/rest/channel/_sum/GridBuyActiveEnergy" | jq .value)
ewh=$(curl --connect-timeout 2 -s "http://x:user@$femsip:8084/rest/channel/_sum/GridSellActiveEnergy" | jq .value)
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_fronius_s0/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#Rückgabewert ist die aktuelle Einspeiseleistung (negativ) oder Bezugsleistung (positiv)
# Einspeiseleistung: PV-Leistung > Verbrauch, es wird Strom eingespeist
# Bezugsleistug: PV-Leistung < Verbrauch, es wird Strom aus dem Netz bezogen
. /var/www/html/openWB/openwb.conf

wattbezugtmp=$(curl --connect-timeout 5 -s $wrfroniusip/solar_api/v1/GetPowerFlowRealtimeData.fcgi)
if (( froniusprimo == 1 )); then
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_fronius_sm/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# Einspeiseleistung: PV-Leistung > Verbrauch, es wird Strom eingespeist
# Bezugsleistug: PV-Leistung < Verbrauch, es wird Strom aus dem Netz bezogen

. /var/www/html/openWB/openwb.conf

# Fordere die Werte vom SmartMeter an.
response_sm=$(curl --connect-timeout 5 -s "$wrfroniusip/solar_api/v1/GetMeterRealtimeData.cgi?Scope=Device&DeviceID=0")
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_http/main.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash

. /var/www/html/openWB/openwb.conf

wattbezug=$(curl --connect-timeout 10 -s $bezug_http_w_url)

Expand Down
1 change: 0 additions & 1 deletion modules/bezug_json/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf


answer=$(curl --connect-timeout 5 -s $bezugjsonurl)
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_kostalpiko/main.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

#Auslesen eines Kostal Piko WR über die integrierte API des WR mit angeschlossenem Eigenverbrauchssensor.
. /var/www/html/openWB/openwb.conf

pvwatttmp=$(curl --connect-timeout 3 -s $wrkostalpikoip/api/dxs.json?dxsEntries=33556736'&'dxsEntries=251658753'&'dxsEntries=83887106'&'dxsEntries=83887362'&'dxsEntries=83887618)

Expand Down
1 change: 0 additions & 1 deletion modules/bezug_kostalplenticoreem300haus/main.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

# Konfigurationsdatei einbinden
. /var/www/html/openWB/openwb.conf

#########################################################
#
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_ksem/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/bezug_ksem/readksem.py $ksemip

wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_lgessv1/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# dem Menüpunkt "Systeminformationen"
# Mit der Registrierungsnr. kann man sich dann in der
# Rolle "installer" einloggen.
. /var/www/html/openWB/openwb.conf
ess_url="https://$lgessv1ip"
ess_pass=$lgessv1pass
#
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_mpm3pm/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

if [[ $mpm3pmevusource = *virtual* ]]
then
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_powerwall/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf


answer=$(curl -k --connect-timeout 5 -s "https://$speicherpwip/api/meters/aggregates")
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_sbs25/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf



Expand Down
1 change: 0 additions & 1 deletion modules/bezug_siemens/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf



Expand Down
1 change: 0 additions & 1 deletion modules/bezug_smartfox/main.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash

. /var/www/html/openWB/openwb.conf

#Daten einlesen
xml=$(curl --max-time 10 -s http://$bezug_smartfox_ip/values.xml -XGET -H 'Accept: */*' -H 'Accept-Encoding: gzip, deflate' -H 'Host: $bezug_smartfox_ip'-H 'Connection: keep-alive')
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_smartme/main.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash

. /var/www/html/openWB/openwb.conf

#Daten einlesen
json=$(curl -u $bezug_smartme_user:$bezug_smartme_pass --connect-timeout 10 -s $bezug_smartme_url)
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_smashm/main.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash

. /var/www/html/openWB/openwb.conf
timeout 3 python3 /var/www/html/openWB/modules/bezug_smashm/sma-em-measurement.py $smashmbezugid
wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
echo $wattbezug
1 change: 0 additions & 1 deletion modules/bezug_solaredge/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf



Expand Down
1 change: 0 additions & 1 deletion modules/bezug_solarlog/main.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash


. /var/www/html/openWB/openwb.conf


answer=$(curl -d {\"801\":{\"170\":null}} --connect-timeout 5 -s $bezug_solarlog_ip/getjp)
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_solarview/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
openwb_home=/var/www/html/openWB
target="$openwb_home/ramdisk"

. "$openwb_home/openwb.conf"

# Checks
if [ -z "$solarview_hostname" ]; then
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_solarworld/main.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

# Auslesen eines Solarworl eManagers über die integrierte JSON-API
. /var/www/html/openWB/openwb.conf
emanagerantwort=$(curl --connect-timeout 5 -s "$solarworld_emanagerip/rest/solarworld/lpvm/powerAndBatteryData")

em_in_watt=$(echo $emanagerantwort | jq '.PowerIn')
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_sonneneco/main.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

#Auslesen einer Sonnbenbatterie Eco 4.5 über die integrierte JSON-API des Batteriesystems
. /var/www/html/openWB/openwb.conf
ra='^-?[0-9]+$'
if (( sonnenecoalternativ == 2 )); then
evubezug=$(curl --connect-timeout 5 -s "$sonnenecoip:7979/rest/devices/battery/M39")
Expand Down
1 change: 0 additions & 1 deletion modules/bezug_victrongx/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf



Expand Down
1 change: 0 additions & 1 deletion modules/fsm63a3modbusll/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

### TODO: The following variables need to be added to "openwb.conf":
# fsm63a3modbusllsource=... (e.g. "/dev/ttyUSB0")
Expand Down
1 change: 0 additions & 1 deletion modules/goelp1/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
re='^-?[0-9]+$'
rekwh='^[-+]?[0-9]+\.?[0-9]*$'

Expand Down
1 change: 0 additions & 1 deletion modules/goelp2/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
re='^-?[0-9]+$'
rekwh='^[-+]?[0-9]+\.?[0-9]*$'

Expand Down
1 change: 0 additions & 1 deletion modules/goelp3/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
re='^-?[0-9]+$'
rekwh='^[-+]?[0-9]+\.?[0-9]*$'

Expand Down
1 change: 0 additions & 1 deletion modules/httpll/main.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash

. /var/www/html/openWB/openwb.conf
re='^[-+]?[0-9]+\.?[0-9]*$'

wattll=$(curl --connect-timeout 3 -s $httpll_w_url)
Expand Down
1 change: 0 additions & 1 deletion modules/keballlp1/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
rekwh='^[-+]?[0-9]+\.?[0-9]*$'
re='^-?[0-9]+$'
counter=0
Expand Down
1 change: 0 additions & 1 deletion modules/keballlp2/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
rekwh='^[-+]?[0-9]+\.?[0-9]*$'
re='^-?[0-9]+$'
#sleep 3
Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmethll/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/mpm3pmethll/readmpm3pm.py


Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmethllframer/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

sudo python /var/www/html/openWB/modules/mpm3pmethllframer/readmpm3pm.py

Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmethlls2/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/mpm3pmethlls2/readmpm3pm.py


Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmll/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

if [[ $mpm3pmllsource = *virtual* ]]
then
Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmlllp1/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/mpm3pmlllp1/readmpm3pm.py $mpmlp1ip $mpmlp1id


Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmlllp2/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/mpm3pmlllp2/readmpm3pm.py $mpmlp2ip $mpmlp2id


Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmlllp3/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/mpm3pmlllp3/readmpm3pm.py $mpmlp3ip $mpmlp3id


Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmlllp4/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/mpm3pmlllp4/readmpm3pm.py $mpmlp4ip $mpmlp4id


Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmlllp5/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/mpm3pmlllp5/readmpm3pm.py $mpmlp5ip $mpmlp5id


Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmlllp6/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/mpm3pmlllp6/readmpm3pm.py $mpmlp6ip $mpmlp6id


Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmlllp7/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/mpm3pmlllp7/readmpm3pm.py $mpmlp7ip $mpmlp7id


Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmlllp8/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
sudo python /var/www/html/openWB/modules/mpm3pmlllp8/readmpm3pm.py $mpmlp8ip $mpmlp8id


Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmlls1/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

if [[ $evsesources1 = *virtual* ]]
then
Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmlls2/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

if [[ $evsesources2 = *virtual* ]]
then
Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmpv/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

if [[ $mpm3pmpvsource = *virtual* ]]
then
Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmspeicher/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

if [[ $mpm3pmspeichersource = *virtual* ]]
then
Expand Down
1 change: 0 additions & 1 deletion modules/mpm3pmtripple/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

sudo python /var/www/html/openWB/modules/mpm3pmtripple/readmpm3pm.py /dev/ttyUSB0 105

Expand Down
1 change: 0 additions & 1 deletion modules/nrgkicklp1/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
re='^-?[0-9]+$'
rekwh='^[-+]?[0-9]+\.?[0-9]*$'

Expand Down
1 change: 0 additions & 1 deletion modules/nrgkicklp2/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
re='^-?[0-9]+$'
rekwh='^[-+]?[0-9]+\.?[0-9]*$'

Expand Down
1 change: 0 additions & 1 deletion modules/sdm120modbusll/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
re='^-?[0-9]+$'
rekwh='^[-+]?[0-9]+\.?[0-9]*$'

Expand Down
1 change: 0 additions & 1 deletion modules/sdm120modbuslls1/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
re='^-?[0-9]+$'
rekwh='^[-+]?[0-9]+\.?[0-9]*$'

Expand Down
1 change: 0 additions & 1 deletion modules/sdm120modbuslls2/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf
re='^-?[0-9]+$'
rekwh='^[-+]?[0-9]+\.?[0-9]*$'

Expand Down
1 change: 0 additions & 1 deletion modules/sdm630modbusbezug/main.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash

. /var/www/html/openWB/openwb.conf

if [[ $sdm630modbusbezugsource = *virtual* ]]
then
Expand Down
1 change: 0 additions & 1 deletion modules/sdm630modbusll/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
. /var/www/html/openWB/openwb.conf

if [[ $sdm630modbusllsource = *virtual* ]]
then
Expand Down
Loading

0 comments on commit 2ce650f

Please sign in to comment.