From 999657d3e540e28ead5bb7c7eb541850bba96b06 Mon Sep 17 00:00:00 2001 From: first Date: Mon, 7 Jul 2025 19:21:28 +0000 Subject: [PATCH] fixed - both systemd and tcpdump use the percent sign (%) for special formatting --- synterloper/synterloper.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/synterloper/synterloper.sh b/synterloper/synterloper.sh index fa1c770..767a564 100644 --- a/synterloper/synterloper.sh +++ b/synterloper/synterloper.sh @@ -61,7 +61,10 @@ Description=SYNterloper - TCP Port Connection Logger After=network.target [Service] Type=simple -ExecStart=/bin/sh -c 'exec /usr/sbin/tcpdump -i \$(ip -4 route get 1.1.1.1 | grep -oP "dev \\K\\S+") -s ${SNAP_LEN} -w ${LOG_DIR}/capture-%Y-%m-%d_%H-%M.pcap -G ${ROTATE_SECONDS} "tcp port ${CAPTURE_PORT}"' +# ========================================================================================= +# THE FIX IS HERE: All '%' are escaped as '%%' for systemd +# ========================================================================================= +ExecStart=/bin/sh -c 'exec /usr/sbin/tcpdump -i \$(ip -4 route get 1.1.1.1 | grep -oP "dev \\K\\S+") -s ${SNAP_LEN} -w ${LOG_DIR}/capture-%%Y-%%m-%%d_%%H-%%M.pcap -G ${ROTATE_SECONDS} "tcp port ${CAPTURE_PORT}"' Restart=on-failure RestartSec=5 [Install] @@ -72,6 +75,7 @@ EOF systemctl enable synterloper.service systemctl start synterloper.service elif [ "${OS_TYPE}" = "FreeBSD" ]; then + # FreeBSD's rc.d system does not have this issue, so no change is needed here. echo "Creating rc.d script: /usr/local/etc/rc.d/synterloper" cat > /usr/local/etc/rc.d/synterloper <<'EOF' #!/bin/sh