diff --git a/DOCKER_BUILD.md b/DOCKER_BUILD.md index 08c10e9..d756632 100644 --- a/DOCKER_BUILD.md +++ b/DOCKER_BUILD.md @@ -77,8 +77,37 @@ docker buildx build --platform linux/arm/v7 \ ## Running the Container +### First-Time Setup (Required) + +On the first run, you need to create an admin account. Run the container in interactive mode: + +```bash +# Create recon_data directory first (if it doesn't exist) +mkdir -p recon_data + +# Run in interactive mode to create admin account +docker run -it \ + --name subscraper \ + -p 8342:8342 \ + -v $(pwd)/recon_data:/app/recon_data \ + subscraper:latest + +# Follow the prompts to: +# 1. Create an admin account (username and password) +# 2. Configure basic settings (or skip and configure later via web UI) +``` + +After the admin account is created and the server starts, you can: +- Press `Ctrl+C` to stop the server +- Remove the container: `docker rm subscraper` +- Run in detached mode (see "Basic Run" below) + +**Important**: The admin account and all configuration is stored in the `recon_data` volume, so you only need to do this once. + ### Basic Run +After initial setup, run in detached mode: + ```bash docker run -d \ --name subscraper \ @@ -212,7 +241,9 @@ All completed job reports, scan results, and configuration will be preserved. ## Docker Compose (Optional) -Create a `docker-compose.yml` file for easier management: +### First-Time Setup with Docker Compose + +Create a `docker-compose.yml` file: ```yaml version: '3.8' @@ -239,10 +270,17 @@ services: start_period: 5s ``` -Then run: +**First Run**: Create admin account in interactive mode: ```bash -# Start the service +# Build and run in interactive mode for first-time setup +# Use --service-ports to expose port 8342 during setup +docker-compose run --rm --service-ports subscraper + +# Follow the prompts to create admin account +# After setup, stop with Ctrl+C + +# Then start normally in detached mode docker-compose up -d # View logs @@ -260,6 +298,24 @@ docker-compose down ## Troubleshooting +### Issue: "ERROR: No admin account exists" + +If the container exits immediately with this error, you need to create an admin account first: + +```bash +# Run in interactive mode to create admin account +docker run -it \ + --name subscraper \ + -p 8342:8342 \ + -v $(pwd)/recon_data:/app/recon_data \ + subscraper:latest + +# Or with docker-compose: +docker-compose run --rm subscraper +``` + +Follow the prompts to create an admin account. The account is saved in `recon_data/users.json` and persists across container restarts. + ### Issue: "no matching manifest" This means the image wasn't built for your platform. Rebuild with: diff --git a/Dockerfile b/Dockerfile index 0f2eda9..ad96d0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ # Multi-platform Dockerfile for subScraper reconnaissance tool # Supports linux/amd64, linux/arm64, linux/arm/v7 -FROM --platform=$BUILDPLATFORM python:3.11-slim AS base +FROM python:3.11-slim AS base # Set environment variables ENV PYTHONUNBUFFERED=1 \ - DEBIAN_FRONTEND=noninteractive \ - GO_VERSION=1.21.5 + DEBIAN_FRONTEND=noninteractive -# Install system dependencies +# Install system dependencies and Go from Debian repository +# This ensures compatibility across all platforms and avoids download issues RUN apt-get update && apt-get install -y \ curl \ wget \ @@ -16,22 +16,12 @@ RUN apt-get update && apt-get install -y \ build-essential \ libssl-dev \ ca-certificates \ + golang \ + unzip \ && rm -rf /var/lib/apt/lists/* -# Install Go (required for many recon tools) -ARG TARGETARCH -RUN case ${TARGETARCH} in \ - "amd64") GO_ARCH="amd64" ;; \ - "arm64") GO_ARCH="arm64" ;; \ - "arm") GO_ARCH="armv6l" ;; \ - *) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \ - esac && \ - wget -q https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GO_ARCH}.tar.gz - -ENV PATH="/usr/local/go/bin:${PATH}" \ - GOPATH="/root/go" \ +# Set Go environment variables +ENV GOPATH="/root/go" \ GOBIN="/root/go/bin" ENV PATH="${GOBIN}:${PATH}" @@ -53,8 +43,11 @@ RUN go install -v github.com/ffuf/ffuf/v2@latest # Install gowitness for screenshots RUN go install -v github.com/sensepost/gowitness@latest -# Install findomain (binary release) -RUN case ${TARGETARCH} in \ +# Install findomain (binary release) - optional, architecture-specific +# Declare TARGETARCH for architecture detection (defaults to amd64 if not set by buildx) +# Note: When building without buildx, TARGETARCH will default to amd64 +ARG TARGETARCH +RUN case ${TARGETARCH:-amd64} in \ "amd64") FINDOMAIN_ARCH="x86_64" ;; \ "arm64") FINDOMAIN_ARCH="aarch64" ;; \ "arm") FINDOMAIN_ARCH="armv7" ;; \ @@ -64,13 +57,23 @@ RUN case ${TARGETARCH} in \ unzip -q findomain.zip && \ chmod +x findomain && \ mv findomain /usr/local/bin/ && \ - rm findomain.zip || echo "Findomain installation skipped for ${TARGETARCH}" + rm findomain.zip || echo "Findomain installation skipped for ${TARGETARCH:-amd64}" -# Install Python-based tools -RUN pip install --no-cache-dir sublist3r nikto-parser +# Install Python-based tool (sublist3r) +# Note: nikto-parser was removed as it doesn't exist in PyPI +RUN pip install --no-cache-dir sublist3r -# Install nikto (Perl-based) -RUN apt-get update && apt-get install -y nikto && rm -rf /var/lib/apt/lists/* +# Install nikto (Perl-based) from GitHub +# First install Perl and dependencies +RUN apt-get update && apt-get install -y \ + perl \ + libnet-ssleay-perl \ + libjson-perl \ + libxml-writer-perl \ + && rm -rf /var/lib/apt/lists/* && \ + git clone https://github.com/sullo/nikto /opt/nikto && \ + ln -s /opt/nikto/program/nikto.pl /usr/local/bin/nikto && \ + chmod +x /opt/nikto/program/nikto.pl # Install nmap RUN apt-get update && apt-get install -y nmap && rm -rf /var/lib/apt/lists/*