Loading hackingtool.py +84 −100 Original line number Diff line number Diff line #!/usr/bin/env python3 # Version 1.1.0 (rich UI - purple theme) import os import sys # ── Python version guard (must be before any other local import) ─────────────── if sys.version_info < (3, 10): print( f"[ERROR] Python 3.10 or newer is required.\n" f"You are running Python {sys.version_info.major}.{sys.version_info.minor}.\n" f"Upgrade with: sudo apt install python3.10" ) sys.exit(1) import os import webbrowser from platform import system from time import sleep from rich.console import Console from rich.panel import Panel from rich.table import Table from rich.prompt import Prompt, IntPrompt, Confirm from rich.prompt import IntPrompt, Confirm from rich.align import Align from rich.text import Text from rich import box from rich.columns import Columns from rich.rule import Rule from rich.padding import Padding from core import HackingToolsCollection from constants import VERSION_DISPLAY, REPO_WEB_URL from config import get_tools_dir from tools.anonsurf import AnonSurfTools from tools.ddos import DDOSTools from tools.exploit_frameworks import ExploitFrameworkTools Loading Loading @@ -67,7 +75,7 @@ tool_definitions = [ ("DDOS Attack Tools", "⚡"), ("Remote Administrator Tools (RAT)", "🖥️"), ("XSS Attack Tools", "💥"), ("Steganograhy tools", "🖼️"), ("Steganography tools", "🖼️"), ("Other tools", "✨"), ("Update or Uninstall | Hackingtool", "♻️"), ] Loading @@ -90,7 +98,7 @@ all_tools = [ XSSAttackTools(), SteganographyTools(), OtherTools(), ToolManager() ToolManager(), ] Loading @@ -99,20 +107,18 @@ class AllTools(HackingToolsCollection): TOOLS = all_tools def show_info(self): header = Text() header.append(ASCII_LOGO, style="bold magenta") header.append("\n\n",) header = Text(ASCII_LOGO, style="bold magenta") footer = Text.assemble( (" https://github.com/Z4nzu/hackingtool ", "bold bright_black"), (f" {REPO_WEB_URL} ", "bold bright_black"), (" | ",), ("Version 1.1.0", "bold green"), (VERSION_DISPLAY, "bold green"), ) warning = Text(" Please Don't Use For illegal Activity ", style="bold red") warning = Text(" Please Don't Use For Illegal Activity ", style="bold red") panel = Panel( Align.center(header + Text("\n") + footer + Text("\n") + warning), box=box.DOUBLE, padding=(1, 2), border_style="magenta" border_style="magenta", ) console.print(panel) Loading @@ -123,7 +129,7 @@ def build_menu(): table.add_column("name", justify="left") for idx, (title, icon) in enumerate(tool_definitions): if idx == 17: if idx == len(tool_definitions) - 1: label = "[bold magenta]99[/bold magenta]" name = f"[bold magenta]{icon} {title}[/bold magenta]" else: Loading @@ -131,47 +137,24 @@ def build_menu(): name = f"[white]{icon}[/white] [magenta]{title}[/magenta]" table.add_row(label, name) top_panel = Panel( console.print(Panel( Align.center(Text("HackingTool — Main Menu", style="bold white on magenta"), vertical="middle"), style="magenta", padding=(0, 1), box=box.ROUNDED ) menu_panel = Panel.fit( style="magenta", padding=(0, 1), box=box.ROUNDED, )) console.print(Panel.fit( table, title="[bold magenta]Select a tool[/bold magenta]", border_style="bright_magenta", box=box.SQUARE ) footer = Align.center(Text("Choose number and press Enter — 99 to exit", style="italic bright_black")) console.print(top_panel) console.print(menu_panel) box=box.SQUARE, )) console.print(Rule(style="bright_black")) console.print(footer) console.print(Align.center(Text( "Choose number and press Enter — 99 to exit", style="italic bright_black", ))) console.print("") def choose_path(): fpath = os.path.expanduser("~/hackingtoolpath.txt") if not os.path.exists(fpath): os.system("clear" if system() == "Linux" else "cls") build_menu() console.print(Panel("Setup path for tool installations", border_style="magenta")) choice = Prompt.ask("[magenta]Set Path[/magenta]", choices=["1", "2"], default="2") if choice == "1": inpath = Prompt.ask("[magenta]Enter Path (with Directory Name)[/magenta]") with open(fpath, "w") as f: f.write(inpath) console.print(f"[green]Successfully Set Path to:[/green] {inpath}") else: autopath = "/home/hackingtool/" with open(fpath, "w") as f: f.write(autopath) console.print(f"[green]Your Default Path Is:[/green] {autopath}") sleep(1) return fpath def interact_menu(): while True: try: Loading @@ -183,13 +166,11 @@ def interact_menu(): if 0 <= choice < len(all_tools): tool = all_tools[choice] name = tool_definitions[choice][0] console.print(Panel(f"[bold magenta]{tool_definitions[choice][1]} Selected:[/bold magenta] [white]{name}")) console.print(Panel( f"[bold magenta]{tool_definitions[choice][1]} Selected:[/bold magenta] [white]{name}[/white]" )) try: fn = getattr(tool, "show_options", None) if callable(fn): fn() else: console.print(f"[yellow]Tool '{name}' has no interactive menu (show_options).[/yellow]") tool.show_options() except Exception as e: console.print(Panel(f"[red]Error while opening {name}[/red]\n{e}", border_style="red")) if not Confirm.ask("[magenta]Return to main menu?[/magenta]", default=True): Loading @@ -198,29 +179,32 @@ def interact_menu(): else: console.print("[red]Invalid selection. Pick a number from the menu.[/red]") except KeyboardInterrupt: console.print("\n[bold red]Interrupted by user — exiting[/bold red]") console.print("\n[bold red]Interrupted — exiting[/bold red]") break def main(): try: if system() == "Linux": fpath = choose_path() with open(fpath) as f: archive = f.readline().strip() os.makedirs(archive, exist_ok=True) os.chdir(archive) from os_detect import CURRENT_OS if CURRENT_OS.system == "windows": console.print(Panel("[bold red]Please run this tool on Linux or macOS.[/bold red]")) if Confirm.ask("Open guidance link in your browser?", default=True): webbrowser.open_new_tab(f"{REPO_WEB_URL}#windows") return if CURRENT_OS.system not in ("linux", "macos"): console.print(f"[yellow]Unsupported OS: {CURRENT_OS.system}. Proceeding anyway...[/yellow]") # Ensure ~/.hackingtool/tools/ exists — no os.chdir(), tools use absolute paths tools_dir = get_tools_dir() console.print(f"[dim]Tools directory: {tools_dir}[/dim]") AllTools().show_info() interact_menu() elif system() == "Windows": console.print(Panel("[bold red]Please run this tool on a Debian/Linux system for best results[/bold red]")) if Confirm.ask("Open guidance link in your browser?", default=True): webbrowser.open_new_tab("https://tinyurl.com/y522modc") sleep(2) else: console.print("[yellow]Please Check Your System or Open New Issue ...[/yellow]") except KeyboardInterrupt: console.print("\n[bold red]Exiting ..!!![/bold red]") sleep(1) console.print("\n[bold red]Exiting...[/bold red]") if __name__ == "__main__": Loading install.py +182 −140 File changed.Preview size limit exceeded, changes collapsed. Show changes tools/tool_manager.py +58 −87 Original line number Diff line number Diff line # coding=utf-8 import os import sys import subprocess from time import sleep from core import HackingTool from core import HackingToolsCollection from rich.console import Console from rich.theme import Theme from rich.table import Table from rich.panel import Panel from rich.prompt import Prompt from rich.prompt import Confirm _theme = Theme({"purple": "#7B61FF"}) console = Console(theme=_theme) from core import HackingTool, HackingToolsCollection, console from constants import APP_INSTALL_DIR, APP_BIN_PATH, USER_CONFIG_DIR, REPO_URL class UpdateTool(HackingTool): TITLE = "Update Tool or System" DESCRIPTION = "Update Tool or System" DESCRIPTION = "Update system packages or pull the latest hackingtool code" def __init__(self): super(UpdateTool, self).__init__([ super().__init__([ ("Update System", self.update_sys), ("Update Hackingtool", self.update_ht) ("Update Hackingtool", self.update_ht), ], installable=False, runnable=False) def update_sys(self): os.system("sudo apt update && sudo apt full-upgrade -y") os.system("sudo apt-get install tor openssl curl && sudo apt-get update tor openssl curl") os.system("sudo apt-get install python3-pip") from os_detect import CURRENT_OS, PACKAGE_UPDATE_CMDS mgr = CURRENT_OS.pkg_manager cmd = PACKAGE_UPDATE_CMDS.get(mgr) if cmd: priv = "" if CURRENT_OS.system == "macos" else "sudo " os.system(f"{priv}{cmd}") else: console.print("[warning]Unknown package manager — update manually.[/warning]") def update_ht(self): os.system("sudo chmod +x /etc/;" "sudo chmod +x /usr/share/doc;" "sudo rm -rf /usr/share/doc/hackingtool/;" "cd /etc/;" "sudo rm -rf /etc/hackingtool/;" "mkdir hackingtool;" "cd hackingtool;" "git clone https://github.com/Z4nzu/hackingtool.git;" "cd hackingtool;" "sudo chmod +x install.sh;" "./install.sh") if not APP_INSTALL_DIR.exists(): console.print(f"[error]Install directory not found: {APP_INSTALL_DIR}[/error]") console.print("[dim]Run install.py first.[/dim]") return console.print(f"[bold cyan]Pulling latest code from {REPO_URL}...[/bold cyan]") result = subprocess.run( ["git", "pull", "--rebase"], cwd=str(APP_INSTALL_DIR), capture_output=True, text=True, ) if result.returncode != 0: console.print(f"[error]git pull failed:\n{result.stderr}[/error]") return pip = str(APP_INSTALL_DIR / "venv" / "bin" / "pip") if (APP_INSTALL_DIR / "venv" / "bin" / "pip").exists(): subprocess.run([pip, "install", "-q", "-r", str(APP_INSTALL_DIR / "requirements.txt")]) console.print("[success]✔ Hackingtool updated.[/success]") class UninstallTool(HackingTool): TITLE = "Uninstall HackingTool" DESCRIPTION = "Uninstall HackingTool" DESCRIPTION = "Remove hackingtool from system" def __init__(self): super(UninstallTool, self).__init__([ ('Uninstall', self.uninstall) super().__init__([ ("Uninstall", self.uninstall), ], installable=False, runnable=False) def uninstall(self): console.print("hackingtool started to uninstall..\n") import shutil console.print("[warning]This will remove hackingtool from your system.[/warning]") if not Confirm.ask("Continue?", default=False): return if APP_INSTALL_DIR.exists(): shutil.rmtree(str(APP_INSTALL_DIR)) console.print(f"[success]✔ Removed {APP_INSTALL_DIR}[/success]") else: console.print(f"[dim]{APP_INSTALL_DIR} not found — already removed?[/dim]") if APP_BIN_PATH.exists(): APP_BIN_PATH.unlink() console.print(f"[success]✔ Removed launcher {APP_BIN_PATH}[/success]") if Confirm.ask(f"Also remove user data at {USER_CONFIG_DIR}?", default=False): shutil.rmtree(str(USER_CONFIG_DIR), ignore_errors=True) console.print(f"[success]✔ Removed {USER_CONFIG_DIR}[/success]") console.print("[bold green]Hackingtool uninstalled. Goodbye.[/bold green]") sleep(1) os.system("sudo chmod +x /etc/;" "sudo chmod +x /usr/share/doc;" "sudo rm -rf /usr/share/doc/hackingtool/;" "cd /etc/;" "sudo rm -rf /etc/hackingtool/;") console.print("\n[bold green]Hackingtool Successfully Uninstalled... Goodbye.[/bold green]") sys.exit() sys.exit(0) class ToolManager(HackingToolsCollection): TITLE = "Update or Uninstall | Hackingtool" TOOLS = [ UpdateTool(), UninstallTool() UninstallTool(), ] def pretty_print(self): table = Table(title="Tool Manager — Update / Uninstall", show_lines=True, expand=True) table.add_column("Title", style="purple", no_wrap=True) table.add_column("Description", style="purple") for t in self.TOOLS: desc = getattr(t, "DESCRIPTION", "") or "" table.add_row(t.TITLE, desc.strip().replace("\n", " ")) panel = Panel(table, title="[purple]Available Manager Tools[/purple]", border_style="purple") console.print(panel) def show_options(self, parent=None): console.print("\n") panel = Panel.fit("[bold magenta]Tool Manager[/bold magenta]\nSelect an action to run.", border_style="purple") console.print(panel) table = Table(title="[bold cyan]Available Options[/bold cyan]", show_lines=True, expand=True) table.add_column("Index", justify="center", style="bold yellow") table.add_column("Tool Name", justify="left", style="bold green") table.add_column("Description", justify="left", style="white") for i, tool in enumerate(self.TOOLS): title = getattr(tool, "TITLE", tool.__class__.__name__) desc = getattr(tool, "DESCRIPTION", "—") table.add_row(str(i + 1), title, desc) table.add_row("[red]99[/red]", "[bold red]Exit[/bold red]", "Return to previous menu") console.print(table) try: choice = int(Prompt.ask("[bold cyan]Select an option[/bold cyan]", default="99")) if 1 <= choice <= len(self.TOOLS): selected = self.TOOLS[choice - 1] if hasattr(selected, "show_options"): selected.show_options(parent=self) elif hasattr(selected, "run"): selected.run() else: console.print("[bold yellow]Selected tool has no runnable interface.[/bold yellow]") elif choice == 99: return 99 except Exception: console.print("[bold red]Invalid choice. Try again.[/bold red]") return self.show_options(parent=parent) if __name__ == "__main__": manager = ToolManager() manager.pretty_print() manager.show_options() update.sh +20 −38 Original line number Diff line number Diff line #!/bin/bash set -euo pipefail RED='\e[1;31m' GREEN='\e[1;32m' YELLOW='\e[1;33m' BLUE='\e[1;34m' INSTALL_DIR="/usr/share/hackingtool" echo "███████╗██╗ ██╗███╗ ██╗███████╗██╗ ██╗ "; echo "╚══███╔╝██║ ██║████╗ ██║╚══███╔╝██║ ██║ "; echo " ███╔╝ ███████║██╔██╗ ██║ ███╔╝ ██║ ██║ "; echo " ███╔╝ ╚════██║██║╚██╗██║ ███╔╝ ██║ ██║ "; echo "███████╗ ██║██║ ╚████║███████╗╚██████╔╝ "; echo "╚══════╝ ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═════╝ "; echo " "; # Check if the script is run as root if [[ $EUID -ne 0 ]]; then echo -e "${RED}[ERROR]\e[0m This script must be run as root." echo "[ERROR] Run as root: sudo bash update.sh" exit 1 fi install_dir="/usr/share/hackingtool" # Change to the directory containing the install.sh script cd $install_dir || { echo -e "${RED}[ERROR]\e[0m Could not change to directory containing install.sh."; exit 1; } echo -e "${YELLOW}[*] Checking Internet Connection ..${NC}" echo ""; if curl -s -m 10 https://www.google.com > /dev/null || curl -s -m 10 https://www.github.com > /dev/null; then echo -e "${GREEN}[✔] Internet connection is OK [✔]${NC}" echo "" else echo -e "${RED}[✘] Please check your internet connection[✘]" echo "" if [[ ! -d "$INSTALL_DIR" ]]; then echo "[ERROR] Installation not found at $INSTALL_DIR. Run install.py first." exit 1 fi echo -e "[*]Marking hackingtool directory as safe-directory" git config --global --add safe.directory $install_dir # Update the repository and the tool itself echo -e "${BLUE}[INFO]\e[0m Updating repository and tool..." if ! sudo git pull; then echo -e "${RED}[ERROR]\e[0m Failed to update repository or tool." 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" # Re-run the installation script echo -e "${GREEN}[INFO]\e[0m Running installation script..." if ! sudo bash install.sh; then echo -e "${RED}[ERROR]\e[0m Failed to run installation script." exit 1 echo "[*] Pulling latest changes..." 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 -r "$INSTALL_DIR/requirements.txt" else echo "[WARN] venv not found — skipping pip update. Run install.py to create it." fi echo -e "${GREEN}[SUCCESS]\e[0m Tool updated successfully." echo "[✔] Hackingtool updated. Run 'hackingtool' to start." Loading
hackingtool.py +84 −100 Original line number Diff line number Diff line #!/usr/bin/env python3 # Version 1.1.0 (rich UI - purple theme) import os import sys # ── Python version guard (must be before any other local import) ─────────────── if sys.version_info < (3, 10): print( f"[ERROR] Python 3.10 or newer is required.\n" f"You are running Python {sys.version_info.major}.{sys.version_info.minor}.\n" f"Upgrade with: sudo apt install python3.10" ) sys.exit(1) import os import webbrowser from platform import system from time import sleep from rich.console import Console from rich.panel import Panel from rich.table import Table from rich.prompt import Prompt, IntPrompt, Confirm from rich.prompt import IntPrompt, Confirm from rich.align import Align from rich.text import Text from rich import box from rich.columns import Columns from rich.rule import Rule from rich.padding import Padding from core import HackingToolsCollection from constants import VERSION_DISPLAY, REPO_WEB_URL from config import get_tools_dir from tools.anonsurf import AnonSurfTools from tools.ddos import DDOSTools from tools.exploit_frameworks import ExploitFrameworkTools Loading Loading @@ -67,7 +75,7 @@ tool_definitions = [ ("DDOS Attack Tools", "⚡"), ("Remote Administrator Tools (RAT)", "🖥️"), ("XSS Attack Tools", "💥"), ("Steganograhy tools", "🖼️"), ("Steganography tools", "🖼️"), ("Other tools", "✨"), ("Update or Uninstall | Hackingtool", "♻️"), ] Loading @@ -90,7 +98,7 @@ all_tools = [ XSSAttackTools(), SteganographyTools(), OtherTools(), ToolManager() ToolManager(), ] Loading @@ -99,20 +107,18 @@ class AllTools(HackingToolsCollection): TOOLS = all_tools def show_info(self): header = Text() header.append(ASCII_LOGO, style="bold magenta") header.append("\n\n",) header = Text(ASCII_LOGO, style="bold magenta") footer = Text.assemble( (" https://github.com/Z4nzu/hackingtool ", "bold bright_black"), (f" {REPO_WEB_URL} ", "bold bright_black"), (" | ",), ("Version 1.1.0", "bold green"), (VERSION_DISPLAY, "bold green"), ) warning = Text(" Please Don't Use For illegal Activity ", style="bold red") warning = Text(" Please Don't Use For Illegal Activity ", style="bold red") panel = Panel( Align.center(header + Text("\n") + footer + Text("\n") + warning), box=box.DOUBLE, padding=(1, 2), border_style="magenta" border_style="magenta", ) console.print(panel) Loading @@ -123,7 +129,7 @@ def build_menu(): table.add_column("name", justify="left") for idx, (title, icon) in enumerate(tool_definitions): if idx == 17: if idx == len(tool_definitions) - 1: label = "[bold magenta]99[/bold magenta]" name = f"[bold magenta]{icon} {title}[/bold magenta]" else: Loading @@ -131,47 +137,24 @@ def build_menu(): name = f"[white]{icon}[/white] [magenta]{title}[/magenta]" table.add_row(label, name) top_panel = Panel( console.print(Panel( Align.center(Text("HackingTool — Main Menu", style="bold white on magenta"), vertical="middle"), style="magenta", padding=(0, 1), box=box.ROUNDED ) menu_panel = Panel.fit( style="magenta", padding=(0, 1), box=box.ROUNDED, )) console.print(Panel.fit( table, title="[bold magenta]Select a tool[/bold magenta]", border_style="bright_magenta", box=box.SQUARE ) footer = Align.center(Text("Choose number and press Enter — 99 to exit", style="italic bright_black")) console.print(top_panel) console.print(menu_panel) box=box.SQUARE, )) console.print(Rule(style="bright_black")) console.print(footer) console.print(Align.center(Text( "Choose number and press Enter — 99 to exit", style="italic bright_black", ))) console.print("") def choose_path(): fpath = os.path.expanduser("~/hackingtoolpath.txt") if not os.path.exists(fpath): os.system("clear" if system() == "Linux" else "cls") build_menu() console.print(Panel("Setup path for tool installations", border_style="magenta")) choice = Prompt.ask("[magenta]Set Path[/magenta]", choices=["1", "2"], default="2") if choice == "1": inpath = Prompt.ask("[magenta]Enter Path (with Directory Name)[/magenta]") with open(fpath, "w") as f: f.write(inpath) console.print(f"[green]Successfully Set Path to:[/green] {inpath}") else: autopath = "/home/hackingtool/" with open(fpath, "w") as f: f.write(autopath) console.print(f"[green]Your Default Path Is:[/green] {autopath}") sleep(1) return fpath def interact_menu(): while True: try: Loading @@ -183,13 +166,11 @@ def interact_menu(): if 0 <= choice < len(all_tools): tool = all_tools[choice] name = tool_definitions[choice][0] console.print(Panel(f"[bold magenta]{tool_definitions[choice][1]} Selected:[/bold magenta] [white]{name}")) console.print(Panel( f"[bold magenta]{tool_definitions[choice][1]} Selected:[/bold magenta] [white]{name}[/white]" )) try: fn = getattr(tool, "show_options", None) if callable(fn): fn() else: console.print(f"[yellow]Tool '{name}' has no interactive menu (show_options).[/yellow]") tool.show_options() except Exception as e: console.print(Panel(f"[red]Error while opening {name}[/red]\n{e}", border_style="red")) if not Confirm.ask("[magenta]Return to main menu?[/magenta]", default=True): Loading @@ -198,29 +179,32 @@ def interact_menu(): else: console.print("[red]Invalid selection. Pick a number from the menu.[/red]") except KeyboardInterrupt: console.print("\n[bold red]Interrupted by user — exiting[/bold red]") console.print("\n[bold red]Interrupted — exiting[/bold red]") break def main(): try: if system() == "Linux": fpath = choose_path() with open(fpath) as f: archive = f.readline().strip() os.makedirs(archive, exist_ok=True) os.chdir(archive) from os_detect import CURRENT_OS if CURRENT_OS.system == "windows": console.print(Panel("[bold red]Please run this tool on Linux or macOS.[/bold red]")) if Confirm.ask("Open guidance link in your browser?", default=True): webbrowser.open_new_tab(f"{REPO_WEB_URL}#windows") return if CURRENT_OS.system not in ("linux", "macos"): console.print(f"[yellow]Unsupported OS: {CURRENT_OS.system}. Proceeding anyway...[/yellow]") # Ensure ~/.hackingtool/tools/ exists — no os.chdir(), tools use absolute paths tools_dir = get_tools_dir() console.print(f"[dim]Tools directory: {tools_dir}[/dim]") AllTools().show_info() interact_menu() elif system() == "Windows": console.print(Panel("[bold red]Please run this tool on a Debian/Linux system for best results[/bold red]")) if Confirm.ask("Open guidance link in your browser?", default=True): webbrowser.open_new_tab("https://tinyurl.com/y522modc") sleep(2) else: console.print("[yellow]Please Check Your System or Open New Issue ...[/yellow]") except KeyboardInterrupt: console.print("\n[bold red]Exiting ..!!![/bold red]") sleep(1) console.print("\n[bold red]Exiting...[/bold red]") if __name__ == "__main__": Loading
tools/tool_manager.py +58 −87 Original line number Diff line number Diff line # coding=utf-8 import os import sys import subprocess from time import sleep from core import HackingTool from core import HackingToolsCollection from rich.console import Console from rich.theme import Theme from rich.table import Table from rich.panel import Panel from rich.prompt import Prompt from rich.prompt import Confirm _theme = Theme({"purple": "#7B61FF"}) console = Console(theme=_theme) from core import HackingTool, HackingToolsCollection, console from constants import APP_INSTALL_DIR, APP_BIN_PATH, USER_CONFIG_DIR, REPO_URL class UpdateTool(HackingTool): TITLE = "Update Tool or System" DESCRIPTION = "Update Tool or System" DESCRIPTION = "Update system packages or pull the latest hackingtool code" def __init__(self): super(UpdateTool, self).__init__([ super().__init__([ ("Update System", self.update_sys), ("Update Hackingtool", self.update_ht) ("Update Hackingtool", self.update_ht), ], installable=False, runnable=False) def update_sys(self): os.system("sudo apt update && sudo apt full-upgrade -y") os.system("sudo apt-get install tor openssl curl && sudo apt-get update tor openssl curl") os.system("sudo apt-get install python3-pip") from os_detect import CURRENT_OS, PACKAGE_UPDATE_CMDS mgr = CURRENT_OS.pkg_manager cmd = PACKAGE_UPDATE_CMDS.get(mgr) if cmd: priv = "" if CURRENT_OS.system == "macos" else "sudo " os.system(f"{priv}{cmd}") else: console.print("[warning]Unknown package manager — update manually.[/warning]") def update_ht(self): os.system("sudo chmod +x /etc/;" "sudo chmod +x /usr/share/doc;" "sudo rm -rf /usr/share/doc/hackingtool/;" "cd /etc/;" "sudo rm -rf /etc/hackingtool/;" "mkdir hackingtool;" "cd hackingtool;" "git clone https://github.com/Z4nzu/hackingtool.git;" "cd hackingtool;" "sudo chmod +x install.sh;" "./install.sh") if not APP_INSTALL_DIR.exists(): console.print(f"[error]Install directory not found: {APP_INSTALL_DIR}[/error]") console.print("[dim]Run install.py first.[/dim]") return console.print(f"[bold cyan]Pulling latest code from {REPO_URL}...[/bold cyan]") result = subprocess.run( ["git", "pull", "--rebase"], cwd=str(APP_INSTALL_DIR), capture_output=True, text=True, ) if result.returncode != 0: console.print(f"[error]git pull failed:\n{result.stderr}[/error]") return pip = str(APP_INSTALL_DIR / "venv" / "bin" / "pip") if (APP_INSTALL_DIR / "venv" / "bin" / "pip").exists(): subprocess.run([pip, "install", "-q", "-r", str(APP_INSTALL_DIR / "requirements.txt")]) console.print("[success]✔ Hackingtool updated.[/success]") class UninstallTool(HackingTool): TITLE = "Uninstall HackingTool" DESCRIPTION = "Uninstall HackingTool" DESCRIPTION = "Remove hackingtool from system" def __init__(self): super(UninstallTool, self).__init__([ ('Uninstall', self.uninstall) super().__init__([ ("Uninstall", self.uninstall), ], installable=False, runnable=False) def uninstall(self): console.print("hackingtool started to uninstall..\n") import shutil console.print("[warning]This will remove hackingtool from your system.[/warning]") if not Confirm.ask("Continue?", default=False): return if APP_INSTALL_DIR.exists(): shutil.rmtree(str(APP_INSTALL_DIR)) console.print(f"[success]✔ Removed {APP_INSTALL_DIR}[/success]") else: console.print(f"[dim]{APP_INSTALL_DIR} not found — already removed?[/dim]") if APP_BIN_PATH.exists(): APP_BIN_PATH.unlink() console.print(f"[success]✔ Removed launcher {APP_BIN_PATH}[/success]") if Confirm.ask(f"Also remove user data at {USER_CONFIG_DIR}?", default=False): shutil.rmtree(str(USER_CONFIG_DIR), ignore_errors=True) console.print(f"[success]✔ Removed {USER_CONFIG_DIR}[/success]") console.print("[bold green]Hackingtool uninstalled. Goodbye.[/bold green]") sleep(1) os.system("sudo chmod +x /etc/;" "sudo chmod +x /usr/share/doc;" "sudo rm -rf /usr/share/doc/hackingtool/;" "cd /etc/;" "sudo rm -rf /etc/hackingtool/;") console.print("\n[bold green]Hackingtool Successfully Uninstalled... Goodbye.[/bold green]") sys.exit() sys.exit(0) class ToolManager(HackingToolsCollection): TITLE = "Update or Uninstall | Hackingtool" TOOLS = [ UpdateTool(), UninstallTool() UninstallTool(), ] def pretty_print(self): table = Table(title="Tool Manager — Update / Uninstall", show_lines=True, expand=True) table.add_column("Title", style="purple", no_wrap=True) table.add_column("Description", style="purple") for t in self.TOOLS: desc = getattr(t, "DESCRIPTION", "") or "" table.add_row(t.TITLE, desc.strip().replace("\n", " ")) panel = Panel(table, title="[purple]Available Manager Tools[/purple]", border_style="purple") console.print(panel) def show_options(self, parent=None): console.print("\n") panel = Panel.fit("[bold magenta]Tool Manager[/bold magenta]\nSelect an action to run.", border_style="purple") console.print(panel) table = Table(title="[bold cyan]Available Options[/bold cyan]", show_lines=True, expand=True) table.add_column("Index", justify="center", style="bold yellow") table.add_column("Tool Name", justify="left", style="bold green") table.add_column("Description", justify="left", style="white") for i, tool in enumerate(self.TOOLS): title = getattr(tool, "TITLE", tool.__class__.__name__) desc = getattr(tool, "DESCRIPTION", "—") table.add_row(str(i + 1), title, desc) table.add_row("[red]99[/red]", "[bold red]Exit[/bold red]", "Return to previous menu") console.print(table) try: choice = int(Prompt.ask("[bold cyan]Select an option[/bold cyan]", default="99")) if 1 <= choice <= len(self.TOOLS): selected = self.TOOLS[choice - 1] if hasattr(selected, "show_options"): selected.show_options(parent=self) elif hasattr(selected, "run"): selected.run() else: console.print("[bold yellow]Selected tool has no runnable interface.[/bold yellow]") elif choice == 99: return 99 except Exception: console.print("[bold red]Invalid choice. Try again.[/bold red]") return self.show_options(parent=parent) if __name__ == "__main__": manager = ToolManager() manager.pretty_print() manager.show_options()
update.sh +20 −38 Original line number Diff line number Diff line #!/bin/bash set -euo pipefail RED='\e[1;31m' GREEN='\e[1;32m' YELLOW='\e[1;33m' BLUE='\e[1;34m' INSTALL_DIR="/usr/share/hackingtool" echo "███████╗██╗ ██╗███╗ ██╗███████╗██╗ ██╗ "; echo "╚══███╔╝██║ ██║████╗ ██║╚══███╔╝██║ ██║ "; echo " ███╔╝ ███████║██╔██╗ ██║ ███╔╝ ██║ ██║ "; echo " ███╔╝ ╚════██║██║╚██╗██║ ███╔╝ ██║ ██║ "; echo "███████╗ ██║██║ ╚████║███████╗╚██████╔╝ "; echo "╚══════╝ ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═════╝ "; echo " "; # Check if the script is run as root if [[ $EUID -ne 0 ]]; then echo -e "${RED}[ERROR]\e[0m This script must be run as root." echo "[ERROR] Run as root: sudo bash update.sh" exit 1 fi install_dir="/usr/share/hackingtool" # Change to the directory containing the install.sh script cd $install_dir || { echo -e "${RED}[ERROR]\e[0m Could not change to directory containing install.sh."; exit 1; } echo -e "${YELLOW}[*] Checking Internet Connection ..${NC}" echo ""; if curl -s -m 10 https://www.google.com > /dev/null || curl -s -m 10 https://www.github.com > /dev/null; then echo -e "${GREEN}[✔] Internet connection is OK [✔]${NC}" echo "" else echo -e "${RED}[✘] Please check your internet connection[✘]" echo "" if [[ ! -d "$INSTALL_DIR" ]]; then echo "[ERROR] Installation not found at $INSTALL_DIR. Run install.py first." exit 1 fi echo -e "[*]Marking hackingtool directory as safe-directory" git config --global --add safe.directory $install_dir # Update the repository and the tool itself echo -e "${BLUE}[INFO]\e[0m Updating repository and tool..." if ! sudo git pull; then echo -e "${RED}[ERROR]\e[0m Failed to update repository or tool." 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" # Re-run the installation script echo -e "${GREEN}[INFO]\e[0m Running installation script..." if ! sudo bash install.sh; then echo -e "${RED}[ERROR]\e[0m Failed to run installation script." exit 1 echo "[*] Pulling latest changes..." 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 -r "$INSTALL_DIR/requirements.txt" else echo "[WARN] venv not found — skipping pip update. Run install.py to create it." fi echo -e "${GREEN}[SUCCESS]\e[0m Tool updated successfully." echo "[✔] Hackingtool updated. Run 'hackingtool' to start."