karnel-termux 4.9.4 → 4.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://github.com/israelmarques1024-dotcom/karnel-termux">
11
- <img src="https://img.shields.io/badge/version-4.9.0-0078D4?style=for-the-badge" alt="Version">
11
+ <img src="https://img.shields.io/badge/version-4.9.6-0078D4?style=for-the-badge" alt="Version">
12
12
  </a>
13
13
  <a href="https://www.npmjs.com/package/karnel-termux">
14
14
  <img src="https://img.shields.io/npm/v/karnel-termux?style=for-the-badge&logo=npm&color=cb3837" alt="npm">
@@ -44,6 +44,8 @@ Created by **Israel Marques**.
44
44
  - **Professional editor** — code-server (VS Code in browser)
45
45
  - **Second brain** — Memory system with AI search and idea graph
46
46
  - **Voice commands** — Speak to your AI agents
47
+ - **Plugin system** — Install community plugins from GitHub: `karnel plugin install <user/repo>`
48
+ - **Security tools** — Nmap, Hydra, SQLMap, Metasploit and more: `karnel install security`
47
49
 
48
50
  > [!IMPORTANT]
49
51
  > Designed exclusively for **Termux on Android**. Does not work on other platforms.
@@ -125,6 +127,34 @@ karnel
125
127
  | `utils` | fconv, notes, treex, passman, applaunch, qrcode, zork and more | `karnel install utils` |
126
128
  | `osint` | Robin v2.8, Tor, Streamlit, and LLM providers | `karnel install osint` |
127
129
  | `voice` | Speech-to-agent through Termux:API | `karnel install voice` |
130
+ | `plugin` | Plugin manager — install extensions from GitHub | `karnel install plugin` |
131
+ | `security` | Nmap, Hydra, SQLMap, Metasploit, Gobuster and more | `karnel install security` |
132
+
133
+ ---
134
+
135
+ ## Plugin System
136
+
137
+ Extend Karnel with community plugins from GitHub:
138
+
139
+ ```bash
140
+ karnel plugin install <user/repo> # Install a plugin
141
+ karnel plugin list # List installed plugins
142
+ karnel plugin remove <name> # Uninstall a plugin
143
+ karnel plugin create <name> # Scaffold a new plugin
144
+ ```
145
+
146
+ Each plugin needs a `karnel-plugin.json` manifest at the root of its repo. Commands go in a `commands/` directory — Karnel discovers them automatically at startup.
147
+
148
+ ## Security Tools
149
+
150
+ Install security auditing tools:
151
+
152
+ ```bash
153
+ karnel install security # Install all
154
+ karnel install security --nmap --hydra --sqlmap # Install specific ones
155
+ ```
156
+
157
+ Includes: Nmap, Hydra, Nikto, SQLMap, Gobuster, Dirb, WPScan, John the Ripper, Aircrack-ng, Metasploit.
128
158
 
129
159
  ---
130
160
 
@@ -150,7 +150,11 @@ _brain_pick_file() {
150
150
  _brain_editor() {
151
151
  local title="$1"
152
152
 
153
- if ! command -v ${EDITOR:-nano} &>/dev/null; then
153
+ local editor_bin
154
+ editor_bin="${EDITOR:-nano}"
155
+ editor_bin="${editor_bin%% *}"
156
+
157
+ if ! command -v "$editor_bin" &>/dev/null; then
154
158
  log_error "${EDITOR:-nano} not found"
155
159
  list_item "Install it: ${D_CYAN}karnel install editor${D_NC}"
156
160
  return 1
@@ -1082,7 +1086,10 @@ brain_edit() {
1082
1086
  fi
1083
1087
 
1084
1088
  local editor="${EDITOR:-}"
1085
- if command -v ${EDITOR:-nano} &>/dev/null; then
1089
+ local editor_bin
1090
+ editor_bin="${EDITOR:-nano}"
1091
+ editor_bin="${editor_bin%% *}"
1092
+ if command -v "$editor_bin" &>/dev/null; then
1086
1093
  editor="${EDITOR:-nano}"
1087
1094
  elif [[ -z "$editor" ]] || ! command -v "$editor" &>/dev/null; then
1088
1095
  for e in vim nano vi; do
@@ -152,6 +152,14 @@ _install_full_module() {
152
152
  import "@/modules/utils"
153
153
  install_utils
154
154
  ;;
155
+ plugin)
156
+ import "@/modules/plugin"
157
+ install_plugin_module
158
+ ;;
159
+ security)
160
+ import "@/modules/security"
161
+ install_security
162
+ ;;
155
163
  *)
156
164
  log_warn "Unknown install target: $target"
157
165
  echo "Run 'karnel install' to see available targets"
@@ -806,6 +814,9 @@ _install_specific_tools() {
806
814
  utils)
807
815
  _batch_tool_action "utils" "install" "${tools[@]}"
808
816
  ;;
817
+ security)
818
+ _batch_tool_action "security" "install" "${tools[@]}"
819
+ ;;
809
820
  *)
810
821
  log_warn "Unknown install target: $module"
811
822
  echo "Run 'karnel install' to see available targets"
@@ -76,6 +76,14 @@ list_main() {
76
76
  utils)
77
77
  _list_utils
78
78
  ;;
79
+ plugin)
80
+ import "@/tools/plugins/install"
81
+ echo "Installed Plugins:"
82
+ _list_plugins
83
+ ;;
84
+ security)
85
+ _list_security
86
+ ;;
79
87
  voice)
80
88
  _list_voice
81
89
  ;;
@@ -523,6 +531,30 @@ _grep_config() {
523
531
  fi
524
532
  }
525
533
 
534
+ # ===== LIST SECURITY =====
535
+ _list_security() {
536
+ echo
537
+ box "Security Tools"
538
+ echo
539
+ log_info "Available security tools:"
540
+ echo
541
+ table_start "Tool" "Install Flag" "Command" "Status"
542
+ table_row "Nmap" "--nmap" "nmap" "$(_check_cmd "nmap")"
543
+ table_row "Hydra" "--hydra" "hydra" "$(_check_cmd "hydra")"
544
+ table_row "Nikto" "--nikto" "nikto" "$(_check_cmd "nikto")"
545
+ table_row "SQLMap" "--sqlmap" "sqlmap" "$(_check_cmd "sqlmap")"
546
+ table_row "Gobuster" "--gobuster" "gobuster" "$(_check_cmd "gobuster")"
547
+ table_row "Dirb" "--dirb" "dirb" "$(_check_cmd "dirb")"
548
+ table_row "WPScan" "--wpscan" "wpscan" "$(_check_cmd "wpscan")"
549
+ table_row "John the Ripper" "--john" "john" "$(_check_cmd "john")"
550
+ table_row "Aircrack-ng" "--aircrack-ng" "aircrack-ng" "$(_check_cmd "aircrack-ng")"
551
+ table_row "Metasploit" "--metasploit" "msfconsole" "$(_check_cmd "msfconsole")"
552
+ table_end
553
+ echo
554
+ log_info "Install all: ${D_CYAN}karnel install security${NC}"
555
+ echo
556
+ }
557
+
526
558
  # ===== LIST VOICE =====
527
559
  _list_voice() {
528
560
  echo
@@ -63,6 +63,12 @@ open_main() {
63
63
  voice)
64
64
  url="$OPEN_BASE_URL/karnel/voice"
65
65
  ;;
66
+ plugin)
67
+ url="$OPEN_BASE_URL/karnel/plugin"
68
+ ;;
69
+ security)
70
+ url="$OPEN_BASE_URL/karnel/security"
71
+ ;;
66
72
  osint|robin)
67
73
  url="$OPEN_BASE_URL/karnel/osint"
68
74
  ;;
@@ -0,0 +1,110 @@
1
+ import "@/tools/plugins/install"
2
+
3
+ plugin_main() {
4
+ if [[ $# -eq 0 ]]; then
5
+ plugin_help
6
+ return
7
+ fi
8
+
9
+ local subcmd="$1"
10
+ shift
11
+
12
+ case "$subcmd" in
13
+ install)
14
+ if [[ $# -lt 1 ]]; then
15
+ log_error "Usage: karnel plugin install <user/repo>"
16
+ return 1
17
+ fi
18
+ install_plugin "$1"
19
+ ;;
20
+ remove|uninstall)
21
+ if [[ $# -lt 1 ]]; then
22
+ log_error "Usage: karnel plugin remove <name>"
23
+ return 1
24
+ fi
25
+ uninstall_plugin "$1"
26
+ ;;
27
+ update)
28
+ if [[ $# -lt 1 ]]; then
29
+ log_error "Usage: karnel plugin update <name>"
30
+ return 1
31
+ fi
32
+ update_plugin "$1"
33
+ ;;
34
+ list|ls)
35
+ _list_plugins
36
+ ;;
37
+ create|scaffold)
38
+ if [[ $# -lt 1 ]]; then
39
+ log_error "Usage: karnel plugin create <name>"
40
+ return 1
41
+ fi
42
+ _scaffold_plugin "$1"
43
+ ;;
44
+ *)
45
+ log_error "Unknown plugin subcommand: $subcmd"
46
+ plugin_help
47
+ return 1
48
+ ;;
49
+ esac
50
+ }
51
+
52
+ plugin_help() {
53
+ echo
54
+ box "Plugin Manager"
55
+ echo
56
+ log_info "Usage: karnel plugin <subcommand> [options]"
57
+ echo
58
+ separator_section "Subcommands"
59
+ echo
60
+ printf " ${D_CYAN}%-20s${NC} %s\n" "install <user/repo>" "Install a plugin from GitHub"
61
+ printf " ${D_CYAN}%-20s${NC} %s\n" "remove <name>" "Uninstall a plugin"
62
+ printf " ${D_CYAN}%-20s${NC} %s\n" "update <name>" "Update a plugin"
63
+ printf " ${D_CYAN}%-20s${NC} %s\n" "list" "List installed plugins"
64
+ printf " ${D_CYAN}%-20s${NC} %s\n" "create <name>" "Scaffold a new plugin"
65
+ echo
66
+ echo "Plugins are installed from GitHub repos."
67
+ echo "Each plugin must have a karnel-plugin.json manifest at root."
68
+ echo
69
+ separator_section "Examples"
70
+ echo
71
+ echo " karnel plugin install username/my-karnel-plugin"
72
+ echo " karnel plugin list"
73
+ echo " karnel plugin remove my-karnel-plugin"
74
+ echo " karnel plugin create my-plugin"
75
+ }
76
+
77
+ _scaffold_plugin() {
78
+ local name="$1"
79
+ local dir="$(_plugin_dir "$name")"
80
+
81
+ if [[ -d "$dir" ]]; then
82
+ log_error "Plugin '$name' already exists"
83
+ return 1
84
+ fi
85
+
86
+ mkdir -p "$dir/commands" "$dir/tools"
87
+
88
+ cat > "$dir/karnel-plugin.json" <<EOF
89
+ {
90
+ "name": "$name",
91
+ "version": "1.0.0",
92
+ "description": "My Karnel plugin",
93
+ "commands": ["hello"],
94
+ "tools": []
95
+ }
96
+ EOF
97
+
98
+ cat > "$dir/commands/hello.sh" <<'EOF'
99
+ hello_main() {
100
+ echo "Hello from plugin '$1'!"
101
+ echo "Args: $*"
102
+ }
103
+ EOF
104
+
105
+ chmod +x "$dir/commands/"*.sh
106
+ log_success "Plugin '$name' scaffolded at $dir"
107
+ echo "Edit $dir/karnel-plugin.json to configure"
108
+ echo "Add commands in $dir/commands/"
109
+ echo "Run: karnel hello"
110
+ }
@@ -143,6 +143,14 @@ _reinstall_full_module() {
143
143
  import "@/modules/utils"
144
144
  reinstall_utils
145
145
  ;;
146
+ plugin)
147
+ import "@/modules/plugin"
148
+ reinstall_plugin_module
149
+ ;;
150
+ security)
151
+ import "@/modules/security"
152
+ reinstall_security
153
+ ;;
146
154
  *)
147
155
  log_warn "Unknown reinstall target: $target"
148
156
  echo "Run 'karnel reinstall' to see available targets"
@@ -78,7 +78,13 @@ show_main() {
78
78
  return
79
79
  fi
80
80
 
81
- local readme_path="$KARNEL_PATH/tools/$module/$tool/README.md"
81
+ local readme_path
82
+ readme_path="$(realpath "$KARNEL_PATH/tools/$module/$tool/README.md" 2>/dev/null)"
83
+
84
+ if [[ -z "$readme_path" || "$readme_path" != "$KARNEL_PATH/tools/"* ]]; then
85
+ log_error "No documentation found for $module/$tool"
86
+ return 1
87
+ fi
82
88
 
83
89
  if [[ ! -f "$readme_path" ]]; then
84
90
  log_error "No documentation found for $module/$tool"
@@ -137,6 +137,14 @@ _uninstall_full_module() {
137
137
  import "@/modules/utils"
138
138
  uninstall_utils
139
139
  ;;
140
+ plugin)
141
+ import "@/modules/plugin"
142
+ uninstall_plugin_module
143
+ ;;
144
+ security)
145
+ import "@/modules/security"
146
+ uninstall_security
147
+ ;;
140
148
  games)
141
149
  import "@/tools/games/all"
142
150
  uninstall_all_games
@@ -143,6 +143,14 @@ _update_full_module() {
143
143
  import "@/modules/utils"
144
144
  update_utils
145
145
  ;;
146
+ plugin)
147
+ import "@/modules/plugin"
148
+ update_plugin_module
149
+ ;;
150
+ security)
151
+ import "@/modules/security"
152
+ update_security
153
+ ;;
146
154
  deploy)
147
155
  import "@/modules/deploy"
148
156
  update_deploy
@@ -36,16 +36,21 @@ karnel_main() {
36
36
 
37
37
  local command_file="$KARNEL_PATH/cli/commands/$cmd.sh"
38
38
 
39
- # verificar si existe el comando
40
39
  if [[ -f "$command_file" ]]; then
41
40
  import "@/cli/commands/$cmd"
42
41
  "${cmd}_main" "$@"
43
- else
44
- log_error "Command not found: $cmd"
45
- echo
46
- karnel_help
47
- return 1
42
+ return $?
48
43
  fi
44
+
45
+ import "@/tools/plugins/install"
46
+ if _plugin_dispatch "$cmd" "$@"; then
47
+ return $?
48
+ fi
49
+
50
+ log_error "Command not found: $cmd"
51
+ echo
52
+ karnel_help
53
+ return 1
49
54
  }
50
55
 
51
56
  karnel_help() {
@@ -72,6 +77,7 @@ karnel_help() {
72
77
  printf " ${D_CYAN}%-12s${NC} %s\n" "list" "List available tools in a module"
73
78
  printf " ${D_CYAN}%-12s${NC} %s\n" "open" "Open docs in browser for a module"
74
79
  printf " ${D_CYAN}%-12s${NC} %s\n" "pg" "PostgreSQL database manager"
80
+ printf " ${D_CYAN}%-12s${NC} %s\n" "plugin" "Plugin manager — install, list, remove"
75
81
  printf " ${D_CYAN}%-12s${NC} %s\n" "reinstall" "Uninstall + install a module"
76
82
  printf " ${D_CYAN}%-12s${NC} %s\n" "restore" "Restore Termux from a backup"
77
83
  printf " ${D_CYAN}%-12s${NC} %s\n" "robin" "Dark Web OSINT tool (Tor + LLM)"
@@ -109,6 +115,8 @@ karnel_help() {
109
115
  printf " ${D_GREEN}%-10s${NC} %s\n" "npm" "Node.js global npm packages"
110
116
  printf " ${D_GREEN}%-10s${NC} %s\n" "osint" "OSINT Tools (Robin — Dark Web + LLM)"
111
117
  printf " ${D_GREEN}%-10s${NC} %s\n" "network" "Network tools (Dark Web, DedSec Network)"
118
+ printf " ${D_GREEN}%-10s${NC} %s\n" "plugin" "Plugin manager — install plugins from GitHub"
119
+ printf " ${D_GREEN}%-10s${NC} %s\n" "security" "Nmap, Hydra, Metasploit, SQLMap, Gobuster, etc."
112
120
  printf " ${D_GREEN}%-10s${NC} %s\n" "shell" "ZSH + Oh My Zsh + 10 plugins"
113
121
  printf " ${D_GREEN}%-10s${NC} %s\n" "ui" "Font, Cursor, Extra-keys, Banner"
114
122
  printf " ${D_GREEN}%-10s${NC} %s\n" "voice" "Speech-to-agent via microphone"
@@ -0,0 +1,34 @@
1
+ install_plugin_module() {
2
+ separator
3
+ box "Plugin Manager"
4
+ separator
5
+
6
+ log_info "Plugin system is built-in. No additional installation needed."
7
+ echo
8
+ log_info "Installing example plugin..."
9
+ install_plugin "israelmarques1024-dotcom/karnel-termux" || true
10
+ }
11
+
12
+ uninstall_plugin_module() {
13
+ log_info "Plugin system is built-in. Nothing to uninstall."
14
+ }
15
+
16
+ update_plugin_module() {
17
+ log_info "Updating all plugins..."
18
+ mkdir -p "$PLUGINS_DIR"
19
+ for dir in "$PLUGINS_DIR"/*/; do
20
+ [[ -d "$dir" ]] || continue
21
+ local name; name="$(basename "$dir")"
22
+ update_plugin "$name"
23
+ done
24
+ }
25
+
26
+ reinstall_plugin_module() {
27
+ log_info "Reinstalling all plugins..."
28
+ mkdir -p "$PLUGINS_DIR"
29
+ for dir in "$PLUGINS_DIR"/*/; do
30
+ [[ -d "$dir" ]] || continue
31
+ local name; name="$(basename "$dir")"
32
+ reinstall_plugin "$name"
33
+ done
34
+ }
@@ -0,0 +1,22 @@
1
+ install_security() {
2
+ separator
3
+ box "Installing Security Tools"
4
+ separator
5
+ import "@/tools/security/all"
6
+ install_all_security
7
+ }
8
+
9
+ uninstall_security() {
10
+ import "@/tools/security/all"
11
+ uninstall_all_security
12
+ }
13
+
14
+ update_security() {
15
+ import "@/tools/security/all"
16
+ update_all_security
17
+ }
18
+
19
+ reinstall_security() {
20
+ import "@/tools/security/all"
21
+ reinstall_all_security
22
+ }
@@ -108,15 +108,19 @@ update_engram() {
108
108
  }
109
109
 
110
110
  _update_engram_impl() {
111
- export GOPATH="$HOME/.local/go"
112
- export GOCACHE="$HOME/.cache/go"
113
- export GOMODCACHE="$GOPATH/pkg/mod"
114
-
115
- if ! git -C "$KARNEL_DATA/engram" pull &>>"$LOG_FILE" && go build -C "$KARNEL_DATA/engram/cmd/engram" -o "$PREFIX/bin/engram" &>>"$LOG_FILE"; then
116
- log_error "Failed to update Engram"
117
- return 1
118
- fi
119
- return 0
111
+ export GOPATH="$HOME/.local/go"
112
+ export GOCACHE="$HOME/.cache/go"
113
+ export GOMODCACHE="$GOPATH/pkg/mod"
114
+
115
+ if ! git -C "$KARNEL_DATA/engram" pull &>>"$LOG_FILE"; then
116
+ log_error "Failed to pull engram repository"
117
+ return 1
118
+ fi
119
+ if ! go build -C "$KARNEL_DATA/engram/cmd/engram" -o "$PREFIX/bin/engram" &>>"$LOG_FILE"; then
120
+ log_error "Failed to build Engram"
121
+ return 1
122
+ fi
123
+ return 0
120
124
  }
121
125
 
122
126
  reinstall_engram() {
@@ -31,7 +31,10 @@ _install_hermes_agent_impl() {
31
31
  if [ -d "$HERMES_DIR/.git" ]; then
32
32
  cd "$HERMES_DIR" && git pull
33
33
  else
34
- git clone https://github.com/NousResearch/hermes-agent.git "$HERMES_DIR"
34
+ git clone https://github.com/NousResearch/hermes-agent.git "$HERMES_DIR" || {
35
+ log_error "Failed to clone hermes-agent repository"
36
+ return 1
37
+ }
35
38
  fi
36
39
 
37
40
  cd "$HERMES_DIR"
@@ -24,10 +24,15 @@ install_kiro() {
24
24
 
25
25
  # Try the official installer first
26
26
  log_info "Running official Kiro installer..."
27
- if echo "y" | curl -fsSL https://cli.kiro.dev/install 2>/dev/null | bash 2>>"$LOG_FILE"; then
28
- if command -v kiro &>/dev/null || command -v kiro-cli &>/dev/null; then
29
- log_success "Kiro installed successfully"
30
- return 0
27
+ local install_script
28
+ install_script=$(curl -fsSL https://cli.kiro.dev/install 2>/dev/null)
29
+ if [[ -n "$install_script" ]]; then
30
+ if echo "y" | bash -s -- <<<"$install_script" 2>>"$LOG_FILE"; then
31
+ hash -r
32
+ if command -v kiro &>/dev/null || command -v kiro-cli &>/dev/null; then
33
+ log_success "Kiro installed successfully"
34
+ return 0
35
+ fi
31
36
  fi
32
37
  fi
33
38
 
@@ -93,6 +98,7 @@ for p in d['packages']:
93
98
  # Create symlink for convenience
94
99
  ln -sf "$PREFIX/bin/kiro-cli" "$PREFIX/bin/kiro"
95
100
  rm -rf "$tmpdir"
101
+ hash -r
96
102
  if command -v kiro-cli &>/dev/null || command -v kiro &>/dev/null; then
97
103
  log_success "Kiro installed from direct download"
98
104
  return 0