hackingtool/update.sh
Hardik Zinzuvadiya 536568b72d Fix 12 issues from Copilot PR review (#590)
post_exploitation.py:
- Rename INSTALL_OS -> SUPPORTED_OS in Havoc class (typo, field was ignored)
- Sliver: replace curl|sudo bash pipe with download-then-execute pattern

ddos.py:
- Add DDoSTool() to DDOSTools.TOOLS list (was defined but unreachable)

phishing_attack.py:
- Rename class Evilginx2 -> Evilginx3 (installs v3 via go install)
- Update instance in TOOLS list to match
- Fix stale comment: wireless_attack_tools.py -> wireless_attack.py

forensics.py:
- Remove installable=False from Guymager (conflicted with INSTALL_COMMANDS)

tool_manager.py:
- Skip sudo prefix when already root (os.geteuid() == 0), matching
  the pattern already used in install.py

install.py:
- Add chown -R root:root after cp -a to prevent git "dubious ownership"
  errors when the source clone has different ownership

update.sh:
- Add git config safe.directory before pull to prevent dubious ownership
- Add --upgrade flag to pip install so dependencies actually update

os_detect.py:
- Add pkg (FreeBSD) entries to PACKAGE_INSTALL_CMDS, PACKAGE_UPDATE_CMDS,
  and REQUIRED_PACKAGES — was detected but had no command mappings (KeyError)

Skipped (not applicable):
- #1 subprocess import: already fixed in prior commit
- #11 Path.home() under sudo: by design (installer runs as root)
2026-03-15 19:55:00 +05:30

34 lines
962 B
Bash

#!/bin/bash
set -euo pipefail
INSTALL_DIR="/usr/share/hackingtool"
if [[ $EUID -ne 0 ]]; then
echo "[ERROR] Run as root: sudo bash update.sh"
exit 1
fi
if [[ ! -d "$INSTALL_DIR" ]]; then
echo "[ERROR] Installation not found at $INSTALL_DIR. Run install.py first."
exit 1
fi
echo "[*] Checking internet connection..."
if ! curl -sSf --max-time 10 https://github.com > /dev/null; then
echo "[ERROR] No internet connection."
exit 1
fi
echo "[✔] Internet OK"
echo "[*] Pulling latest changes..."
git -C "$INSTALL_DIR" config --local safe.directory "$INSTALL_DIR"
git -C "$INSTALL_DIR" pull --rebase
echo "[*] Updating Python dependencies..."
if [[ -f "$INSTALL_DIR/venv/bin/pip" ]]; then
"$INSTALL_DIR/venv/bin/pip" install -q --upgrade -r "$INSTALL_DIR/requirements.txt"
else
echo "[WARN] venv not found — skipping pip update. Run install.py to create it."
fi
echo "[✔] Hackingtool updated. Run 'hackingtool' to start."