forked from miaoyc666/Mobile-Security-Framework-MobSF
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
108 lines (92 loc) · 3 KB
/
Dockerfile
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
# Base image
FROM ubuntu:22.04
# Labels and Credits
LABEL \
name="MobSF" \
author="Ajin Abraham <ajin25@gmail.com>" \
maintainer="Ajin Abraham <ajin25@gmail.com>" \
contributor_1="OscarAkaElvis <oscar.alfonso.diaz@gmail.com>" \
contributor_2="Vincent Nadal <vincent.nadal@orange.fr>" \
description="Mobile Security Framework (MobSF) is an automated, all-in-one mobile application (Android/iOS/Windows) pen-testing, malware analysis and security assessment framework capable of performing static and dynamic analysis."
ENV DEBIAN_FRONTEND=noninteractive
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
RUN apt update -y && apt install -y --no-install-recommends \
build-essential \
locales \
sqlite3 \
fontconfig-config \
libjpeg-turbo8 \
libxrender1 \
libfontconfig1 \
libxext6 \
fontconfig \
xfonts-75dpi \
xfonts-base \
python3 \
python3-dev \
python3-pip \
wget \
curl \
git \
jq \
unzip \
android-tools-adb && \
locale-gen en_US.UTF-8 && \
apt upgrade -y
ENV MOBSF_USER=mobsf \
MOBSF_PLATFORM=docker \
MOBSF_ADB_BINARY=/usr/bin/adb \
JDK_FILE=openjdk-20.0.2_linux-x64_bin.tar.gz \
JDK_FILE_ARM=openjdk-20.0.2_linux-aarch64_bin.tar.gz \
WKH_FILE=wkhtmltox_0.12.6.1-2.jammy_amd64.deb \
WKH_FILE_ARM=wkhtmltox_0.12.6.1-2.jammy_arm64.deb \
JAVA_HOME=/jdk-20.0.2 \
PATH=$JAVA_HOME/bin:$PATH \
LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONFAULTHANDLER=1 \
POETRY_VERSION=1.6.1
# Install wkhtmltopdf & OpenJDK
ARG TARGETPLATFORM
COPY scripts/install_java_wkhtmltopdf.sh .
RUN ./install_java_wkhtmltopdf.sh
RUN groupadd -g 9901 $MOBSF_USER
RUN adduser $MOBSF_USER --shell /bin/false -u 9901 --ingroup $MOBSF_USER --gecos "" --disabled-password
COPY poetry.lock pyproject.toml ./
RUN python3 -m pip install --upgrade --no-cache-dir pip poetry==${POETRY_VERSION} && \
poetry config virtualenvs.create false && \
poetry install --only main --no-root --no-interaction --no-ansi
# Cleanup
RUN \
apt remove -y \
libssl-dev \
libffi-dev \
libxml2-dev \
libxslt1-dev \
python3-dev \
wget && \
apt clean && \
apt autoclean && \
apt autoremove -y && \
rm -rf /var/lib/apt/lists/* /tmp/* > /dev/null 2>&1
WORKDIR /home/mobsf/Mobile-Security-Framework-MobSF
# Copy source code
COPY . .
# Check if Postgres support needs to be enabled.
# Disabled by default
ARG POSTGRES=False
ENV POSTGRES_USER=postgres \
POSTGRES_PASSWORD=password \
POSTGRES_DB=mobsf \
POSTGRES_HOST=postgres
RUN ./scripts/postgres_support.sh $POSTGRES
HEALTHCHECK CMD curl --fail http://host.docker.internal:8000/ || exit 1
# Expose MobSF Port and Proxy Port
EXPOSE 8000 8000 1337 1337
RUN chown -R $MOBSF_USER:$MOBSF_USER /home/mobsf
USER mobsf
# Run MobSF
CMD ["/home/mobsf/Mobile-Security-Framework-MobSF/scripts/entrypoint.sh"]