From fb2ba96f5b0f393fa173a31fb9c16e4fd64dfad0 Mon Sep 17 00:00:00 2001 From: Alfonso Gamboa Date: Fri, 17 Jun 2022 01:17:39 -0700 Subject: [PATCH] strip passwords from debug logs users can generate --- SD_ROOT/wz_mini/bin/gather_wz_logs.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/SD_ROOT/wz_mini/bin/gather_wz_logs.sh b/SD_ROOT/wz_mini/bin/gather_wz_logs.sh index 8198967..92d57b9 100755 --- a/SD_ROOT/wz_mini/bin/gather_wz_logs.sh +++ b/SD_ROOT/wz_mini/bin/gather_wz_logs.sh @@ -13,7 +13,6 @@ else create_dir fi -#cat * | grep 2C | sed 's/^.*\(RTSP_PASSWORD=\).*$/\1/' | sed 's/-U[^-P]*//' echo "copy wz_mini logs" cp /opt/wz_mini/log/* /opt/wz_mini/tmp/log_gather/ @@ -39,7 +38,7 @@ echo "gather libcallback logs" logread | grep "\[command\]" > /opt/wz_mini/tmp/log_gather/libcallback.log echo "gather process list" -ps -T | sed 's/-U[^-P]*//' > /opt/wz_mini/tmp/log_gather/ps.log +ps -T > /opt/wz_mini/tmp/log_gather/ps.log echo "gather mounts" mount > /opt/wz_mini/tmp/log_gather/mount.log @@ -62,6 +61,17 @@ if [ -f /tmp/sd_check_result.txt ]; then cp /tmp/sd_check_result.txt /opt/wz_mini/tmp/log_gather/sd_check_result.txt fi +if [[ "$RTSP_PASSWORD" == "" ]]; then + echo "password is blank in config" + RTSP_PASSWORD=$(cat /opt/wz_mini/tmp/wlan0_mac) +fi + +cd /opt/wz_mini/tmp/log_gather +echo $RTSP_PASSWORD +sed -e s/"$RTSP_PASSWORD"//g -i * +cd / + + echo "compress to /media/mmc/log_gather_$(date +"%F_T%H%M").tar.gz" tar -czf /media/mmc/log_gather_$(date +"%F_T%H%M").tar.gz -C /opt/wz_mini/tmp log_gather/