Fix quoted numeric config parsing

This commit is contained in:
javara999
2026-09-03 11:37:25 +09:00
parent 13f06d3448
commit 18a812916c
2 changed files with 10 additions and 5 deletions
+5 -4
View File
@@ -65,10 +65,10 @@ done
umask 077
{
printf "CPU_THRESHOLD='%s'\n" "$CPU_THRESHOLD"
printf "ALERT_SCORE='%s'\n" "$ALERT_SCORE"
printf "CRITICAL_SCORE='%s'\n" "$CRITICAL_SCORE"
printf "COOLDOWN_SECONDS='%s'\n" "$COOLDOWN_SECONDS"
printf "CPU_THRESHOLD=%s\n" "$CPU_THRESHOLD"
printf "ALERT_SCORE=%s\n" "$ALERT_SCORE"
printf "CRITICAL_SCORE=%s\n" "$CRITICAL_SCORE"
printf "COOLDOWN_SECONDS=%s\n" "$COOLDOWN_SECONDS"
printf "ABUSECH_AUTH_KEY='%s'\n" "$ABUSECH_AUTH_KEY"
printf "DISCORD_WEBHOOK='%s'\n" "$DISCORD_WEBHOOK"
} > /etc/malware-watch/config
@@ -91,6 +91,7 @@ if [[ "$INSTALL_CLAMAV" == "1" ]]; then
deb="$(mktemp /tmp/clamav.XXXXXX.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"
chmod 644 "$deb"
systemctl disable --now clamav-freshclam 2>/dev/null || true
DEBIAN_FRONTEND=noninteractive apt-get remove -y \
clamav clamav-freshclam clamav-base libclamav9 libclamav11 2>/dev/null || true
+5 -1
View File
@@ -9,7 +9,11 @@ def cfg():
d={}
for line in open(CFG,errors='ignore'):
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
def loadj(p,default):