Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can β€” learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company πŸ‘‡

fix(lisdex): install.sh named the URL that failed but never the reason

CarterPerez-deva00e4b5f3693
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/install.sh b/PROJECTS/advanced/zero-day-vulnerability-scanner/install.sh
index 74a5d318..b80a7d15 100755
--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/install.sh
+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/install.sh
@@ -10,7 +10,7 @@ BINARY="lisdex"
TAGLINE="keyless memory-corruption scanner for C/C++ parsers"
REPO_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}.git"
INSTALL_DIR="${LISDEX_INSTALL_DIR:-$HOME/.local/bin}"
-DEFAULT_BRANCH="main"
+DEFAULT_BRANCH="${LISDEX_BRANCH:-main}"
MIN_RUST="1.97"
VERIFIED_AFL="5.02c"
SKIP_AFL=0
@@ -130,8 +130,20 @@ resolve_repo() {
git -C "$cache" pull --ff-only --quiet 2>/dev/null || warn "pull failed; using existing clone"
else
info "cloning ${REPO_URL}"
- git clone --depth 1 --branch "$DEFAULT_BRANCH" --quiet "$REPO_URL" "$cache" \
- || die "clone failed from ${REPO_URL}"
+ local clone_err=""
+ if ! clone_err="$(GIT_TERMINAL_PROMPT=0 git clone --depth 1 \
+ --branch "$DEFAULT_BRANCH" --quiet "$REPO_URL" "$cache" 2>&1)"; then
+ case "$clone_err" in
+ *"Could not resolve host"*|*"unable to access"*|*"Connection"*|*"timed out"*|*"Network"*)
+ die "cannot reach the host for ${REPO_URL}: check the network or a proxy" ;;
+ *"Remote branch"*|*"Could not find remote branch"*)
+ die "${REPO_URL} has no branch named ${DEFAULT_BRANCH}; set LISDEX_BRANCH to the one it uses" ;;
+ *"not found"*|*"Not Found"*|*"not exist"*|*"Authentication"*|*"could not read Username"*|*"Permission denied"*)
+ die "cannot read ${REPO_URL}: it is missing, private, or renamed, and the host will not say which. If you have a checkout, run install.sh from inside it instead" ;;
+ *)
+ die "clone failed from ${REPO_URL}: ${clone_err}" ;;
+ esac
+ fi
fi
printf '%s\n' "$cache"
}