Skip to content

reconFTW is a tool designed to perform automated recon on a target domain by running the best set of tools to perform scanning and finding out vulnerabilities

fix: macOS compatibility for df command in health_check

six2dezdf7048ccb53d
diff --git a/modules/core.sh b/modules/core.sh
index 7a1aeab..afe7f48 100644
--- a/modules/core.sh
+++ b/modules/core.sh
@@ -1017,10 +1017,18 @@ function health_check() {
# 4. Check disk space
printf "\n%b[*] Checking disk space...%b\n" "$yellow" "$reset"
local avail_gb
- avail_gb=$(df -BG . 2>/dev/null | awk 'NR==2 {gsub(/G/,"",$4); print $4}' || df -g . 2>/dev/null | awk 'NR==2 {print $4}' || echo "0")
- if [[ ${avail_gb:-0} -ge 5 ]]; then
+ if [[ "$OSTYPE" == "darwin"* ]]; then
+ # macOS: df -g shows GB directly
+ avail_gb=$(df -g . 2>/dev/null | awk 'NR==2 {print $4}')
+ else
+ # Linux: df -BG shows GB with G suffix
+ avail_gb=$(df -BG . 2>/dev/null | awk 'NR==2 {gsub(/G/,"",$4); print $4}')
+ fi
+ avail_gb=${avail_gb:-0}
+
+ if [[ ${avail_gb} -ge 5 ]]; then
printf " %b[OK]%b %s GB available\n" "$bgreen" "$reset" "$avail_gb"
- elif [[ ${avail_gb:-0} -ge 1 ]]; then
+ elif [[ ${avail_gb} -ge 1 ]]; then
printf " %b[WARN]%b Only %s GB available (recommend 5+ GB)\n" "$byellow" "$reset" "$avail_gb"
((warnings++))
else