Skip to content

Commit 1947715

Browse files
committed
Add REA reverse engineering LXC helper
1 parent 2504d9d commit 1947715

3 files changed

Lines changed: 247 additions & 0 deletions

File tree

‎ct/rea.sh‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/usr/bin/env bash
2+
_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main"
3+
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
4+
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
5+
6+
# Copyright (c) 2021-2026 community-scripts ORG
7+
# Author: Estcool9
8+
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
9+
# Source: https://github.com/morluto/rea
10+
11+
APP="REA"
12+
var_tags="${var_tags:-reverse-engineering;security;analysis;mcp}"
13+
var_cpu="${var_cpu:-8}"
14+
var_ram="${var_ram:-12288}"
15+
var_disk="${var_disk:-80}"
16+
var_os="${var_os:-debian}"
17+
var_version="${var_version:-13}"
18+
var_arm64="${var_arm64:-no}"
19+
var_unprivileged="${var_unprivileged:-1}"
20+
var_nesting="${var_nesting:-1}"
21+
var_keyctl="${var_keyctl:-1}"
22+
23+
header_info "$APP"
24+
variables
25+
color
26+
catch_errors
27+
28+
function update_script() {
29+
header_info
30+
check_container_storage
31+
check_container_resources
32+
33+
if ! command -v rea >/dev/null 2>&1 || [[ ! -f /etc/systemd/system/rea-mcp.service ]]; then
34+
msg_error "No REA MCP installation found!"
35+
exit 1
36+
fi
37+
38+
RESTART_REA=0
39+
if check_for_gh_release "ghidra" "NationalSecurityAgency/ghidra"; then
40+
msg_info "Updating Ghidra"
41+
fetch_and_deploy_gh_release "ghidra" "NationalSecurityAgency/ghidra" "prebuild" "latest" "/opt/ghidra" "ghidra_*_PUBLIC_*.zip"
42+
msg_ok "Updated Ghidra"
43+
RESTART_REA=1
44+
fi
45+
46+
if check_for_gh_release "rea-agents" "morluto/rea"; then
47+
msg_info "Updating REA"
48+
$STD npm install --global --allow-scripts=frida rea-agents@latest
49+
REA_PACKAGE_DIR="$(npm root -g)/rea-agents"
50+
node -p "require(process.argv[1]).version" "$REA_PACKAGE_DIR/package.json" > "$HOME/.rea-agents"
51+
msg_ok "Updated REA"
52+
RESTART_REA=1
53+
fi
54+
55+
if [[ "$RESTART_REA" == "1" ]]; then
56+
systemctl restart rea-mcp
57+
systemctl is-active --quiet rea-mcp
58+
msg_ok "Restarted REA MCP"
59+
fi
60+
msg_ok "Update completed!"
61+
exit
62+
}
63+
64+
start
65+
build_container
66+
description
67+
68+
msg_ok "Completed Successfully!\n"
69+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
70+
echo -e "${INFO}${YW}MCP endpoint (restrict access to a trusted MCP gateway):${CL}"
71+
echo -e "${GATEWAY}${BGN}http://${IP}:8765/mcp${CL}"

‎install/rea-install.sh‎

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: Estcool9
5+
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
6+
# Source: https://github.com/morluto/rea
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
export DEBIAN_FRONTEND=noninteractive
17+
18+
msg_info "Installing REA analysis dependencies"
19+
$STD apt install -y \
20+
binutils \
21+
binwalk \
22+
file \
23+
gdb \
24+
jq \
25+
ltrace \
26+
procps \
27+
strace \
28+
tcpdump \
29+
tshark \
30+
unzip \
31+
7zip
32+
msg_ok "Installed REA analysis dependencies"
33+
34+
NODE_VERSION="24" setup_nodejs
35+
JAVA_VERSION="25" setup_java
36+
37+
fetch_and_deploy_gh_release "ghidra" "NationalSecurityAgency/ghidra" "prebuild" "latest" "/opt/ghidra" "ghidra_*_PUBLIC_*.zip"
38+
GHIDRA_DIR="/opt/ghidra"
39+
if [[ -z "$GHIDRA_DIR" || ! -x "$GHIDRA_DIR/support/analyzeHeadless" ]]; then
40+
msg_error "Ghidra headless installation was not found"
41+
exit 1
42+
fi
43+
44+
JADX_VERSION="$(get_latest_github_release "1013503897/jadx-headless-mcp" false)"
45+
JADX_TAG="${JADX_VERSION#v}"
46+
JADX_BASE="https://github.com/1013503897/jadx-headless-mcp/releases/download/${JADX_VERSION}"
47+
curl_with_retry "${JADX_BASE}/jadx-headless-mcp-${JADX_TAG}-all.jar" "/tmp/jadx-headless-mcp.jar"
48+
curl_with_retry "${JADX_BASE}/jadx-headless-mcp.sha256" "/tmp/jadx-headless-mcp.sha256"
49+
install -d -m 0755 /opt
50+
install -m 0644 /tmp/jadx-headless-mcp.jar "/opt/jadx-headless-mcp-${JADX_TAG}-all.jar"
51+
(cd /opt && sha256sum -c /tmp/jadx-headless-mcp.sha256)
52+
msg_ok "Installed and verified JADX MCP adapter"
53+
54+
$STD npm install --global --allow-scripts=frida rea-agents@latest
55+
REA_BIN="$(command -v rea)"
56+
REA_PACKAGE_DIR="$(npm root -g)/rea-agents"
57+
if [[ -z "$REA_BIN" || ! -f "$REA_PACKAGE_DIR/package.json" ]]; then
58+
msg_error "REA npm package installation could not be verified"
59+
exit 1
60+
fi
61+
REA_VERSION="$(node -p "require(process.argv[1]).version" "$REA_PACKAGE_DIR/package.json")"
62+
printf '%s' "$REA_VERSION" > "$HOME/.rea-agents"
63+
msg_ok "Installed REA"
64+
65+
getent group rea >/dev/null || groupadd --system rea
66+
id rea >/dev/null 2>&1 || useradd --system --home-dir /var/lib/rea --shell /usr/sbin/nologin --create-home --gid rea rea
67+
install -d -o rea -g rea -m 0750 /var/lib/rea/.agents/skills
68+
install -d -o rea -g rea -m 0750 /data/samples /data/projects /data/extracted /data/reports /data/checkpoints
69+
cp -a "$REA_PACKAGE_DIR/skills/reverse-engineer-anything" /var/lib/rea/.agents/skills/
70+
chown -R rea:rea /var/lib/rea /data
71+
72+
JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(command -v javac)")")")"
73+
MCP_ALLOWED_HOSTS="${LOCAL_IP},127.0.0.1,localhost,rea-mcp"
74+
75+
cat <<REA_UNIT_EOF >/etc/systemd/system/rea-mcp.service
76+
[Unit]
77+
Description=REA Reverse Engineering MCP
78+
Documentation=https://github.com/morluto/rea
79+
After=network-online.target
80+
Wants=network-online.target
81+
82+
[Service]
83+
Type=simple
84+
User=rea
85+
Group=rea
86+
WorkingDirectory=/data
87+
Environment=HOME=/var/lib/rea
88+
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
89+
Environment=JAVA_HOME=$JAVA_HOME
90+
Environment=GHIDRA_INSTALL_DIR=$GHIDRA_DIR
91+
Environment=REA_ANALYSIS_PROVIDER=ghidra
92+
Environment=REA_JADX_MCP_JAR=/opt/jadx-headless-mcp-${JADX_TAG}-all.jar
93+
Environment=REA_GHIDRA_CHECKPOINT_DIR=/data/checkpoints
94+
Environment=MCP_ALLOWED_HOSTS=$MCP_ALLOWED_HOSTS
95+
ExecStart=$REA_BIN mcp --http --host 0.0.0.0 --allowed-hosts \${MCP_ALLOWED_HOSTS} --port 8765
96+
Restart=on-failure
97+
RestartSec=5
98+
UMask=0077
99+
NoNewPrivileges=true
100+
PrivateTmp=true
101+
ProtectSystem=full
102+
ProtectHome=true
103+
ProtectKernelTunables=true
104+
ProtectControlGroups=true
105+
LockPersonality=true
106+
RestrictSUIDSGID=true
107+
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
108+
ReadWritePaths=/data /var/lib/rea /tmp
109+
110+
[Install]
111+
WantedBy=multi-user.target
112+
REA_UNIT_EOF
113+
114+
systemctl enable -q --now rea-mcp.service
115+
if ! systemctl is-active --quiet rea-mcp.service; then
116+
msg_error "REA MCP service failed to start; inspect systemctl status rea-mcp"
117+
exit 1
118+
fi
119+
msg_ok "Created REA MCP service"
120+
121+
msg_info "Checking REA analysis providers"
122+
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-${JADX_TAG}-all.jar" REA_GHIDRA_CHECKPOINT_DIR=/data/checkpoints "$REA_BIN" doctor --provider ghidra --json | jq -e '.healthy == true' >/dev/null
123+
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-${JADX_TAG}-all.jar" REA_GHIDRA_CHECKPOINT_DIR=/data/checkpoints "$REA_BIN" doctor --provider jadx --json | jq -e '.healthy == true' >/dev/null
124+
msg_ok "Ghidra and JADX providers are healthy"
125+
126+
motd_ssh
127+
customize
128+
cleanup_lxc

‎json/rea.json‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "REA",
3+
"slug": "rea",
4+
"categories": [20],
5+
"date_created": "2026-11-22",
6+
"type": "ct",
7+
"platforms": ["pve"],
8+
"updateable": true,
9+
"privileged": false,
10+
"architectures": ["amd64"],
11+
"interface_port": 8765,
12+
"documentation": "https://github.com/morluto/rea#readme",
13+
"website": "https://github.com/morluto/rea",
14+
"repository": "https://github.com/morluto/rea",
15+
"logo": "https://raw.githubusercontent.com/morluto/rea/main/assets/rea-plugin.png",
16+
"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.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/rea.sh",
21+
"resources": {
22+
"cpu": 8,
23+
"ram": 12288,
24+
"hdd": 80,
25+
"os": "Debian",
26+
"version": "13"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": null,
32+
"password": null
33+
},
34+
"notes": [
35+
{
36+
"text": "The HTTP MCP endpoint has no built-in authentication. Allow TCP 8765 only from a trusted MCP gateway and expose OAuth 2.0 through a trusted HTTPS MCPHub deployment.",
37+
"type": "warning"
38+
},
39+
{
40+
"text": "Reserve the container's DHCP address so the MCP URL and Host allowlist remain stable.",
41+
"type": "info"
42+
},
43+
{
44+
"text": "Run unfamiliar executable samples only in a disposable VM; this service container is intended for analysis tooling, not arbitrary code execution.",
45+
"type": "warning"
46+
}
47+
]
48+
}

0 commit comments

Comments
 (0)