Fix quoted numeric config parsing
This commit is contained in:
+5
-4
@@ -65,10 +65,10 @@ done
|
|||||||
|
|
||||||
umask 077
|
umask 077
|
||||||
{
|
{
|
||||||
printf "CPU_THRESHOLD='%s'\n" "$CPU_THRESHOLD"
|
printf "CPU_THRESHOLD=%s\n" "$CPU_THRESHOLD"
|
||||||
printf "ALERT_SCORE='%s'\n" "$ALERT_SCORE"
|
printf "ALERT_SCORE=%s\n" "$ALERT_SCORE"
|
||||||
printf "CRITICAL_SCORE='%s'\n" "$CRITICAL_SCORE"
|
printf "CRITICAL_SCORE=%s\n" "$CRITICAL_SCORE"
|
||||||
printf "COOLDOWN_SECONDS='%s'\n" "$COOLDOWN_SECONDS"
|
printf "COOLDOWN_SECONDS=%s\n" "$COOLDOWN_SECONDS"
|
||||||
printf "ABUSECH_AUTH_KEY='%s'\n" "$ABUSECH_AUTH_KEY"
|
printf "ABUSECH_AUTH_KEY='%s'\n" "$ABUSECH_AUTH_KEY"
|
||||||
printf "DISCORD_WEBHOOK='%s'\n" "$DISCORD_WEBHOOK"
|
printf "DISCORD_WEBHOOK='%s'\n" "$DISCORD_WEBHOOK"
|
||||||
} > /etc/malware-watch/config
|
} > /etc/malware-watch/config
|
||||||
@@ -91,6 +91,7 @@ if [[ "$INSTALL_CLAMAV" == "1" ]]; then
|
|||||||
deb="$(mktemp /tmp/clamav.XXXXXX.deb)"
|
deb="$(mktemp /tmp/clamav.XXXXXX.deb)"
|
||||||
url="${CLAMAV_URL:-https://www.clamav.net/downloads/production/clamav-${CLAMAV_VERSION}.linux.${clam_arch}.deb}"
|
url="${CLAMAV_URL:-https://www.clamav.net/downloads/production/clamav-${CLAMAV_VERSION}.linux.${clam_arch}.deb}"
|
||||||
curl -fL --retry 3 --retry-delay 2 -o "$deb" "$url"
|
curl -fL --retry 3 --retry-delay 2 -o "$deb" "$url"
|
||||||
|
chmod 644 "$deb"
|
||||||
systemctl disable --now clamav-freshclam 2>/dev/null || true
|
systemctl disable --now clamav-freshclam 2>/dev/null || true
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get remove -y \
|
DEBIAN_FRONTEND=noninteractive apt-get remove -y \
|
||||||
clamav clamav-freshclam clamav-base libclamav9 libclamav11 2>/dev/null || true
|
clamav clamav-freshclam clamav-base libclamav9 libclamav11 2>/dev/null || true
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ def cfg():
|
|||||||
d={}
|
d={}
|
||||||
for line in open(CFG,errors='ignore'):
|
for line in open(CFG,errors='ignore'):
|
||||||
if '=' in line and not line.lstrip().startswith('#'):
|
if '=' in line and not line.lstrip().startswith('#'):
|
||||||
k,v=line.rstrip('\n').split('=',1); d[k]=v
|
k,v=line.rstrip('\n').split('=',1)
|
||||||
|
v=v.strip()
|
||||||
|
if len(v) >= 2 and v[0] == v[-1] and v[0] in ("'", '"'):
|
||||||
|
v=v[1:-1]
|
||||||
|
d[k]=v
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def loadj(p,default):
|
def loadj(p,default):
|
||||||
|
|||||||
Reference in New Issue
Block a user