Skip to content

Commit 8e29cb0

Browse files
authored
Pip to Poetry, Ubuntu Base image Bump, Dockerfile QA, Python 3.11 support (#2244)
* Docker base image update * Docker file QA * Github Actions version update * Removed unwanted pinned repository * Pip to Poetry migration * Bump httptools * Jump yara-python-dex * Python 3.11 support
1 parent f965183 commit 8e29cb0

21 files changed

+3334
-161
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ tox.ini
99
mobsf/db.sqlite3
1010
Dockerfile
1111
dist
12+
build
13+
.DS_Store
1214
*.egg-info
1315
docker-compose.yml
1416
*.md

.github/workflows/docker-latest.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ jobs:
1111
steps:
1212
-
1313
name: Checkout
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1515
-
1616
name: Set up QEMU
17-
uses: docker/setup-qemu-action@v1
17+
uses: docker/setup-qemu-action@v2
1818
-
1919
name: Set up Docker Buildx
20-
uses: docker/setup-buildx-action@v1
20+
uses: docker/setup-buildx-action@v2
2121
-
2222
name: Login to DockerHub
23-
uses: docker/login-action@v1
23+
uses: docker/login-action@v2
2424
with:
2525
username: ${{ secrets.DOCKER_USERNAME }}
2626
password: ${{ secrets.DOCKER_TOKEN }}
2727
-
2828
name: Build and push
2929
id: docker_build
30-
uses: docker/build-push-action@v2
30+
uses: docker/build-push-action@v4
3131
with:
3232
push: true
3333
context: .

.github/workflows/docker-release.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ jobs:
1010
steps:
1111
-
1212
name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414
-
1515
name: Set up QEMU
16-
uses: docker/setup-qemu-action@v1
16+
uses: docker/setup-qemu-action@v2
1717
-
1818
name: Set up Docker Buildx
19-
uses: docker/setup-buildx-action@v1
19+
uses: docker/setup-buildx-action@v2
2020
-
2121
name: Login to DockerHub
22-
uses: docker/login-action@v1
22+
uses: docker/login-action@v2
2323
with:
2424
username: ${{ secrets.DOCKER_USERNAME }}
2525
password: ${{ secrets.DOCKER_TOKEN }}
@@ -36,7 +36,7 @@ jobs:
3636
-
3737
name: Build and push release
3838
id: docker_build
39-
uses: docker/build-push-action@v2
39+
uses: docker/build-push-action@v4
4040
with:
4141
push: true
4242
context: .

.github/workflows/mobsf-test.yml

+21-18
Original file line numberDiff line numberDiff line change
@@ -11,52 +11,55 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
os: [ubuntu-20.04, macos-latest, windows-latest]
15-
python-version: [3.9, '3.10']
16-
# exclude:
17-
# excludes py38, py39 on Windows
18-
# - os: windows-latest
19-
# python-version: 3.8
14+
os: [ubuntu-22.04, macos-latest, windows-latest]
15+
python-version: [3.9, '3.10', '3.11']
2016

2117
runs-on: ${{ matrix.os }}
2218
steps:
23-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2420
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v1
21+
uses: actions/setup-python@v3
2622
with:
2723
python-version: ${{ matrix.python-version }}
28-
- name: Setup Pip
24+
25+
- name: Setup Pip and Poetry
2926
run: |
30-
python -m pip install pip==22.3.1
27+
python -m pip install pip==22.3.1 poetry==1.6.1
28+
3129
- name: Lint
3230
if: startsWith(matrix.os, 'ubuntu')
3331
run: |
3432
python -m pip install --upgrade tox
3533
tox -e lint
34+
3635
- name: Install Ubuntu Dependencies
3736
if: startsWith(matrix.os, 'ubuntu')
3837
run: |
39-
sudo apt update && sudo apt install -y xfonts-75dpi xfonts-base
40-
export WKHTML_URL=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/
41-
export WKHTML_DEB=wkhtmltox_0.12.6-1.focal_amd64.deb
38+
sudo apt update && sudo apt install -y xfonts-75dpi xfonts-base libssl3
39+
export WKHTML_URL=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/
40+
export WKHTML_DEB=wkhtmltox_0.12.6.1-2.jammy_amd64.deb
4241
wget ${WKHTML_URL}${WKHTML_DEB} && sudo dpkg -i ${WKHTML_DEB} && rm -rf ${WKHTML_DEB}
42+
4343
- name: Install macOS Dependencies
4444
if: startsWith(matrix.os, 'macOS')
4545
run: |
4646
brew install --cask wkhtmltopdf
47+
4748
- name: Install Windows Dependencies
4849
if: startsWith(matrix.os, 'windows')
4950
run: |
5051
choco install wkhtmltopdf
52+
5153
- name: Install Python dependencies
5254
run: |
53-
pip install --use-deprecated=legacy-resolver -r requirements.txt
55+
poetry install --only main --no-interaction --no-ansi || poetry install --only main --no-interaction --no-ansi || poetry install --only main --no-interaction --no-ansi
56+
5457
- name: Migrate Database
5558
run: |
56-
python manage.py makemigrations
57-
python manage.py makemigrations StaticAnalyzer
58-
python manage.py migrate
59+
poetry run python manage.py makemigrations
60+
poetry run python manage.py makemigrations StaticAnalyzer
61+
poetry run python manage.py migrate
5962
- name: Unit Tests
6063
run: |
6164
git submodule update --init --recursive
62-
python manage.py test mobsf
65+
poetry run python manage.py test mobsf

.github/workflows/python-publish.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1414
- name: Set up Python
15-
uses: actions/setup-python@v2
15+
uses: actions/setup-python@v3
1616
with:
1717
python-version: '3.x'
1818
- name: Install dependencies

Dockerfile

+36-36
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Base image
2-
FROM ubuntu:20.04
2+
FROM ubuntu:22.04
33

44
# Labels and Credits
55
LABEL \
@@ -10,16 +10,7 @@ LABEL \
1010
contributor_2="Vincent Nadal <[email protected]>" \
1111
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."
1212

13-
# Environment vars
14-
ENV DEBIAN_FRONTEND="noninteractive" \
15-
MOBSF_PLATFORM="docker" \
16-
JDK_FILE="openjdk-16.0.1_linux-x64_bin.tar.gz" \
17-
JDK_FILE_ARM="openjdk-16.0.1_linux-aarch64_bin.tar.gz" \
18-
WKH_FILE="wkhtmltox_0.12.6-1.focal_amd64.deb" \
19-
WKH_FILE_ARM="wkhtmltox_0.12.6-1.focal_arm64.deb" \
20-
JAVA_HOME="/jdk-16.0.1"
21-
22-
ENV PATH="$JAVA_HOME/bin:$PATH"
13+
ENV DEBIAN_FRONTEND=noninteractive
2314

2415
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
2516
RUN apt update -y && apt install -y --no-install-recommends \
@@ -34,33 +25,46 @@ RUN apt update -y && apt install -y --no-install-recommends \
3425
fontconfig \
3526
xfonts-75dpi \
3627
xfonts-base \
37-
python3.9 \
28+
python3 \
3829
python3-dev \
3930
python3-pip \
4031
wget \
4132
curl \
4233
git \
4334
jq \
44-
android-tools-adb
45-
46-
# Set locales
47-
RUN locale-gen en_US.UTF-8
48-
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
35+
android-tools-adb && \
36+
locale-gen en_US.UTF-8
37+
38+
ENV MOBSF_USER=mobsf \
39+
MOBSF_PLATFORM=docker \
40+
MOBSF_ADB_BINARY=/usr/bin/adb \
41+
JDK_FILE=openjdk-20.0.2_linux-x64_bin.tar.gz \
42+
JDK_FILE_ARM=openjdk-20.0.2_linux-aarch64_bin.tar.gz \
43+
WKH_FILE=wkhtmltox_0.12.6.1-2.jammy_amd64.deb \
44+
WKH_FILE_ARM=wkhtmltox_0.12.6.1-2.jammy_arm64.deb \
45+
JAVA_HOME=/jdk-20.0.2 \
46+
PATH=$JAVA_HOME/bin:$PATH \
47+
LANG=en_US.UTF-8 \
48+
LANGUAGE=en_US:en \
49+
LC_ALL=en_US.UTF-8 \
50+
PYTHONUNBUFFERED=1 \
51+
PYTHONDONTWRITEBYTECODE=1 \
52+
PYTHONFAULTHANDLER=1 \
53+
POETRY_VERSION=1.6.1
4954

5055
# Install wkhtmltopdf & OpenJDK
5156
ARG TARGETPLATFORM
5257

5358
COPY scripts/install_java_wkhtmltopdf.sh .
5459
RUN ./install_java_wkhtmltopdf.sh
5560

56-
RUN groupadd -g 9901 mobsf
57-
RUN adduser mobsf --shell /bin/false -u 9901 --ingroup mobsf --gecos "" --disabled-password
58-
61+
RUN groupadd -g 9901 $MOBSF_USER
62+
RUN adduser $MOBSF_USER --shell /bin/false -u 9901 --ingroup $MOBSF_USER --gecos "" --disabled-password
5963

60-
# Install Requirements
61-
COPY requirements.txt .
62-
RUN pip3 install --upgrade --no-cache-dir setuptools pip && \
63-
pip3 install --quiet --no-cache-dir -r requirements.txt
64+
COPY poetry.lock pyproject.toml ./
65+
RUN python3 -m pip install --upgrade --no-cache-dir pip poetry==${POETRY_VERSION} && \
66+
poetry config virtualenvs.create false && \
67+
poetry install --only main --no-interaction --no-ansi
6468

6569
# Cleanup
6670
RUN \
@@ -80,27 +84,23 @@ WORKDIR /home/mobsf/Mobile-Security-Framework-MobSF
8084
# Copy source code
8185
COPY . .
8286

83-
# Set adb binary path and create apktool framework directory
84-
ENV MOBSF_ADB_BINARY=/usr/bin/adb
85-
RUN mkdir -p /home/mobsf/.local/share/apktool/framework
86-
87-
# Postgres support is set to false by default
87+
# Check if Postgres support needs to be enabled.
88+
# Disabled by default
8889
ARG POSTGRES=False
90+
ENV POSTGRES_USER=postgres \
91+
POSTGRES_PASSWORD=password \
92+
POSTGRES_DB=mobsf \
93+
POSTGRES_HOST=postgres
8994

90-
ENV POSTGRES_USER=postgres
91-
ENV POSTGRES_PASSWORD=password
92-
ENV POSTGRES_DB=mobsf
93-
ENV POSTGRES_HOST=postgres
94-
95-
# Check if Postgres support needs to be enabled
9695
RUN ./scripts/postgres_support.sh $POSTGRES
9796

9897
HEALTHCHECK CMD curl --fail http://host.docker.internal:8000/ || exit 1
9998

10099
# Expose MobSF Port and Proxy Port
101100
EXPOSE 8000 8000 1337 1337
102101

103-
RUN chown -R mobsf:mobsf /home/mobsf/Mobile-Security-Framework-MobSF
102+
RUN chown -R $MOBSF_USER:$MOBSF_USER /home/mobsf
104103
USER mobsf
104+
105105
# Run MobSF
106106
CMD ["/home/mobsf/Mobile-Security-Framework-MobSF/scripts/entrypoint.sh"]

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Mobile Security Framework (MobSF) is an automated, all-in-one mobile application
77

88
Made with ![Love](https://cloud.githubusercontent.com/assets/4301109/16754758/82e3a63c-4813-11e6-9430-6015d98aeaab.png) in India
99

10-
[![python](https://img.shields.io/badge/python-3.8+-blue.svg?logo=python&labelColor=yellow)](https://www.python.org/downloads/)
10+
[![python](https://img.shields.io/badge/python-3.9+-blue.svg?logo=python&labelColor=yellow)](https://www.python.org/downloads/)
1111
[![PyPI version](https://badge.fury.io/py/mobsf.svg)](https://badge.fury.io/py/mobsf)
1212
[![platform](https://img.shields.io/badge/platform-osx%2Flinux%2Fwindows-green.svg)](https://github.com/MobSF/Mobile-Security-Framework-MobSF/)
1313
[![License](https://img.shields.io/:license-GPL--3.0--only-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
@@ -25,7 +25,7 @@ Made with ![Love](https://cloud.githubusercontent.com/assets/4301109/16754758/82
2525
[![Blackhat Arsenal Asia 2015](https://img.shields.io/badge/Black%20Hat%20Arsenal-Asia%202015-blue.svg)](https://www.blackhat.com/asia-15/arsenal.html#yso-mobile-security-framework)
2626
[![Blackhat Arsenal Asia 2018](https://img.shields.io/badge/Black%20Hat%20Arsenal-Asia%202018-blue.svg)](https://www.blackhat.com/asia-18/arsenal.html#mobile-security-framework-mobsf)
2727

28-
MobSF is also bundled with [Android Tamer](https://androidtamer.com/tamer4-release), [BlackArch](https://blackarch.org/mobile.html) and [Pentoo](https://www.pentoo.ch/).
28+
MobSF is also bundled with [Android Tamer](https://tamerplatform.com), [BlackArch](https://blackarch.org/mobile.html) and [Pentoo](https://www.pentoo.ch/).
2929

3030
## Support MobSF
3131

mobsf/MobSF/init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
logger = logging.getLogger(__name__)
1212

13-
VERSION = '3.7.5'
13+
VERSION = '3.7.6'
1414
BANNER = """
1515
__ __ _ ____ _____ _____ _____
1616
| \/ | ___ | |__/ ___|| ___|_ _|___ /|___ |

mobsf/MobSF/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
'application/x-itunes-ipa',
9090
'application/x-zip-compressed',
9191
'application/x-ar',
92+
'text/vnd.a',
9293
'binary/octet-stream',
9394
]
9495
ZIP_MIME = [

0 commit comments

Comments
 (0)