[ale] Something to play with, if you've a mind...

William Wylde durtybill at gmail.com
Sun Sep 28 21:47:18 EDT 2025


1.  Dockerfile:
============================================================

└─$ cat Dockerfile
FROM kalilinux/kali-rolling

LABEL maintainer="ought-plating-rice at duck.com"
LABEL description="Kali with Tor, BurpSuite, Claude Desktop, and VNC"

# Avoid interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive

# --- Layer 1: Install all APT packages first ---
# This combines all dependencies for the initial setup.
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    # Core tools
    git build-essential tor burpsuite curl nano wget \
    # VNC and Desktop Environment (with required base fonts)
    xfce4 xfce4-goodies tightvncserver xfonts-base \
    # Dependencies for Claude install script
    p7zip-full cargo rustc imagemagick icoutils xdg-utils \
    # GUI libraries for Electron and other apps (using t64 packages for
modern distros)
    libatk1.0-0t64 libatk-bridge2.0-0t64 libcups2t64 libgtk-3-0t64 libgbm1
libasound2t64 \
    libxext6 libxrender1 libxtst6 libxi6 x11-apps && \
    # Clean up APT cache
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# --- NEW LAYER: Install and Verify D-Bus ---
# We install dbus-x11 separately and immediately verify that dbus-launch
exists.
# This will cause the build to fail here if the installation is not
successful.
RUN apt-get update && apt-get install -y dbus-x11 && which dbus-launch

# --- Layer 2: Install Node.js, pnpm, and global npm packages ---
# We need these for the Claude build process.
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \
    apt-get update && apt-get install -y nodejs && \
    # Install global npm packages -- npx is now included with nodejs
    npm install -g electron @napi-rs/cli && \
    # Explicitly set the SHELL env var for the pnpm install script to avoid
auto-detection errors
    curl -fsSL https://get.pnpm.io/install.sh | SHELL=bash sh -

# Add pnpm to the PATH for subsequent commands
ENV PNPM_HOME="/root/.local/share/pnpm"
ENV PATH="${PNPM_HOME}:${PATH}"

# --- Layer 3: Build and Install Claude Desktop from the script's logic ---
# This section replicates the steps from your install.sh script inside the
container.
RUN mkdir -p /tmp/claude-build && cd /tmp/claude-build && \
    # 1. Download the Windows .exe
    echo "[INFO] Downloading Claude..." && \
    wget "
https://storage.googleapis.com/osprey-downloads-c02f6a0d-347c-492b-a752-3e0651722e97/nest-win-x64/Claude-Setup-x64.exe"
-O Claude-Setup-x64.exe && \
    \
    # 2. Extract the app files
    echo "[INFO] Extracting Claude..." && \
    7z x -y Claude-Setup-x64.exe && \
    NUPKG_FILE=$(find . -name "*.nupkg" | head -n 1) && \
    7z x -y "$NUPKG_FILE" && \
    \
    # 3. Create and build the fake native module to replace the Windows one
    echo "[INFO] Building fake native module..." && \
    mkdir -p patchy-cnb && cd patchy-cnb && \
    # Create Cargo.toml
    echo '[package]\nname = "patchy-cnb"\nversion = "0.1.0"\nedition =
"2021"\n[lib]\ncrate-type = ["cdylib"]\n[dependencies]\nnapi = { version =
"2.12.2", default-features = false, features = ["napi4"] }\nnapi-derive =
"2.12.2"' > Cargo.toml && \
    # Create src/lib.rs (using a shortened stub from your script)
    mkdir -p src && \
    echo '#![deny(clippy::all)]\n#[macro_use]\nextern crate
napi_derive;\n#[napi]\npub fn get_active_window_handle() -> u32 { 0 }' >
src/lib.rs && \
    # Create package.json
    echo '{\n"name": "patchy-cnb",\n"main": "index.js",\n"napi": {\n"name":
"patchy-cnb",\n"triples": {"defaults": false, "additional":
["x86_64-unknown-linux-gnu"]}},\n"scripts": {\n"build": "napi build
--platform --release"},\n"devDependencies": {\n"@napi-rs/cli": "^2.18.4"}}'
> package.json && \
    # Build the module
    pnpm install && pnpm run build && \
    cd .. && \
    \
    # 4. Process and repackage app.asar with the fake native module
    echo "[INFO] Repackaging app.asar..." && \
    mkdir -p /tmp/asar-contents && \
    npx asar extract lib/net45/resources/app.asar /tmp/asar-contents && \
    # Replace the Windows .node file with our fake Linux one
    cp patchy-cnb/patchy-cnb.linux-x64-gnu.node
/tmp/asar-contents/node_modules/claude-native/claude-native-binding.node &&
\
    # FIX: Create the missing resources directory and i18n file that the
app requires
    mkdir -p /tmp/asar-contents/resources/i18n && \
    echo "{}" > /tmp/asar-contents/resources/i18n/en-US.json && \
    # Repack the asar archive
    npx asar pack /tmp/asar-contents /tmp/app.asar && \
    \
    # 5. Install the application to /opt/claude-desktop
    echo "[INFO] Installing Claude to /opt..." && \
    mkdir -p /opt/claude-desktop && \
    cp /tmp/app.asar /opt/claude-desktop/app.asar && \
    cp -r lib/net45/resources/app.asar.unpacked /opt/claude-desktop/ && \
    # Create a launcher script with --no-sandbox flag for compatibility
    echo '#!/bin/bash\nelectron /opt/claude-desktop/app.asar --no-sandbox
"$@"' > /usr/local/bin/claude-desktop && \
    chmod +x /usr/local/bin/claude-desktop && \
    \
    # 6. Final cleanup
    echo "[INFO] Cleaning up build files..." && \
    rm -rf /tmp/claude-build /tmp/asar-contents /tmp/app.asar

# --- Layer 4: VNC and Startup Configuration ---
# Set the USER environment variable for VNC server
ENV USER=root

# Set up VNC server user and password
RUN mkdir -p /root/.vnc && \
    echo "600f8477" | vncpasswd -f > /root/.vnc/passwd && \
    chmod 600 /root/.vnc/passwd

# Copy the startup script into the container
COPY start.sh /start.sh
RUN chmod +x /start.sh

# Expose the VNC port
EXPOSE 5901

# Set the default command to run our startup script
CMD ["/start.sh"]

===========================================================


2. start.sh
===========================================================
#!/bin/bash

# Clean up any stale VNC lock files that might prevent startup
rm -f /tmp/.X1-lock /tmp/.X11-unix/X1

# --- VNC Configuration ---
# Create the .vnc directory and a custom xstartup script that launches XFCE.
# This is the standard, reliable way to start the desktop environment.
echo "[INFO] Configuring VNC xstartup for XFCE desktop..."
mkdir -p /root/.vnc
cat > /root/.vnc/xstartup <<EOF
#!/bin/sh

# Start the XFCE4 Desktop Environment
startxfce4 &
EOF

# Make the xstartup script executable
chmod 755 /root/.vnc/xstartup

# --- Service Startup ---
# Start Tor service in the background
echo "[INFO] Starting Tor service..."
service tor start

# Start the D-Bus session bus
echo "[INFO] Starting D-Bus session..."
eval $(dbus-launch --sh-syntax)

# Start the VNC server in the background using the standard wrapper.
# It will automatically use the xstartup script we created.
echo "[INFO] Starting VNC server on display :1..."
vncserver :1 -geometry 1280x800 -depth 24

# Keep the container running by tailing the VNC log file.
# This provides a persistent foreground process and shows live logs.
echo "[INFO] Container is running. Tailing VNC log..."
tail -f /root/.vnc/*.log


-- 
--
“Keep away from people who try to belittle your ambitions. Small people
always do that, but the really great make you feel that you, too, can
become great.”  ― Mark Twain
Philippians 4:13
<https://www.biblegateway.com/passage/?search=Philippians%204%3A13&version=NKJV>
*I* *can* *do* *all* *things* *through* *Christ* *who* *strengthens* *me*.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.ale.org/pipermail/ale/attachments/20250928/3afb341b/attachment.htm>


More information about the Ale mailing list