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

Fixes #1026 #1027 #1028

six2dezd0c1ed481d85
diff --git a/.github/workflows/docker_nightly.yml b/.github/workflows/docker_nightly.yml
index f000529..3a068a9 100644
--- a/.github/workflows/docker_nightly.yml
+++ b/.github/workflows/docker_nightly.yml
@@ -39,9 +39,16 @@ jobs:
uses: docker/build-push-action@v5
with:
context: ./Docker
+ platforms: linux/amd64,linux/arm64
push: true
tags: six2dez/reconftw:main
+ - name: Verify published manifest
+ run: |
+ docker buildx imagetools inspect six2dez/reconftw:main > /tmp/reconftw-manifest.txt
+ grep -q 'linux/amd64' /tmp/reconftw-manifest.txt
+ grep -q 'linux/arm64' /tmp/reconftw-manifest.txt
+
- name: Verify image health
run: |
docker pull six2dez/reconftw:main
diff --git a/install.sh b/install.sh
index be5a43f..3120409 100755
--- a/install.sh
+++ b/install.sh
@@ -426,6 +426,43 @@ clone_repo() {
done
}
+function interlace_tool_python() {
+ local tool_python
+ tool_python="$(uv tool dir 2>/dev/null)/interlace/bin/python"
+ [[ -x "$tool_python" ]] || return 1
+ printf '%s\n' "$tool_python"
+}
+
+function interlace_colorclass_codes_path() {
+ local tool_python
+ tool_python="$(interlace_tool_python)" || return 1
+ "$tool_python" -c 'import importlib.util, os; spec = importlib.util.find_spec("colorclass"); print("" if spec is None or spec.origin is None else os.path.join(os.path.dirname(spec.origin), "codes.py"))' 2>/dev/null
+}
+
+function interlace_colorclass_imports_ok() {
+ local tool_python
+ tool_python="$(interlace_tool_python)" || return 1
+ "$tool_python" -c 'import colorclass' >/dev/null 2>&1
+}
+
+function ensure_interlace_colorclass_healthy() {
+ local cc_codes
+
+ if interlace_colorclass_imports_ok; then
+ return 0
+ fi
+
+ cc_codes="$(interlace_colorclass_codes_path)" || return 1
+ [[ -n "$cc_codes" && -f "$cc_codes" ]] || return 1
+
+ if grep -q 'from collections import Mapping' "$cc_codes"; then
+ sed -i.bak 's/from collections import Mapping/from collections.abc import Mapping/' "$cc_codes" || return 1
+ rm -f "${cc_codes}.bak" 2>/dev/null || true
+ fi
+
+ interlace_colorclass_imports_ok
+}
+
# Function to install Go tools
function install_tools() {
header "Installing Golang tools (${#gotools[@]})"
@@ -481,19 +518,16 @@ function install_tools() {
tool_args+=("--with" "jellyfish>=1.1.3")
fi
- # Special case for interlace: colorclass is abandoned and broken on Python 3.10+
- # PR https://github.com/Robpol86/colorclass/pull/27 never merged
- if [[ "$pipxtool" == "interlace" ]]; then
- local cc_codes
- cc_codes="$(dirname "$(uv tool run --from interlace python -c 'import colorclass; print(colorclass.__file__)')")/codes.py" 2>/dev/null
- if [[ -f "$cc_codes" ]]; then
- sed -i 's/from collections import Mapping/from collections.abc import Mapping/' "$cc_codes"
- fi
- fi
-
# Always force install/reinstall from the git URL
# This handles both initial install and upgrades correctly
if q uv tool install "${tool_args[@]}" "$tool_url" --force; then
+ if [[ "$pipxtool" == "interlace" ]] && ! ensure_interlace_colorclass_healthy; then
+ failed_pipx_tools+=("$pipxtool")
+ ((++px_fail))
+ double_check=true
+ msg_err "[$pipx_step/$total_px] ${pipxtool} failed health check"
+ continue
+ fi
((++px_ok))
msg_ok "[$pipx_step/$total_px] ${pipxtool} ready"
else
diff --git a/modules/core.sh b/modules/core.sh
index c795cf8..bae5273 100644
--- a/modules/core.sh
+++ b/modules/core.sh
@@ -1247,10 +1247,9 @@ function remove_big_files() {
function notification() {
if [[ -n $1 ]] && [[ -n $2 ]]; then
+ local -a notify_cmd=()
if [[ $NOTIFICATION == true ]]; then
- NOTIFY="notify -silent"
- else
- NOTIFY=""
+ notify_cmd=(notify -silent)
fi
local level="INFO"
case $2 in
@@ -1283,8 +1282,8 @@ function notification() {
if [[ "$should_print" != true ]]; then
# Still send to notify if enabled, just skip terminal print
- if [[ -n $NOTIFY ]]; then
- printf "%s" "[${level}] ${1} - ${domain}" | $NOTIFY >/dev/null 2>&1
+ if [[ ${#notify_cmd[@]} -gt 0 ]]; then
+ printf "%s" "[${level}] ${1} - ${domain}" | "${notify_cmd[@]}" >/dev/null 2>&1
fi
return 0
fi
@@ -1294,11 +1293,11 @@ function notification() {
if [[ "$level" == "WARN" || "$level" == "FAIL" ]]; then
record_incident "$level" "${FUNCNAME[1]:-notice}" "$1"
fi
-
+
# Send to notify if notifications are enabled
- if [[ -n $NOTIFY ]]; then
+ if [[ ${#notify_cmd[@]} -gt 0 ]]; then
# Remove color codes for the notification
- printf "%s" "[${level}] ${1} - ${domain}" | $NOTIFY >/dev/null 2>&1
+ printf "%s" "[${level}] ${1} - ${domain}" | "${notify_cmd[@]}" >/dev/null 2>&1
fi
fi
}
diff --git a/tests/integration/test_notifications.bats b/tests/integration/test_notifications.bats
new file mode 100644
index 0000000..d3593f1
--- /dev/null
+++ b/tests/integration/test_notifications.bats
@@ -0,0 +1,58 @@
+#!/usr/bin/env bats
+
+setup() {
+ SCRIPTPATH="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)"
+ export SCRIPTPATH
+ TEST_DIR="$BATS_TEST_TMPDIR/reconftw_notifications"
+ MOCK_BIN="$TEST_DIR/mockbin"
+ mkdir -p "$TEST_DIR" "$MOCK_BIN"
+
+ cat >"$MOCK_BIN/notify" <<'EOF'
+#!/usr/bin/env bash
+cat >>"${NOTIFY_LOG}"
+EOF
+ chmod +x "$MOCK_BIN/notify"
+}
+
+teardown() {
+ [[ -n "${TARGET_DOMAIN:-}" ]] && rm -rf "$SCRIPTPATH/Recon/$TARGET_DOMAIN"
+ [[ -d "${TEST_DIR:-}" ]] && rm -rf "$TEST_DIR"
+}
+
+@test "NOTIFICATION=true sends function notifications through notify" {
+ TARGET_DOMAIN="notify-${RANDOM}.example.com"
+ local cfg="$TEST_DIR/notification.cfg"
+ local notify_log="$TEST_DIR/notification.log"
+
+ cat >"$cfg" <<'EOF'
+NOTIFICATION=true
+SOFT_NOTIFICATION=false
+OUTPUT_VERBOSITY=2
+EOF
+
+ run env PATH="$MOCK_BIN:$PATH" NOTIFY_LOG="$notify_log" SKIP_CRITICAL_CHECK=true timeout 60 \
+ bash "$SCRIPTPATH/reconftw.sh" -d "$TARGET_DOMAIN" -s --dry-run --no-report --no-banner -f "$cfg" 2>&1
+
+ [ "$status" -eq 0 ]
+ [ -s "$notify_log" ]
+ grep -Fq "$TARGET_DOMAIN" "$notify_log"
+}
+
+@test "SOFT_NOTIFICATION=true still sends final notification" {
+ TARGET_DOMAIN="softnotify-${RANDOM}.example.com"
+ local cfg="$TEST_DIR/soft-notification.cfg"
+ local notify_log="$TEST_DIR/soft-notification.log"
+
+ cat >"$cfg" <<'EOF'
+NOTIFICATION=false
+SOFT_NOTIFICATION=true
+OUTPUT_VERBOSITY=1
+EOF
+
+ run env PATH="$MOCK_BIN:$PATH" NOTIFY_LOG="$notify_log" SKIP_CRITICAL_CHECK=true timeout 60 \
+ bash "$SCRIPTPATH/reconftw.sh" -d "$TARGET_DOMAIN" -s --dry-run --no-report --no-banner -f "$cfg" 2>&1
+
+ [ "$status" -eq 0 ]
+ [ -s "$notify_log" ]
+ grep -Fq "Finished Recon on: $TARGET_DOMAIN" "$notify_log"
+}
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 4016ea4..1a8fde1 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -48,6 +48,7 @@ run_smoke() {
"$SCRIPT_DIR"/integration/test_smoke.bats \
"$SCRIPT_DIR"/integration/test_report_only.bats \
"$SCRIPT_DIR"/integration/test_export_cli.bats \
+ "$SCRIPT_DIR"/integration/test_notifications.bats \
"$SCRIPT_DIR"/integration/test_monitor_mode.bats
}
diff --git a/tests/unit/test_install_interlace_colorclass.bats b/tests/unit/test_install_interlace_colorclass.bats
new file mode 100644
index 0000000..8e7190d
--- /dev/null
+++ b/tests/unit/test_install_interlace_colorclass.bats
@@ -0,0 +1,92 @@
+#!/usr/bin/env bats
+
+setup() {
+ TEST_DIR=$(mktemp -d)
+ ORIG_PATH="$PATH"
+ MOCK_BIN="$TEST_DIR/mockbin"
+ UV_TOOL_DIR="$TEST_DIR/uv-tools"
+ INTERLACE_BIN_DIR="$UV_TOOL_DIR/interlace/bin"
+ COLORCLASS_DIR="$UV_TOOL_DIR/interlace/lib/python3.12/site-packages/colorclass"
+ COLORCLASS_CODES="$COLORCLASS_DIR/codes.py"
+
+ mkdir -p "$MOCK_BIN" "$INTERLACE_BIN_DIR" "$COLORCLASS_DIR"
+ export PATH="$MOCK_BIN:$PATH"
+ export UV_TOOL_DIR COLORCLASS_DIR COLORCLASS_CODES
+
+ : >"$COLORCLASS_DIR/__init__.py"
+ printf '%s\n' 'from collections import Mapping' >"$COLORCLASS_CODES"
+
+ create_mock_uv
+
+ local installfile="${BATS_TEST_DIRNAME}/../../install.sh"
+ eval "$(sed -n '/^function interlace_tool_python()/,/^}/p' "$installfile")"
+ eval "$(sed -n '/^function interlace_colorclass_codes_path()/,/^}/p' "$installfile")"
+ eval "$(sed -n '/^function interlace_colorclass_imports_ok()/,/^}/p' "$installfile")"
+ eval "$(sed -n '/^function ensure_interlace_colorclass_healthy()/,/^}/p' "$installfile")"
+}
+
+teardown() {
+ PATH="$ORIG_PATH"
+ rm -rf "$TEST_DIR"
+}
+
+create_mock_uv() {
+ cat >"$MOCK_BIN/uv" <<'EOF'
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [[ "${1:-}" == "tool" && "${2:-}" == "dir" ]]; then
+ printf '%s\n' "$UV_TOOL_DIR"
+ exit 0
+fi
+
+echo "unexpected uv call: $*" >&2
+exit 1
+EOF
+ chmod +x "$MOCK_BIN/uv"
+
+ cat >"$INTERLACE_BIN_DIR/python" <<'EOF'
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [[ "${1:-}" != "-c" ]]; then
+ echo "unexpected python invocation: $*" >&2
+ exit 1
+fi
+
+code="${2:-}"
+if [[ "$code" == *'find_spec("colorclass")'* ]]; then
+ printf '%s\n' "$COLORCLASS_CODES"
+ exit 0
+fi
+
+if [[ "$code" == 'import colorclass' ]]; then
+ if grep -q 'from collections.abc import Mapping' "$COLORCLASS_CODES"; then
+ exit 0
+ fi
+ echo "ImportError: cannot import name 'Mapping' from 'collections'" >&2
+ exit 1
+fi
+
+echo "unexpected python code: $code" >&2
+exit 1
+EOF
+ chmod +x "$INTERLACE_BIN_DIR/python"
+}
+
+@test "ensure_interlace_colorclass_healthy patches broken installed colorclass" {
+ run ensure_interlace_colorclass_healthy
+
+ [ "$status" -eq 0 ]
+ grep -Fq 'from collections.abc import Mapping' "$COLORCLASS_CODES"
+ ! grep -Fq 'from collections import Mapping' "$COLORCLASS_CODES"
+ [ ! -e "${COLORCLASS_CODES}.bak" ]
+}
+
+@test "ensure_interlace_colorclass_healthy fails when installed tool python is missing" {
+ rm -f "$INTERLACE_BIN_DIR/python"
+
+ run ensure_interlace_colorclass_healthy
+
+ [ "$status" -ne 0 ]
+}
diff --git a/tests/unit/test_verbosity.bats b/tests/unit/test_verbosity.bats
index 8e300ed..616c176 100644
--- a/tests/unit/test_verbosity.bats
+++ b/tests/unit/test_verbosity.bats
@@ -3,6 +3,12 @@
setup() {
TEST_DIR=$(mktemp -d)
+ ORIG_PATH="$PATH"
+ ORIG_IFS="$IFS"
+ MOCK_BIN="$TEST_DIR/mockbin"
+ mkdir -p "$MOCK_BIN"
+ export PATH="$MOCK_BIN:$PATH"
+ IFS=$'\n\t'
cd "$TEST_DIR" || exit 1
# Minimal color vars
@@ -47,10 +53,20 @@ setup() {
}
teardown() {
+ PATH="$ORIG_PATH"
+ IFS="$ORIG_IFS"
cd /
rm -rf "$TEST_DIR"
}
+create_mock_notify() {
+ cat >"$MOCK_BIN/notify" <<'EOF'
+#!/usr/bin/env bash
+cat >>"${NOTIFY_LOG}"
+EOF
+ chmod +x "$MOCK_BIN/notify"
+}
+
###############################################################################
# notification() verbosity tests
###############################################################################
@@ -83,6 +99,34 @@ teardown() {
[[ "$output" == *"detail info"* ]]
}
+@test "notification sends suppressed messages to notify when enabled" {
+ create_mock_notify
+ export NOTIFY_LOG="$TEST_DIR/notify-suppressed.log"
+ NOTIFICATION=true
+ OUTPUT_VERBOSITY=1
+
+ run notification "hello world" info
+
+ [ "$status" -eq 0 ]
+ [[ "$output" == "" ]]
+ [ -s "$NOTIFY_LOG" ]
+ grep -Fq "[INFO] hello world - test.com" "$NOTIFY_LOG"
+}
+
+@test "notification sends visible messages to notify when enabled" {
+ create_mock_notify
+ export NOTIFY_LOG="$TEST_DIR/notify-visible.log"
+ NOTIFICATION=true
+ OUTPUT_VERBOSITY=2
+
+ run notification "detail info" info
+
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"detail info"* ]]
+ [ -s "$NOTIFY_LOG" ]
+ grep -Fq "[INFO] detail info - test.com" "$NOTIFY_LOG"
+}
+
###############################################################################
# skip_notification() verbosity tests
###############################################################################
@@ -135,4 +179,3 @@ teardown() {
[ "$status" -eq 0 ]
[[ "$output" != *"OK"* ]]
}
-