diff --git a/ct/rea.sh b/ct/rea.sh new file mode 100644 index 0000000000..b353a6ba3b --- /dev/null +++ b/ct/rea.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: Estcool9 +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://github.com/morluto/rea + +APP="REA" +var_tags="${var_tags:-reverse-engineering;security;analysis;mcp}" +var_cpu="${var_cpu:-8}" +var_ram="${var_ram:-12288}" +var_disk="${var_disk:-80}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-no}" +export var_testurl="${var_testurl:-https://github.com/community-scripts/DevScripts/issues/2696}" +var_unprivileged="${var_unprivileged:-1}" +var_nesting="${var_nesting:-1}" +var_keyctl="${var_keyctl:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if ! command -v rea >/dev/null 2>&1 || [[ ! -f /etc/systemd/system/rea-mcp.service ]]; then + msg_error "No REA MCP installation found!" + exit 1 + fi + + if check_for_gh_release "ghidra" "NationalSecurityAgency/ghidra"; then + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "ghidra" "NationalSecurityAgency/ghidra" "prebuild" "latest" "/opt/ghidra" "ghidra_*_PUBLIC_*.zip" + fi + + if check_for_gh_release "jadx-headless-mcp" "1013503897/jadx-headless-mcp"; then + JADX_VERSION="$(get_latest_github_release "1013503897/jadx-headless-mcp" false)" + JADX_TAG="${JADX_VERSION#v}" + USE_ORIGINAL_FILENAME=true fetch_and_deploy_gh_release "jadx-headless-mcp" "1013503897/jadx-headless-mcp" "singlefile" "latest" "/opt" "jadx-headless-mcp-*-all.jar" + curl_with_retry "https://github.com/1013503897/jadx-headless-mcp/releases/download/${JADX_VERSION}/jadx-headless-mcp.sha256" "/tmp/jadx-headless-mcp.sha256" + (cd /opt && sha256sum -c /tmp/jadx-headless-mcp.sha256) + install -m 0644 "/opt/jadx-headless-mcp-${JADX_TAG}-all.jar" /opt/jadx-headless-mcp.jar + fi + + msg_info "Updating REA" + $STD npm install --global --allow-scripts=frida rea-agents@latest + msg_ok "Updated REA" + + systemctl restart rea-mcp + systemctl is-active --quiet rea-mcp + msg_ok "Restarted REA MCP" + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW}MCP endpoint (restrict access to a trusted MCP gateway):${CL}" +echo -e "${GATEWAY}${BGN}http://${IP}:8765/mcp${CL}" diff --git a/install/rea-install.sh b/install/rea-install.sh new file mode 100644 index 0000000000..47a874c856 --- /dev/null +++ b/install/rea-install.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: Estcool9 +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://github.com/morluto/rea + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +export DEBIAN_FRONTEND=noninteractive + +msg_info "Installing REA analysis dependencies" +$STD apt install -y \ + binutils \ + binwalk \ + file \ + gdb \ + ltrace \ + procps \ + strace \ + tcpdump \ + tshark \ + unzip \ + 7zip +msg_ok "Installed REA analysis dependencies" + +NODE_VERSION="24" setup_nodejs +JAVA_VERSION="25" setup_java + +fetch_and_deploy_gh_release "ghidra" "NationalSecurityAgency/ghidra" "prebuild" "latest" "/opt/ghidra" "ghidra_*_PUBLIC_*.zip" +GHIDRA_DIR="/opt/ghidra" +if [[ -z "$GHIDRA_DIR" || ! -x "$GHIDRA_DIR/support/analyzeHeadless" ]]; then + msg_error "Ghidra headless installation was not found" + exit 1 +fi + +JADX_VERSION="$(get_latest_github_release "1013503897/jadx-headless-mcp" false)" +JADX_TAG="${JADX_VERSION#v}" +USE_ORIGINAL_FILENAME=true fetch_and_deploy_gh_release "jadx-headless-mcp" "1013503897/jadx-headless-mcp" "singlefile" "latest" "/opt" "jadx-headless-mcp-*-all.jar" +curl_with_retry "https://github.com/1013503897/jadx-headless-mcp/releases/download/${JADX_VERSION}/jadx-headless-mcp.sha256" "/tmp/jadx-headless-mcp.sha256" +(cd /opt && sha256sum -c /tmp/jadx-headless-mcp.sha256) +install -m 0644 "/opt/jadx-headless-mcp-${JADX_TAG}-all.jar" /opt/jadx-headless-mcp.jar +msg_ok "Installed and verified JADX MCP adapter" + +$STD npm install --global --allow-scripts=frida rea-agents@latest +REA_BIN="$(command -v rea)" +REA_PACKAGE_DIR="$(npm root -g)/rea-agents" +if [[ -z "$REA_BIN" || ! -f "$REA_PACKAGE_DIR/package.json" ]]; then + msg_error "REA npm package installation could not be verified" + exit 1 +fi +msg_ok "Installed REA" + +getent group rea >/dev/null || groupadd --system rea +id rea >/dev/null 2>&1 || useradd --system --home-dir /var/lib/rea --shell /usr/sbin/nologin --create-home --gid rea rea +install -d -o rea -g rea -m 0750 /var/lib/rea/.agents/skills +install -d -o rea -g rea -m 0750 /data/samples /data/projects /data/extracted /data/reports /data/checkpoints +cp -a "$REA_PACKAGE_DIR/skills/reverse-engineer-anything" /var/lib/rea/.agents/skills/ +chown -R rea:rea /var/lib/rea /data + +JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(command -v javac)")")")" +MCP_ALLOWED_HOSTS="${LOCAL_IP},127.0.0.1,localhost,rea-mcp" + +cat </etc/systemd/system/rea-mcp.service +[Unit] +Description=REA Reverse Engineering MCP +Documentation=https://github.com/morluto/rea +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +User=rea +Group=rea +WorkingDirectory=/data +Environment=HOME=/var/lib/rea +Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +Environment=JAVA_HOME=$JAVA_HOME +Environment=GHIDRA_INSTALL_DIR=$GHIDRA_DIR +Environment=REA_ANALYSIS_PROVIDER=ghidra +Environment=REA_JADX_MCP_JAR=/opt/jadx-headless-mcp.jar +Environment=REA_GHIDRA_CHECKPOINT_DIR=/data/checkpoints +Environment=MCP_ALLOWED_HOSTS=$MCP_ALLOWED_HOSTS +ExecStart=$REA_BIN mcp --http --host 0.0.0.0 --allowed-hosts \${MCP_ALLOWED_HOSTS} --port 8765 +Restart=on-failure +RestartSec=5 +UMask=0077 +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=full +ProtectHome=true +ProtectKernelTunables=true +ProtectControlGroups=true +LockPersonality=true +RestrictSUIDSGID=true +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +ReadWritePaths=/data /var/lib/rea /tmp + +[Install] +WantedBy=multi-user.target +REA_UNIT_EOF + +systemctl enable -q --now rea-mcp.service +if ! systemctl is-active --quiet rea-mcp.service; then + msg_error "REA MCP service failed to start; inspect systemctl status rea-mcp" + exit 1 +fi +msg_ok "Created REA MCP service" + +msg_info "Checking REA analysis providers" +runuser -u rea -- env HOME=/var/lib/rea JAVA_HOME="$JAVA_HOME" GHIDRA_INSTALL_DIR="$GHIDRA_DIR" REA_ANALYSIS_PROVIDER=ghidra REA_JADX_MCP_JAR=/opt/jadx-headless-mcp.jar REA_GHIDRA_CHECKPOINT_DIR=/data/checkpoints "$REA_BIN" doctor --provider ghidra --json | jq -e '.healthy == true' >/dev/null +runuser -u rea -- env HOME=/var/lib/rea JAVA_HOME="$JAVA_HOME" GHIDRA_INSTALL_DIR="$GHIDRA_DIR" REA_ANALYSIS_PROVIDER=ghidra REA_JADX_MCP_JAR=/opt/jadx-headless-mcp.jar REA_GHIDRA_CHECKPOINT_DIR=/data/checkpoints "$REA_BIN" doctor --provider jadx --json | jq -e '.healthy == true' >/dev/null +msg_ok "Ghidra and JADX providers are healthy" + +motd_ssh +customize +cleanup_lxc diff --git a/json/rea.json b/json/rea.json new file mode 100644 index 0000000000..c1f9857598 --- /dev/null +++ b/json/rea.json @@ -0,0 +1,54 @@ +{ + "name": "REA", + "slug": "rea", + "categories": [ + 20 + ], + "date_created": "2026-11-22", + "type": "ct", + "platforms": [ + "pve" + ], + "updateable": true, + "privileged": false, + "architectures": [ + "amd64" + ], + "interface_port": 8765, + "documentation": "https://github.com/morluto/rea#readme", + "website": "https://github.com/morluto/rea", + "repository": "https://github.com/morluto/rea", + "logo": "https://raw.githubusercontent.com/morluto/rea/main/assets/rea-plugin.png", + "description": "REA is a reverse-engineering CLI and Model Context Protocol (MCP) server for static analysis of binaries, applications, and firmware. It integrates Ghidra and JADX to expose analysis workflows and evidence to AI agents and developer tools.", + "install_methods": [ + { + "type": "default", + "script": "ct/rea.sh", + "resources": { + "cpu": 8, + "ram": 12288, + "hdd": 80, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "REA's HTTP MCP endpoint has no built-in client authentication. Restrict TCP 8765 to a trusted MCP gateway and terminate OAuth 2.0 at that gateway.", + "type": "warning" + }, + { + "text": "Reserve the container's DHCP address so the MCP URL and Host allowlist remain stable.", + "type": "info" + }, + { + "text": "Run unfamiliar executable samples only in a disposable VM; this service container is intended for analysis tooling, not arbitrary code execution.", + "type": "warning" + } + ] +}