-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
111 lines (92 loc) · 2.86 KB
/
Copy pathDockerfile
File metadata and controls
111 lines (92 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# ==========================================
# Builder Environment
# ==========================================
FROM python:3.13-slim AS builder
# Avoid prompt interaction during apt installation
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
GOFLAGS="-buildvcs=false" \
APP_HOME=/opt/storm-framework
WORKDIR ${APP_HOME}
# Install build dependencies.
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
bash \
curl \
golang \
build-essential \
libpcap-dev \
clang \
cmake \
openssl \
cargo \
pkg-config \
libssl-dev \
rustc \
python3-dev \
libffi-dev \
libreadline-dev \
&& rm -rf /var/lib/apt/lists/*
COPY . .
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
pip wheel --no-cache-dir --extra-index-url https://pypi.org/simple -r requirements.txt -w /tmp/wheels
RUN python3 -m scripts.cpl.compiler
RUN chmod +x ${APP_HOME}/smfstart
# ==========================================
# Optimized Runtime
# ==========================================
FROM python:3.13-slim AS runner
LABEL maintainer="StormWorld0"
LABEL description="Offensive Security Framework"
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
APP_HOME=/opt/storm-framework \
TERM=xterm-256color \
GOPATH=/go \
PATH=/go/bin:$PATH
WORKDIR ${APP_HOME}
# Install Runtime Libraries & Optional Tooling
RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
curl \
nmap \
git \
wget \
pkg-config \
procps \
libpcap0.8 \
libpcap-dev \
libssl-dev \
libffi-dev \
ca-certificates \
ffmpeg \
openssl \
libreadline8 \
ncurses-bin \
sqlite3 \
libcap2-bin \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/dpkg/status-old \
&& mkdir -p /go/bin /go/pkg /go/src
# Copy the build wheels results
COPY --from=builder /tmp/wheels /tmp/wheels
# Install wheels. pip maintained
# Reason: Offensive Framework has modules that require library installation
# third parties dynamically at runtime.
RUN pip install --no-cache-dir /tmp/wheels/* && rm -rf /tmp/wheels
# Copy source code & compilation results
COPY --from=builder ${APP_HOME} ${APP_HOME}
# Tagging container environment
RUN echo "smf" > ${APP_HOME}/.docker
# The entrypoint file is in the source code repo.
# which has been copied to ${APP_HOME} from the builder.
RUN chmod +x ${APP_HOME}/docker/entrypoint.sh \
&& ln -s ${APP_HOME}/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
# To perform packet sniffing (libpcap) without full root privileges.
RUN setcap cap_net_raw,cap_net_admin=eip /usr/local/bin/python3.13 && \
setcap cap_net_raw,cap_net_bind_service=eip /usr/bin/nmap
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["./smfstart"]